Comparing version 0.1.2 to 0.1.3
34
fx.js
@@ -40,4 +40,6 @@ export const | ||
hasIter = a => !!(a && a[Symbol.iterator]); | ||
hasIter = a => a != null && !!a[Symbol.iterator], | ||
isIterable = a => a != null && !!a[Symbol.iterator]; | ||
export const L = {}; | ||
@@ -112,18 +114,28 @@ | ||
return { | ||
next() { | ||
next: function recur() { | ||
if (flatting) { | ||
const cur = flatting.next(); | ||
if (!cur.done) return cur; | ||
else flatting = null; | ||
flatting = null; | ||
} | ||
const cur = iter.next(); | ||
if (cur.done) return cur; | ||
return { | ||
value: go1(cur.value, value => { | ||
if (!hasIter(value)) return cur; | ||
flatting = value[Symbol.iterator](); | ||
return flatting.next().value; | ||
}), | ||
done: false | ||
}; | ||
if (hasIter(cur.value)) { | ||
flatting = cur.value[Symbol.iterator](); | ||
return recur(); | ||
} else if (cur.value instanceof Promise) { | ||
return { | ||
value: cur.value.then(value => { | ||
if (!hasIter(value)) return value; | ||
flatting = value[Symbol.iterator](); | ||
const cur = flatting.next(); | ||
return cur.done ? Promise.reject(nop) : cur.value; | ||
}), | ||
done: false | ||
}; | ||
} else { | ||
return cur; | ||
} | ||
}, | ||
@@ -130,0 +142,0 @@ [Symbol.iterator]() { return this; } |
{ | ||
"name": "fxjs2", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Functional Extensions for Javascript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16139
407