|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
465 bytes
|
| Line | |
|---|
| 1 | export default function number(x) {
|
|---|
| 2 | return x === null ? NaN : +x;
|
|---|
| 3 | }
|
|---|
| 4 |
|
|---|
| 5 | export function* numbers(values, valueof) {
|
|---|
| 6 | if (valueof === undefined) {
|
|---|
| 7 | for (let value of values) {
|
|---|
| 8 | if (value != null && (value = +value) >= value) {
|
|---|
| 9 | yield value;
|
|---|
| 10 | }
|
|---|
| 11 | }
|
|---|
| 12 | } else {
|
|---|
| 13 | let index = -1;
|
|---|
| 14 | for (let value of values) {
|
|---|
| 15 | if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
|
|---|
| 16 | yield value;
|
|---|
| 17 | }
|
|---|
| 18 | }
|
|---|
| 19 | }
|
|---|
| 20 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.