mirror of https://github.com/codefeathers/fuse
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
452 B
21 lines
452 B
'use strict';
|
|
|
|
const isIterable = val => typeof val === "object" && Symbol.iterator in val;
|
|
|
|
class Select {
|
|
constructor(value, resolve) {
|
|
this.value = value;
|
|
this.iterable = isIterable(value);
|
|
if (resolve) this.resolve = resolve;
|
|
}
|
|
|
|
for(test, consequent) {
|
|
if (test(this.value)) return new Select(this.value, consequent);
|
|
if (this.resolve) return this;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
Select.prototype.resolve = () => null;
|
|
|
|
module.exports = Select;
|
|
|