facebook / facebook/flow

String substr/substring first argument should be optional

Đang mở
#2,802 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Library definitions
Ngôn ngữ chính
Rust
Star
22.3k
Fork
1.9k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

https://github.com/facebook/flow/blob/master/lib/core.js#L262-L263

```typescript
substr(from: number, length?: number): string;
substring(start: number, end?: number): string;
```

As I understand it, [ES5 B.2.3](http://www.ecma-international.org/ecma-262/5.1/#sec-B.2.3) and [15.5.4.15](http://www.ecma-international.org/ecma-262/5.1/#sec-15.5.4.15) do not require the first argument to be defined. Step 2 of substr (step 4 of substring) converts the argument to integer, and an undefined value will converted to zero.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.