deku 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/Gemfile +5 -0
- data/LICENSE +25 -0
- data/README.md +28 -0
- data/Rakefile +1 -0
- data/deku.gemspec +23 -0
- data/deps/node_modules/deku.js +2 -0
- data/deps/node_modules/deku/.editorconfig +16 -0
- data/deps/node_modules/deku/.zuul.yml +15 -0
- data/deps/node_modules/deku/History.md +290 -0
- data/deps/node_modules/deku/LICENSE.md +7 -0
- data/deps/node_modules/deku/Makefile +91 -0
- data/deps/node_modules/deku/README.md +293 -0
- data/deps/node_modules/deku/index.js +4072 -0
- data/deps/node_modules/deku/lib/application.js +85 -0
- data/deps/node_modules/deku/lib/index.js +28 -0
- data/deps/node_modules/deku/lib/render.js +1300 -0
- data/deps/node_modules/deku/lib/stringify.js +105 -0
- data/deps/node_modules/deku/lib/svg.js +107 -0
- data/deps/node_modules/deku/lib/utils.js +18 -0
- data/deps/node_modules/deku/lib/virtual.js +247 -0
- data/deps/node_modules/deku/node_modules/array-flatten/LICENSE +21 -0
- data/deps/node_modules/deku/node_modules/array-flatten/README.md +43 -0
- data/deps/node_modules/deku/node_modules/array-flatten/array-flatten.js +57 -0
- data/deps/node_modules/deku/node_modules/array-flatten/package.json +62 -0
- data/deps/node_modules/deku/node_modules/component-emitter/History.md +63 -0
- data/deps/node_modules/deku/node_modules/component-emitter/LICENSE +24 -0
- data/deps/node_modules/deku/node_modules/component-emitter/Readme.md +74 -0
- data/deps/node_modules/deku/node_modules/component-emitter/index.js +161 -0
- data/deps/node_modules/deku/node_modules/component-emitter/package.json +174 -0
- data/deps/node_modules/deku/node_modules/component-raf/.npmignore +2 -0
- data/deps/node_modules/deku/node_modules/component-raf/History.md +26 -0
- data/deps/node_modules/deku/node_modules/component-raf/Makefile +11 -0
- data/deps/node_modules/deku/node_modules/component-raf/Readme.md +46 -0
- data/deps/node_modules/deku/node_modules/component-raf/component.json +16 -0
- data/deps/node_modules/deku/node_modules/component-raf/example.html +43 -0
- data/deps/node_modules/deku/node_modules/component-raf/index.js +34 -0
- data/deps/node_modules/deku/node_modules/component-raf/package.json +164 -0
- data/deps/node_modules/deku/node_modules/component-type/.npmignore +3 -0
- data/deps/node_modules/deku/node_modules/component-type/Makefile +14 -0
- data/deps/node_modules/deku/node_modules/component-type/Readme.md +37 -0
- data/deps/node_modules/deku/node_modules/component-type/component.json +13 -0
- data/deps/node_modules/deku/node_modules/component-type/index.js +34 -0
- data/deps/node_modules/deku/node_modules/component-type/package.json +120 -0
- data/deps/node_modules/deku/node_modules/component-type/test/index.html +17 -0
- data/deps/node_modules/deku/node_modules/component-type/test/mocha.css +231 -0
- data/deps/node_modules/deku/node_modules/component-type/test/mocha.js +5340 -0
- data/deps/node_modules/deku/node_modules/component-type/test/tests.js +72 -0
- data/deps/node_modules/deku/node_modules/dom-pool/.npmignore +1 -0
- data/deps/node_modules/deku/node_modules/dom-pool/Pool.js +52 -0
- data/deps/node_modules/deku/node_modules/dom-pool/README.md +42 -0
- data/deps/node_modules/deku/node_modules/dom-pool/authors.txt +4 -0
- data/deps/node_modules/deku/node_modules/dom-pool/bower.json +26 -0
- data/deps/node_modules/deku/node_modules/dom-pool/package.json +46 -0
- data/deps/node_modules/deku/node_modules/dom-pool/tests.html +16 -0
- data/deps/node_modules/deku/node_modules/dom-pool/tests.js +102 -0
- data/deps/node_modules/deku/node_modules/dom-walk/.npmignore +3 -0
- data/deps/node_modules/deku/node_modules/dom-walk/LICENCE +19 -0
- data/deps/node_modules/deku/node_modules/dom-walk/Makefile +2 -0
- data/deps/node_modules/deku/node_modules/dom-walk/README.md +23 -0
- data/deps/node_modules/deku/node_modules/dom-walk/example/index.js +5 -0
- data/deps/node_modules/deku/node_modules/dom-walk/example/static/bundle.js +211 -0
- data/deps/node_modules/deku/node_modules/dom-walk/example/static/index.html +16 -0
- data/deps/node_modules/deku/node_modules/dom-walk/index.js +24 -0
- data/deps/node_modules/deku/node_modules/dom-walk/package.json +57 -0
- data/deps/node_modules/deku/node_modules/fast.js/.jshintignore +7 -0
- data/deps/node_modules/deku/node_modules/fast.js/.jshintrc +80 -0
- data/deps/node_modules/deku/node_modules/fast.js/.npmignore +6 -0
- data/deps/node_modules/deku/node_modules/fast.js/.travis.yml +3 -0
- data/deps/node_modules/deku/node_modules/fast.js/LICENSE.md +21 -0
- data/deps/node_modules/deku/node_modules/fast.js/README.md +552 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/clone.js +21 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/concat.js +32 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/every.js +25 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/fill.js +29 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/filter.js +26 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/forEach.js +21 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/index.js +15 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/indexOf.js +33 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/lastIndexOf.js +29 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/map.js +24 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/pluck.js +24 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/reduce.js +35 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/reduceRight.js +35 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/some.js +25 -0
- data/deps/node_modules/deku/node_modules/fast.js/bower.json +28 -0
- data/deps/node_modules/deku/node_modules/fast.js/clone.js +27 -0
- data/deps/node_modules/deku/node_modules/fast.js/dist/bench.html +15 -0
- data/deps/node_modules/deku/node_modules/fast.js/dist/bench.js +19900 -0
- data/deps/node_modules/deku/node_modules/fast.js/dist/fast.js +1450 -0
- data/deps/node_modules/deku/node_modules/fast.js/dist/fast.min.js +1 -0
- data/deps/node_modules/deku/node_modules/fast.js/filter.js +23 -0
- data/deps/node_modules/deku/node_modules/fast.js/forEach.js +22 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/apply.js +19 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/applyNoContext.js +29 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/applyWithContext.js +29 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/bind.js +71 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/bindInternal3.js +11 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/bindInternal4.js +11 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/index.js +7 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/partial.js +42 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/partialConstructor.js +45 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/try.js +35 -0
- data/deps/node_modules/deku/node_modules/fast.js/index.js +241 -0
- data/deps/node_modules/deku/node_modules/fast.js/map.js +23 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/assign.js +34 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/clone.js +25 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/filter.js +28 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/forEach.js +23 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/index.js +11 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/keys.js +17 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/map.js +26 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/reduce.js +37 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/reduceRight.js +37 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/values.js +20 -0
- data/deps/node_modules/deku/node_modules/fast.js/package.json +73 -0
- data/deps/node_modules/deku/node_modules/fast.js/reduce.js +24 -0
- data/deps/node_modules/deku/node_modules/fast.js/reduceRight.js +24 -0
- data/deps/node_modules/deku/node_modules/fast.js/string/index.js +3 -0
- data/deps/node_modules/deku/node_modules/fast.js/string/intern.js +56 -0
- data/deps/node_modules/deku/node_modules/get-uid/README.md +44 -0
- data/deps/node_modules/deku/node_modules/get-uid/index.js +6 -0
- data/deps/node_modules/deku/node_modules/get-uid/package.json +56 -0
- data/deps/node_modules/deku/node_modules/is-dom/HISTORY.md +2 -0
- data/deps/node_modules/deku/node_modules/is-dom/LICENSE +21 -0
- data/deps/node_modules/deku/node_modules/is-dom/README.md +32 -0
- data/deps/node_modules/deku/node_modules/is-dom/index.js +15 -0
- data/deps/node_modules/deku/node_modules/is-dom/package.json +62 -0
- data/deps/node_modules/deku/node_modules/object-path/.npmignore +7 -0
- data/deps/node_modules/deku/node_modules/object-path/.travis.yml +6 -0
- data/deps/node_modules/deku/node_modules/object-path/LICENSE +21 -0
- data/deps/node_modules/deku/node_modules/object-path/README.md +96 -0
- data/deps/node_modules/deku/node_modules/object-path/bower.json +17 -0
- data/deps/node_modules/deku/node_modules/object-path/component.json +22 -0
- data/deps/node_modules/deku/node_modules/object-path/index.js +269 -0
- data/deps/node_modules/deku/node_modules/object-path/package.json +89 -0
- data/deps/node_modules/deku/node_modules/object-path/test.js +510 -0
- data/deps/node_modules/deku/node_modules/per-frame/.npmignore +68 -0
- data/deps/node_modules/deku/node_modules/per-frame/History.md +32 -0
- data/deps/node_modules/deku/node_modules/per-frame/README.md +44 -0
- data/deps/node_modules/deku/node_modules/per-frame/component.json +13 -0
- data/deps/node_modules/deku/node_modules/per-frame/index.js +37 -0
- data/deps/node_modules/deku/node_modules/per-frame/package.json +143 -0
- data/deps/node_modules/deku/node_modules/per-frame/test/test.js +94 -0
- data/deps/node_modules/deku/node_modules/sliced/.npmignore +2 -0
- data/deps/node_modules/deku/node_modules/sliced/.travis.yml +4 -0
- data/deps/node_modules/deku/node_modules/sliced/History.md +30 -0
- data/deps/node_modules/deku/node_modules/sliced/LICENSE +22 -0
- data/deps/node_modules/deku/node_modules/sliced/Makefile +5 -0
- data/deps/node_modules/deku/node_modules/sliced/README.md +62 -0
- data/deps/node_modules/deku/node_modules/sliced/bench.js +95 -0
- data/deps/node_modules/deku/node_modules/sliced/component.json +14 -0
- data/deps/node_modules/deku/node_modules/sliced/index.js +1 -0
- data/deps/node_modules/deku/node_modules/sliced/lib/sliced.js +33 -0
- data/deps/node_modules/deku/node_modules/sliced/package.json +52 -0
- data/deps/node_modules/deku/node_modules/sliced/test/index.js +80 -0
- data/deps/node_modules/deku/package.json +67 -0
- data/lib/deku.rb +11 -0
- data/lib/deku/application.rb +16 -0
- data/lib/deku/component.rb +36 -0
- data/lib/deku/context.rb +38 -0
- data/lib/deku/element_node.rb +17 -0
- data/lib/deku/version.rb +4 -0
- metadata +278 -0
@@ -0,0 +1 @@
|
|
1
|
+
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r;"undefined"!=typeof window?r=window:"undefined"!=typeof global?r=global:"undefined"!=typeof self&&(r=self),r.fast=t()}}(function(){return function t(r,n,e){function o(i,c){if(!n[i]){if(!r[i]){var a="function"==typeof require&&require;if(!c&&a)return a(i,!0);if(u)return u(i,!0);throw new Error("Cannot find module '"+i+"'")}var f=n[i]={exports:{}};r[i][0].call(f.exports,function(t){var n=r[i][1][t];return o(n?n:t)},f,f.exports,t,r,n,e)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<e.length;i++)o(e[i]);return o}({1:[function(t,r){"use strict";r.exports=function(t){var r,n=t.length,e=new Array(n);for(r=0;n>r;r++)e[r]=t[r];return e}},{}],2:[function(t,r){"use strict";r.exports=function(){var t,r,n,e,o=arguments.length,u=[];for(t=0;o>t;t++)if(r=arguments[t],Array.isArray(r))for(n=r.length,e=0;n>e;e++)u.push(r[e]);else u.push(r);return u}},{}],3:[function(t,r){"use strict";var n=t("../function/bindInternal3");r.exports=function(t,r,e){var o,u=t.length,i=void 0!==e?n(r,e):r;for(o=0;u>o;o++)if(!i(t[o],o,t))return!1;return!0}},{"../function/bindInternal3":22}],4:[function(t,r){"use strict";r.exports=function(t,r,n,e){var o,u=t.length;for(void 0===n&&(n=0),void 0===e&&(e=u),o=n;e>o;o++)t[o]=r;return t}},{}],5:[function(t,r){"use strict";var n=t("../function/bindInternal3");r.exports=function(t,r,e){var o,u=t.length,i=[],c=void 0!==e?n(r,e):r;for(o=0;u>o;o++)c(t[o],o,t)&&i.push(t[o]);return i}},{"../function/bindInternal3":22}],6:[function(t,r){"use strict";var n=t("../function/bindInternal3");r.exports=function(t,r,e){var o,u=t.length,i=void 0!==e?n(r,e):r;for(o=0;u>o;o++)i(t[o],o,t)}},{"../function/bindInternal3":22}],7:[function(t,r,n){"use strict";n.clone=t("./clone"),n.concat=t("./concat"),n.every=t("./every"),n.filter=t("./filter"),n.forEach=t("./forEach"),n.indexOf=t("./indexOf"),n.lastIndexOf=t("./lastIndexOf"),n.map=t("./map"),n.pluck=t("./pluck"),n.reduce=t("./reduce"),n.reduceRight=t("./reduceRight"),n.some=t("./some"),n.fill=t("./fill")},{"./clone":1,"./concat":2,"./every":3,"./fill":4,"./filter":5,"./forEach":6,"./indexOf":8,"./lastIndexOf":9,"./map":10,"./pluck":11,"./reduce":12,"./reduceRight":13,"./some":14}],8:[function(t,r){"use strict";r.exports=function(t,r,n){var e=t.length,o=0;for("number"==typeof n&&(o=n,0>o&&(o+=e,0>o&&(o=0)));e>o;o++)if(t[o]===r)return o;return-1}},{}],9:[function(t,r){"use strict";r.exports=function(t,r,n){var e=t.length,o=e-1;for("number"==typeof n&&(o=n,0>o&&(o+=e));o>=0;o--)if(t[o]===r)return o;return-1}},{}],10:[function(t,r){"use strict";var n=t("../function/bindInternal3");r.exports=function(t,r,e){var o,u=t.length,i=new Array(u),c=void 0!==e?n(r,e):r;for(o=0;u>o;o++)i[o]=c(t[o],o,t);return i}},{"../function/bindInternal3":22}],11:[function(t,r){"use strict";r.exports=function(t,r){var n,e,o=t.length,u=[],i=0;for(e=0;o>e;e++)n=t[e],null!=n&&void 0!==n[r]&&(u[i++]=n[r]);return u}},{}],12:[function(t,r){"use strict";var n=t("../function/bindInternal4");r.exports=function(t,r,e,o){var u,i,c=t.length,a=void 0!==o?n(r,o):r;for(void 0===e?(u=1,i=t[0]):(u=0,i=e);c>u;u++)i=a(i,t[u],u,t);return i}},{"../function/bindInternal4":23}],13:[function(t,r){"use strict";var n=t("../function/bindInternal4");r.exports=function(t,r,e,o){var u,i,c=t.length,a=void 0!==o?n(r,o):r;for(void 0===e?(u=c-2,i=t[c-1]):(u=c-1,i=e);u>=0;u--)i=a(i,t[u],u,t);return i}},{"../function/bindInternal4":23}],14:[function(t,r){"use strict";var n=t("../function/bindInternal3");r.exports=function(t,r,e){var o,u=t.length,i=void 0!==e?n(r,e):r;for(o=0;u>o;o++)if(i(t[o],o,t))return!0;return!1}},{"../function/bindInternal3":22}],15:[function(t,r){"use strict";var n=t("./array/clone"),e=t("./object/clone");r.exports=function(t){return t&&"object"==typeof t?Array.isArray(t)?n(t):e(t):t}},{"./array/clone":1,"./object/clone":31}],16:[function(t,r){"use strict";var n=t("./array/filter"),e=t("./object/filter");r.exports=function(t,r,o){return t instanceof Array?n(t,r,o):e(t,r,o)}},{"./array/filter":5,"./object/filter":32}],17:[function(t,r){"use strict";var n=t("./array/forEach"),e=t("./object/forEach");r.exports=function(t,r,o){return t instanceof Array?n(t,r,o):e(t,r,o)}},{"./array/forEach":6,"./object/forEach":33}],18:[function(t,r){"use strict";var n=t("./applyWithContext"),e=t("./applyNoContext");r.exports=function(t,r,o){return void 0!==r?n(t,r,o):e(t,o)}},{"./applyNoContext":19,"./applyWithContext":20}],19:[function(t,r){"use strict";r.exports=function(t,r){switch(r.length){case 0:return t();case 1:return t(r[0]);case 2:return t(r[0],r[1]);case 3:return t(r[0],r[1],r[2]);case 4:return t(r[0],r[1],r[2],r[3]);case 5:return t(r[0],r[1],r[2],r[3],r[4]);case 6:return t(r[0],r[1],r[2],r[3],r[4],r[5]);case 7:return t(r[0],r[1],r[2],r[3],r[4],r[5],r[6]);case 8:return t(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7]);default:return t.apply(void 0,r)}}},{}],20:[function(t,r){"use strict";r.exports=function(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2]);case 4:return t.call(r,n[0],n[1],n[2],n[3]);case 5:return t.call(r,n[0],n[1],n[2],n[3],n[4]);case 6:return t.call(r,n[0],n[1],n[2],n[3],n[4],n[5]);case 7:return t.call(r,n[0],n[1],n[2],n[3],n[4],n[5],n[6]);case 8:return t.call(r,n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]);default:return t.apply(r,n)}}},{}],21:[function(t,r){"use strict";var n=t("./applyWithContext"),e=t("./applyNoContext");r.exports=function(t,r){var o,u=arguments.length-2;if(u>0){o=new Array(u);for(var i=0;u>i;i++)o[i]=arguments[i+2];return void 0!==r?function(){var e,i=arguments.length,c=new Array(u+i);for(e=0;u>e;e++)c[e]=o[e];for(e=0;i>e;e++)c[u+e]=arguments[e];return n(t,r,c)}:function(){var r,n=arguments.length,i=new Array(u+n);for(r=0;u>r;r++)i[r]=o[r];for(r=0;n>r;r++)i[u+r]=arguments[r];return e(t,i)}}return void 0!==r?function(){return n(t,r,arguments)}:function(){return e(t,arguments)}}},{"./applyNoContext":19,"./applyWithContext":20}],22:[function(t,r){"use strict";r.exports=function(t,r){return function(n,e,o){return t.call(r,n,e,o)}}},{}],23:[function(t,r){"use strict";r.exports=function(t,r){return function(n,e,o,u){return t.call(r,n,e,o,u)}}},{}],24:[function(t,r,n){"use strict";n.apply=t("./apply"),n.bind=t("./bind"),n.partial=t("./partial"),n.partialConstructor=t("./partialConstructor"),n.try=t("./try")},{"./apply":18,"./bind":21,"./partial":25,"./partialConstructor":26,"./try":27}],25:[function(t,r){"use strict";var n=t("./applyWithContext");r.exports=function(t){var r,e=arguments.length-1;r=new Array(e);for(var o=0;e>o;o++)r[o]=arguments[o+1];return function(){var o,u=arguments.length,i=new Array(e+u);for(o=0;e>o;o++)i[o]=r[o];for(o=0;u>o;o++)i[e+o]=arguments[o];return n(t,this,i)}}},{"./applyWithContext":20}],26:[function(t,r){"use strict";var n=t("./applyWithContext");r.exports=function(t){var r,e=arguments.length-1;r=new Array(e);for(var o=0;e>o;o++)r[o]=arguments[o+1];return function(){var o,u=arguments.length,i=new Array(e+u);for(o=0;e>o;o++)i[o]=r[o];for(o=0;u>o;o++)i[e+o]=arguments[o];var c=Object.create(t.prototype),a=n(t,c,i);return null==a||"object"!=typeof a&&"function"!=typeof a?c:a}}},{"./applyWithContext":20}],27:[function(t,r){"use strict";r.exports=function(t){try{return t()}catch(r){return r instanceof Error?r:new Error(r)}}},{}],28:[function(t,r,n){"use strict";function e(t){return this instanceof e?void(this.value=t||[]):new e(t)}r.exports=n=e,e.array=t("./array"),e["function"]=e.fn=t("./function"),e.object=t("./object"),e.string=t("./string"),e.apply=e["function"].apply,e.bind=e["function"].bind,e.partial=e["function"].partial,e.partialConstructor=e["function"].partialConstructor,e["try"]=e.attempt=e["function"]["try"],e.assign=e.object.assign,e.cloneObject=e.object.clone,e.keys=e.object.keys,e.values=e.object.values,e.clone=t("./clone"),e.map=t("./map"),e.filter=t("./filter"),e.forEach=t("./forEach"),e.reduce=t("./reduce"),e.reduceRight=t("./reduceRight"),e.cloneArray=e.array.clone,e.concat=e.array.concat,e.some=e.array.some,e.every=e.array.every,e.indexOf=e.array.indexOf,e.lastIndexOf=e.array.lastIndexOf,e.pluck=e.array.pluck,e.fill=e.array.fill,e.intern=e.string.intern,e.prototype.concat=function(){var t,r,n,o,u=this.value.length,i=new Array(u);for(t=0;u>t;t++)i[t]=this.value[t];for(u=arguments.length,t=0;u>t;t++)if(r=arguments[t],Array.isArray(r))for(n=r.length,o=0;n>o;o++)i.push(r[o]);else i.push(r);return new e(i)},e.prototype.map=function(t,r){return new e(e.map(this.value,t,r))},e.prototype.filter=function(t,r){return new e(e.filter(this.value,t,r))},e.prototype.reduce=function(t,r,n){return e.reduce(this.value,t,r,n)},e.prototype.reduceRight=function(t,r,n){return e.reduceRight(this.value,t,r,n)},e.prototype.forEach=function(t,r){return e.forEach(this.value,t,r),this},e.prototype.some=function(t,r){return e.some(this.value,t,r)},e.prototype.every=function(t,r){return e.some(this.value,t,r)},e.prototype.indexOf=function(t,r){return e.indexOf(this.value,t,r)},e.prototype.lastIndexOf=function(t,r){return e.lastIndexOf(this.value,t,r)},e.prototype.reverse=function(){return new e(this.value.reverse())},e.prototype.valueOf=function(){return this.value},e.prototype.toJSON=function(){return this.value},Object.defineProperty(e.prototype,"length",{get:function(){return this.value.length}})},{"./array":7,"./clone":15,"./filter":16,"./forEach":17,"./function":24,"./map":29,"./object":34,"./reduce":40,"./reduceRight":41,"./string":42}],29:[function(t,r){"use strict";var n=t("./array/map"),e=t("./object/map");r.exports=function(t,r,o){return t instanceof Array?n(t,r,o):e(t,r,o)}},{"./array/map":10,"./object/map":36}],30:[function(t,r){"use strict";r.exports=function(t){var r,n,e,o,u,i,c=arguments.length;for(n=1;c>n;n++)for(r=arguments[n],o=Object.keys(r),e=o.length,i=0;e>i;i++)u=o[i],t[u]=r[u];return t}},{}],31:[function(t,r){"use strict";r.exports=function(t){var r,n,e=Object.keys(t),o=e.length,u={};for(r=0;o>r;r++)n=e[r],u[n]=t[n];return u}},{}],32:[function(t,r){"use strict";var n=t("../function/bindInternal3");r.exports=function(t,r,e){var o,u,i=Object.keys(t),c=i.length,a={},f=void 0!==e?n(r,e):r;for(o=0;c>o;o++)u=i[o],f(t[u],u,t)&&(a[u]=t[u]);return a}},{"../function/bindInternal3":22}],33:[function(t,r){"use strict";var n=t("../function/bindInternal3");r.exports=function(t,r,e){var o,u,i=Object.keys(t),c=i.length,a=void 0!==e?n(r,e):r;for(u=0;c>u;u++)o=i[u],a(t[o],o,t)}},{"../function/bindInternal3":22}],34:[function(t,r,n){"use strict";n.assign=t("./assign"),n.clone=t("./clone"),n.filter=t("./filter"),n.forEach=t("./forEach"),n.map=t("./map"),n.reduce=t("./reduce"),n.reduceRight=t("./reduceRight"),n.keys=t("./keys"),n.values=t("./values")},{"./assign":30,"./clone":31,"./filter":32,"./forEach":33,"./keys":35,"./map":36,"./reduce":37,"./reduceRight":38,"./values":39}],35:[function(t,r){"use strict";r.exports="function"==typeof Object.keys?Object.keys:function(t){var r=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.push(n);return r}},{}],36:[function(t,r){"use strict";var n=t("../function/bindInternal3");r.exports=function(t,r,e){var o,u,i=Object.keys(t),c=i.length,a={},f=void 0!==e?n(r,e):r;for(o=0;c>o;o++)u=i[o],a[u]=f(t[u],u,t);return a}},{"../function/bindInternal3":22}],37:[function(t,r){"use strict";var n=t("../function/bindInternal4");r.exports=function(t,r,e,o){var u,i,c,a=Object.keys(t),f=a.length,s=void 0!==o?n(r,o):r;for(void 0===e?(u=1,c=t[a[0]]):(u=0,c=e);f>u;u++)i=a[u],c=s(c,t[i],i,t);return c}},{"../function/bindInternal4":23}],38:[function(t,r){"use strict";var n=t("../function/bindInternal4");r.exports=function(t,r,e,o){var u,i,c,a=Object.keys(t),f=a.length,s=void 0!==o?n(r,o):r;for(void 0===e?(u=f-2,c=t[a[f-1]]):(u=f-1,c=e);u>=0;u--)i=a[u],c=s(c,t[i],i,t);return c}},{"../function/bindInternal4":23}],39:[function(t,r){"use strict";r.exports=function(t){for(var r=Object.keys(t),n=r.length,e=new Array(n),o=0;n>o;o++)e[o]=t[r[o]];return e}},{}],40:[function(t,r){"use strict";var n=t("./array/reduce"),e=t("./object/reduce");r.exports=function(t,r,o,u){return t instanceof Array?n(t,r,o,u):e(t,r,o,u)}},{"./array/reduce":12,"./object/reduce":37}],41:[function(t,r){"use strict";var n=t("./array/reduceRight"),e=t("./object/reduceRight");r.exports=function(t,r,o,u){return t instanceof Array?n(t,r,o,u):e(t,r,o,u)}},{"./array/reduceRight":13,"./object/reduceRight":38}],42:[function(t,r,n){"use strict";n.intern=t("./intern")},{"./intern":43}],43:[function(t,r){"use strict";var n={"- ":!0};delete n["- "],r.exports=function(t){n[t]=!0;var r=Object.keys(n)[0];return delete n[r],r}},{}]},{},[28])(28)});
|
@@ -0,0 +1,23 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var filterArray = require('./array/filter'),
|
4
|
+
filterObject = require('./object/filter');
|
5
|
+
|
6
|
+
/**
|
7
|
+
* # Filter
|
8
|
+
*
|
9
|
+
* A fast `.filter()` implementation.
|
10
|
+
*
|
11
|
+
* @param {Array|Object} subject The array or object to filter.
|
12
|
+
* @param {Function} fn The filter function.
|
13
|
+
* @param {Object} thisContext The context for the filter.
|
14
|
+
* @return {Array|Object} The array or object containing the filtered results.
|
15
|
+
*/
|
16
|
+
module.exports = function fastFilter (subject, fn, thisContext) {
|
17
|
+
if (subject instanceof Array) {
|
18
|
+
return filterArray(subject, fn, thisContext);
|
19
|
+
}
|
20
|
+
else {
|
21
|
+
return filterObject(subject, fn, thisContext);
|
22
|
+
}
|
23
|
+
};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var forEachArray = require('./array/forEach'),
|
4
|
+
forEachObject = require('./object/forEach');
|
5
|
+
|
6
|
+
/**
|
7
|
+
* # ForEach
|
8
|
+
*
|
9
|
+
* A fast `.forEach()` implementation.
|
10
|
+
*
|
11
|
+
* @param {Array|Object} subject The array or object to iterate over.
|
12
|
+
* @param {Function} fn The visitor function.
|
13
|
+
* @param {Object} thisContext The context for the visitor.
|
14
|
+
*/
|
15
|
+
module.exports = function fastForEach (subject, fn, thisContext) {
|
16
|
+
if (subject instanceof Array) {
|
17
|
+
return forEachArray(subject, fn, thisContext);
|
18
|
+
}
|
19
|
+
else {
|
20
|
+
return forEachObject(subject, fn, thisContext);
|
21
|
+
}
|
22
|
+
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var applyWithContext = require('./applyWithContext');
|
4
|
+
var applyNoContext = require('./applyNoContext');
|
5
|
+
|
6
|
+
/**
|
7
|
+
* # Apply
|
8
|
+
*
|
9
|
+
* Faster version of `Function::apply()`, optimised for 8 arguments or fewer.
|
10
|
+
*
|
11
|
+
*
|
12
|
+
* @param {Function} subject The function to apply.
|
13
|
+
* @param {Object} thisContext The context for the function, set to undefined or null if no context is required.
|
14
|
+
* @param {Array} args The arguments for the function.
|
15
|
+
* @return {mixed} The result of the function invocation.
|
16
|
+
*/
|
17
|
+
module.exports = function fastApply (subject, thisContext, args) {
|
18
|
+
return thisContext !== undefined ? applyWithContext(subject, thisContext, args) : applyNoContext(subject, args);
|
19
|
+
};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Internal helper for applying a function without a context.
|
5
|
+
*/
|
6
|
+
module.exports = function applyNoContext (subject, args) {
|
7
|
+
switch (args.length) {
|
8
|
+
case 0:
|
9
|
+
return subject();
|
10
|
+
case 1:
|
11
|
+
return subject(args[0]);
|
12
|
+
case 2:
|
13
|
+
return subject(args[0], args[1]);
|
14
|
+
case 3:
|
15
|
+
return subject(args[0], args[1], args[2]);
|
16
|
+
case 4:
|
17
|
+
return subject(args[0], args[1], args[2], args[3]);
|
18
|
+
case 5:
|
19
|
+
return subject(args[0], args[1], args[2], args[3], args[4]);
|
20
|
+
case 6:
|
21
|
+
return subject(args[0], args[1], args[2], args[3], args[4], args[5]);
|
22
|
+
case 7:
|
23
|
+
return subject(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
|
24
|
+
case 8:
|
25
|
+
return subject(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
26
|
+
default:
|
27
|
+
return subject.apply(undefined, args);
|
28
|
+
}
|
29
|
+
};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Internal helper for applying a function with a context.
|
5
|
+
*/
|
6
|
+
module.exports = function applyWithContext (subject, thisContext, args) {
|
7
|
+
switch (args.length) {
|
8
|
+
case 0:
|
9
|
+
return subject.call(thisContext);
|
10
|
+
case 1:
|
11
|
+
return subject.call(thisContext, args[0]);
|
12
|
+
case 2:
|
13
|
+
return subject.call(thisContext, args[0], args[1]);
|
14
|
+
case 3:
|
15
|
+
return subject.call(thisContext, args[0], args[1], args[2]);
|
16
|
+
case 4:
|
17
|
+
return subject.call(thisContext, args[0], args[1], args[2], args[3]);
|
18
|
+
case 5:
|
19
|
+
return subject.call(thisContext, args[0], args[1], args[2], args[3], args[4]);
|
20
|
+
case 6:
|
21
|
+
return subject.call(thisContext, args[0], args[1], args[2], args[3], args[4], args[5]);
|
22
|
+
case 7:
|
23
|
+
return subject.call(thisContext, args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
|
24
|
+
case 8:
|
25
|
+
return subject.call(thisContext, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
26
|
+
default:
|
27
|
+
return subject.apply(thisContext, args);
|
28
|
+
}
|
29
|
+
};
|
@@ -0,0 +1,71 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var applyWithContext = require('./applyWithContext');
|
4
|
+
var applyNoContext = require('./applyNoContext');
|
5
|
+
|
6
|
+
/**
|
7
|
+
* # Bind
|
8
|
+
* Analogue of `Function::bind()`.
|
9
|
+
*
|
10
|
+
* ```js
|
11
|
+
* var bind = require('fast.js').bind;
|
12
|
+
* var bound = bind(myfunc, this, 1, 2, 3);
|
13
|
+
*
|
14
|
+
* bound(4);
|
15
|
+
* ```
|
16
|
+
*
|
17
|
+
*
|
18
|
+
* @param {Function} fn The function which should be bound.
|
19
|
+
* @param {Object} thisContext The context to bind the function to.
|
20
|
+
* @param {mixed} args, ... Additional arguments to pre-bind.
|
21
|
+
* @return {Function} The bound function.
|
22
|
+
*/
|
23
|
+
module.exports = function fastBind (fn, thisContext) {
|
24
|
+
var boundLength = arguments.length - 2,
|
25
|
+
boundArgs;
|
26
|
+
|
27
|
+
if (boundLength > 0) {
|
28
|
+
boundArgs = new Array(boundLength);
|
29
|
+
for (var i = 0; i < boundLength; i++) {
|
30
|
+
boundArgs[i] = arguments[i + 2];
|
31
|
+
}
|
32
|
+
if (thisContext !== undefined) {
|
33
|
+
return function () {
|
34
|
+
var length = arguments.length,
|
35
|
+
args = new Array(boundLength + length),
|
36
|
+
i;
|
37
|
+
for (i = 0; i < boundLength; i++) {
|
38
|
+
args[i] = boundArgs[i];
|
39
|
+
}
|
40
|
+
for (i = 0; i < length; i++) {
|
41
|
+
args[boundLength + i] = arguments[i];
|
42
|
+
}
|
43
|
+
return applyWithContext(fn, thisContext, args);
|
44
|
+
};
|
45
|
+
}
|
46
|
+
else {
|
47
|
+
return function () {
|
48
|
+
var length = arguments.length,
|
49
|
+
args = new Array(boundLength + length),
|
50
|
+
i;
|
51
|
+
for (i = 0; i < boundLength; i++) {
|
52
|
+
args[i] = boundArgs[i];
|
53
|
+
}
|
54
|
+
for (i = 0; i < length; i++) {
|
55
|
+
args[boundLength + i] = arguments[i];
|
56
|
+
}
|
57
|
+
return applyNoContext(fn, args);
|
58
|
+
};
|
59
|
+
}
|
60
|
+
}
|
61
|
+
if (thisContext !== undefined) {
|
62
|
+
return function () {
|
63
|
+
return applyWithContext(fn, thisContext, arguments);
|
64
|
+
};
|
65
|
+
}
|
66
|
+
else {
|
67
|
+
return function () {
|
68
|
+
return applyNoContext(fn, arguments);
|
69
|
+
};
|
70
|
+
}
|
71
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Internal helper to bind a function known to have 3 arguments
|
5
|
+
* to a given context.
|
6
|
+
*/
|
7
|
+
module.exports = function bindInternal3 (func, thisContext) {
|
8
|
+
return function (a, b, c) {
|
9
|
+
return func.call(thisContext, a, b, c);
|
10
|
+
};
|
11
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Internal helper to bind a function known to have 4 arguments
|
5
|
+
* to a given context.
|
6
|
+
*/
|
7
|
+
module.exports = function bindInternal4 (func, thisContext) {
|
8
|
+
return function (a, b, c, d) {
|
9
|
+
return func.call(thisContext, a, b, c, d);
|
10
|
+
};
|
11
|
+
};
|
@@ -0,0 +1,42 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var applyWithContext = require('./applyWithContext');
|
4
|
+
|
5
|
+
/**
|
6
|
+
* # Partial Application
|
7
|
+
*
|
8
|
+
* Partially apply a function. This is similar to `.bind()`,
|
9
|
+
* but with one important difference - the returned function is not bound
|
10
|
+
* to a particular context. This makes it easy to add partially
|
11
|
+
* applied methods to objects. If you need to bind to a context,
|
12
|
+
* use `.bind()` instead.
|
13
|
+
*
|
14
|
+
* > Note: This function does not support partial application for
|
15
|
+
* constructors, for that see `partialConstructor()`
|
16
|
+
*
|
17
|
+
*
|
18
|
+
* @param {Function} fn The function to partially apply.
|
19
|
+
* @param {mixed} args, ... Arguments to pre-bind.
|
20
|
+
* @return {Function} The partially applied function.
|
21
|
+
*/
|
22
|
+
module.exports = function fastPartial (fn) {
|
23
|
+
var boundLength = arguments.length - 1,
|
24
|
+
boundArgs;
|
25
|
+
|
26
|
+
boundArgs = new Array(boundLength);
|
27
|
+
for (var i = 0; i < boundLength; i++) {
|
28
|
+
boundArgs[i] = arguments[i + 1];
|
29
|
+
}
|
30
|
+
return function () {
|
31
|
+
var length = arguments.length,
|
32
|
+
args = new Array(boundLength + length),
|
33
|
+
i;
|
34
|
+
for (i = 0; i < boundLength; i++) {
|
35
|
+
args[i] = boundArgs[i];
|
36
|
+
}
|
37
|
+
for (i = 0; i < length; i++) {
|
38
|
+
args[boundLength + i] = arguments[i];
|
39
|
+
}
|
40
|
+
return applyWithContext(fn, this, args);
|
41
|
+
};
|
42
|
+
};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var applyWithContext = require('./applyWithContext');
|
4
|
+
|
5
|
+
/**
|
6
|
+
* # Partial Constructor
|
7
|
+
*
|
8
|
+
* Partially apply a constructor function. The returned function
|
9
|
+
* will work with or without the `new` keyword.
|
10
|
+
*
|
11
|
+
*
|
12
|
+
* @param {Function} fn The constructor function to partially apply.
|
13
|
+
* @param {mixed} args, ... Arguments to pre-bind.
|
14
|
+
* @return {Function} The partially applied constructor.
|
15
|
+
*/
|
16
|
+
module.exports = function fastPartialConstructor (fn) {
|
17
|
+
var boundLength = arguments.length - 1,
|
18
|
+
boundArgs;
|
19
|
+
|
20
|
+
boundArgs = new Array(boundLength);
|
21
|
+
for (var i = 0; i < boundLength; i++) {
|
22
|
+
boundArgs[i] = arguments[i + 1];
|
23
|
+
}
|
24
|
+
return function partialed () {
|
25
|
+
var length = arguments.length,
|
26
|
+
args = new Array(boundLength + length),
|
27
|
+
i;
|
28
|
+
for (i = 0; i < boundLength; i++) {
|
29
|
+
args[i] = boundArgs[i];
|
30
|
+
}
|
31
|
+
for (i = 0; i < length; i++) {
|
32
|
+
args[boundLength + i] = arguments[i];
|
33
|
+
}
|
34
|
+
|
35
|
+
var thisContext = Object.create(fn.prototype),
|
36
|
+
result = applyWithContext(fn, thisContext, args);
|
37
|
+
|
38
|
+
if (result != null && (typeof result === 'object' || typeof result === 'function')) {
|
39
|
+
return result;
|
40
|
+
}
|
41
|
+
else {
|
42
|
+
return thisContext;
|
43
|
+
}
|
44
|
+
};
|
45
|
+
};
|
@@ -0,0 +1,35 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* # Try
|
5
|
+
*
|
6
|
+
* Allows functions to be optimised by isolating `try {} catch (e) {}` blocks
|
7
|
+
* outside the function declaration. Returns either the result of the function or an Error
|
8
|
+
* object if one was thrown. The caller should then check for `result instanceof Error`.
|
9
|
+
*
|
10
|
+
* ```js
|
11
|
+
* var result = fast.try(myFunction);
|
12
|
+
* if (result instanceof Error) {
|
13
|
+
* console.log('something went wrong');
|
14
|
+
* }
|
15
|
+
* else {
|
16
|
+
* console.log('result:', result);
|
17
|
+
* }
|
18
|
+
* ```
|
19
|
+
*
|
20
|
+
* @param {Function} fn The function to invoke.
|
21
|
+
* @return {mixed} The result of the function, or an `Error` object.
|
22
|
+
*/
|
23
|
+
module.exports = function fastTry (fn) {
|
24
|
+
try {
|
25
|
+
return fn();
|
26
|
+
}
|
27
|
+
catch (e) {
|
28
|
+
if (!(e instanceof Error)) {
|
29
|
+
return new Error(e);
|
30
|
+
}
|
31
|
+
else {
|
32
|
+
return e;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
};
|
@@ -0,0 +1,241 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* # Constructor
|
5
|
+
*
|
6
|
+
* Provided as a convenient wrapper around Fast functions.
|
7
|
+
*
|
8
|
+
* ```js
|
9
|
+
* var arr = fast([1,2,3,4,5,6]);
|
10
|
+
*
|
11
|
+
* var result = arr.filter(function (item) {
|
12
|
+
* return item % 2 === 0;
|
13
|
+
* });
|
14
|
+
*
|
15
|
+
* result instanceof Fast; // true
|
16
|
+
* result.length; // 3
|
17
|
+
* ```
|
18
|
+
*
|
19
|
+
*
|
20
|
+
* @param {Array} value The value to wrap.
|
21
|
+
*/
|
22
|
+
function Fast (value) {
|
23
|
+
if (!(this instanceof Fast)) {
|
24
|
+
return new Fast(value);
|
25
|
+
}
|
26
|
+
this.value = value || [];
|
27
|
+
}
|
28
|
+
|
29
|
+
module.exports = exports = Fast;
|
30
|
+
|
31
|
+
Fast.array = require('./array');
|
32
|
+
Fast['function'] = Fast.fn = require('./function');
|
33
|
+
Fast.object = require('./object');
|
34
|
+
Fast.string = require('./string');
|
35
|
+
|
36
|
+
|
37
|
+
Fast.apply = Fast['function'].apply;
|
38
|
+
Fast.bind = Fast['function'].bind;
|
39
|
+
Fast.partial = Fast['function'].partial;
|
40
|
+
Fast.partialConstructor = Fast['function'].partialConstructor;
|
41
|
+
Fast['try'] = Fast.attempt = Fast['function']['try'];
|
42
|
+
|
43
|
+
Fast.assign = Fast.object.assign;
|
44
|
+
Fast.cloneObject = Fast.object.clone; // @deprecated use fast.object.clone()
|
45
|
+
Fast.keys = Fast.object.keys;
|
46
|
+
Fast.values = Fast.object.values;
|
47
|
+
|
48
|
+
|
49
|
+
Fast.clone = require('./clone');
|
50
|
+
Fast.map = require('./map');
|
51
|
+
Fast.filter = require('./filter');
|
52
|
+
Fast.forEach = require('./forEach');
|
53
|
+
Fast.reduce = require('./reduce');
|
54
|
+
Fast.reduceRight = require('./reduceRight');
|
55
|
+
|
56
|
+
|
57
|
+
Fast.cloneArray = Fast.array.clone; // @deprecated use fast.array.clone()
|
58
|
+
|
59
|
+
Fast.concat = Fast.array.concat;
|
60
|
+
Fast.some = Fast.array.some;
|
61
|
+
Fast.every = Fast.array.every;
|
62
|
+
Fast.indexOf = Fast.array.indexOf;
|
63
|
+
Fast.lastIndexOf = Fast.array.lastIndexOf;
|
64
|
+
Fast.pluck = Fast.array.pluck;
|
65
|
+
Fast.fill = Fast.array.fill;
|
66
|
+
|
67
|
+
Fast.intern = Fast.string.intern;
|
68
|
+
|
69
|
+
|
70
|
+
/**
|
71
|
+
* # Concat
|
72
|
+
*
|
73
|
+
* Concatenate multiple arrays.
|
74
|
+
*
|
75
|
+
* @param {Array|mixed} item, ... The item(s) to concatenate.
|
76
|
+
* @return {Fast} A new Fast object, containing the results.
|
77
|
+
*/
|
78
|
+
Fast.prototype.concat = function Fast$concat () {
|
79
|
+
var length = this.value.length,
|
80
|
+
arr = new Array(length),
|
81
|
+
i, item, childLength, j;
|
82
|
+
|
83
|
+
for (i = 0; i < length; i++) {
|
84
|
+
arr[i] = this.value[i];
|
85
|
+
}
|
86
|
+
|
87
|
+
length = arguments.length;
|
88
|
+
for (i = 0; i < length; i++) {
|
89
|
+
item = arguments[i];
|
90
|
+
if (Array.isArray(item)) {
|
91
|
+
childLength = item.length;
|
92
|
+
for (j = 0; j < childLength; j++) {
|
93
|
+
arr.push(item[j]);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
else {
|
97
|
+
arr.push(item);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
return new Fast(arr);
|
101
|
+
};
|
102
|
+
|
103
|
+
/**
|
104
|
+
* Fast Map
|
105
|
+
*
|
106
|
+
* @param {Function} fn The visitor function.
|
107
|
+
* @param {Object} thisContext The context for the visitor, if any.
|
108
|
+
* @return {Fast} A new Fast object, containing the results.
|
109
|
+
*/
|
110
|
+
Fast.prototype.map = function Fast$map (fn, thisContext) {
|
111
|
+
return new Fast(Fast.map(this.value, fn, thisContext));
|
112
|
+
};
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Fast Filter
|
116
|
+
*
|
117
|
+
* @param {Function} fn The filter function.
|
118
|
+
* @param {Object} thisContext The context for the filter function, if any.
|
119
|
+
* @return {Fast} A new Fast object, containing the results.
|
120
|
+
*/
|
121
|
+
Fast.prototype.filter = function Fast$filter (fn, thisContext) {
|
122
|
+
return new Fast(Fast.filter(this.value, fn, thisContext));
|
123
|
+
};
|
124
|
+
|
125
|
+
/**
|
126
|
+
* Fast Reduce
|
127
|
+
*
|
128
|
+
* @param {Function} fn The reducer function.
|
129
|
+
* @param {mixed} initialValue The initial value, if any.
|
130
|
+
* @param {Object} thisContext The context for the reducer, if any.
|
131
|
+
* @return {mixed} The final result.
|
132
|
+
*/
|
133
|
+
Fast.prototype.reduce = function Fast$reduce (fn, initialValue, thisContext) {
|
134
|
+
return Fast.reduce(this.value, fn, initialValue, thisContext);
|
135
|
+
};
|
136
|
+
|
137
|
+
|
138
|
+
/**
|
139
|
+
* Fast Reduce Right
|
140
|
+
*
|
141
|
+
* @param {Function} fn The reducer function.
|
142
|
+
* @param {mixed} initialValue The initial value, if any.
|
143
|
+
* @param {Object} thisContext The context for the reducer, if any.
|
144
|
+
* @return {mixed} The final result.
|
145
|
+
*/
|
146
|
+
Fast.prototype.reduceRight = function Fast$reduceRight (fn, initialValue, thisContext) {
|
147
|
+
return Fast.reduceRight(this.value, fn, initialValue, thisContext);
|
148
|
+
};
|
149
|
+
|
150
|
+
/**
|
151
|
+
* Fast For Each
|
152
|
+
*
|
153
|
+
* @param {Function} fn The visitor function.
|
154
|
+
* @param {Object} thisContext The context for the visitor, if any.
|
155
|
+
* @return {Fast} The Fast instance.
|
156
|
+
*/
|
157
|
+
Fast.prototype.forEach = function Fast$forEach (fn, thisContext) {
|
158
|
+
Fast.forEach(this.value, fn, thisContext);
|
159
|
+
return this;
|
160
|
+
};
|
161
|
+
|
162
|
+
/**
|
163
|
+
* Fast Some
|
164
|
+
*
|
165
|
+
* @param {Function} fn The matcher predicate.
|
166
|
+
* @param {Object} thisContext The context for the matcher, if any.
|
167
|
+
* @return {Boolean} True if at least one element matches.
|
168
|
+
*/
|
169
|
+
Fast.prototype.some = function Fast$some (fn, thisContext) {
|
170
|
+
return Fast.some(this.value, fn, thisContext);
|
171
|
+
};
|
172
|
+
|
173
|
+
/**
|
174
|
+
* Fast Every
|
175
|
+
*
|
176
|
+
* @param {Function} fn The matcher predicate.
|
177
|
+
* @param {Object} thisContext The context for the matcher, if any.
|
178
|
+
* @return {Boolean} True if at all elements match.
|
179
|
+
*/
|
180
|
+
Fast.prototype.every = function Fast$every (fn, thisContext) {
|
181
|
+
return Fast.some(this.value, fn, thisContext);
|
182
|
+
};
|
183
|
+
|
184
|
+
/**
|
185
|
+
* Fast Index Of
|
186
|
+
*
|
187
|
+
* @param {mixed} target The target to lookup.
|
188
|
+
* @param {Number} fromIndex The index to start searching from, if known.
|
189
|
+
* @return {Number} The index of the item, or -1 if no match found.
|
190
|
+
*/
|
191
|
+
Fast.prototype.indexOf = function Fast$indexOf (target, fromIndex) {
|
192
|
+
return Fast.indexOf(this.value, target, fromIndex);
|
193
|
+
};
|
194
|
+
|
195
|
+
|
196
|
+
/**
|
197
|
+
* Fast Last Index Of
|
198
|
+
*
|
199
|
+
* @param {mixed} target The target to lookup.
|
200
|
+
* @param {Number} fromIndex The index to start searching from, if known.
|
201
|
+
* @return {Number} The last index of the item, or -1 if no match found.
|
202
|
+
*/
|
203
|
+
Fast.prototype.lastIndexOf = function Fast$lastIndexOf (target, fromIndex) {
|
204
|
+
return Fast.lastIndexOf(this.value, target, fromIndex);
|
205
|
+
};
|
206
|
+
|
207
|
+
/**
|
208
|
+
* Reverse
|
209
|
+
*
|
210
|
+
* @return {Fast} A new Fast instance, with the contents reversed.
|
211
|
+
*/
|
212
|
+
Fast.prototype.reverse = function Fast$reverse () {
|
213
|
+
return new Fast(this.value.reverse());
|
214
|
+
};
|
215
|
+
|
216
|
+
/**
|
217
|
+
* Value Of
|
218
|
+
*
|
219
|
+
* @return {Array} The wrapped value.
|
220
|
+
*/
|
221
|
+
Fast.prototype.valueOf = function Fast$valueOf () {
|
222
|
+
return this.value;
|
223
|
+
};
|
224
|
+
|
225
|
+
/**
|
226
|
+
* To JSON
|
227
|
+
*
|
228
|
+
* @return {Array} The wrapped value.
|
229
|
+
*/
|
230
|
+
Fast.prototype.toJSON = function Fast$toJSON () {
|
231
|
+
return this.value;
|
232
|
+
};
|
233
|
+
|
234
|
+
/**
|
235
|
+
* Item Length
|
236
|
+
*/
|
237
|
+
Object.defineProperty(Fast.prototype, 'length', {
|
238
|
+
get: function () {
|
239
|
+
return this.value.length;
|
240
|
+
}
|
241
|
+
});
|