mirror of https://github.com/codefeathers/fuse
Muthu Kumar
7 years ago
2 changed files with 18 additions and 13 deletions
@ -1 +1 @@ |
|||||
testscript.js |
testscript*.js |
@ -1,16 +1,21 @@ |
|||||
'use strict'; |
'use strict'; |
||||
|
|
||||
const Select = (value, resolve) => ({ |
const isIterable = val => typeof val === "object" && Symbol.iterator in val; |
||||
value, |
|
||||
for: (test, fn) => { |
class Select { |
||||
if (resolve) return { |
constructor(value, resolve) { |
||||
...Select(value, resolve), |
this.value = value; |
||||
resolve |
this.iterable = isIterable(value); |
||||
}; |
if (resolve) this.resolve = resolve; |
||||
if (test) return Select(value, fn); |
} |
||||
return Select(value); |
|
||||
}, |
for(test, consequent) { |
||||
resolve: resolve ? resolve : () => undefined |
if (test(this.value)) return new Select(this.value, consequent); |
||||
}); |
if (this.resolve) return this; |
||||
|
return this; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
Select.prototype.resolve = () => null; |
||||
|
|
||||
module.exports = Select; |
module.exports = Select; |
||||
|
Loading…
Reference in new issue