Browse Source

[select] Select Class, and change to API

pull/1/head
Muthu Kumar 7 years ago
parent
commit
326b9999cd
  1. 2
      .eslintignore
  2. 29
      Select.js

2
.eslintignore

@ -1 +1 @@
testscript.js testscript*.js

29
Select.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…
Cancel
Save