deku 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +6 -0
  5. data/Gemfile +5 -0
  6. data/LICENSE +25 -0
  7. data/README.md +28 -0
  8. data/Rakefile +1 -0
  9. data/deku.gemspec +23 -0
  10. data/deps/node_modules/deku.js +2 -0
  11. data/deps/node_modules/deku/.editorconfig +16 -0
  12. data/deps/node_modules/deku/.zuul.yml +15 -0
  13. data/deps/node_modules/deku/History.md +290 -0
  14. data/deps/node_modules/deku/LICENSE.md +7 -0
  15. data/deps/node_modules/deku/Makefile +91 -0
  16. data/deps/node_modules/deku/README.md +293 -0
  17. data/deps/node_modules/deku/index.js +4072 -0
  18. data/deps/node_modules/deku/lib/application.js +85 -0
  19. data/deps/node_modules/deku/lib/index.js +28 -0
  20. data/deps/node_modules/deku/lib/render.js +1300 -0
  21. data/deps/node_modules/deku/lib/stringify.js +105 -0
  22. data/deps/node_modules/deku/lib/svg.js +107 -0
  23. data/deps/node_modules/deku/lib/utils.js +18 -0
  24. data/deps/node_modules/deku/lib/virtual.js +247 -0
  25. data/deps/node_modules/deku/node_modules/array-flatten/LICENSE +21 -0
  26. data/deps/node_modules/deku/node_modules/array-flatten/README.md +43 -0
  27. data/deps/node_modules/deku/node_modules/array-flatten/array-flatten.js +57 -0
  28. data/deps/node_modules/deku/node_modules/array-flatten/package.json +62 -0
  29. data/deps/node_modules/deku/node_modules/component-emitter/History.md +63 -0
  30. data/deps/node_modules/deku/node_modules/component-emitter/LICENSE +24 -0
  31. data/deps/node_modules/deku/node_modules/component-emitter/Readme.md +74 -0
  32. data/deps/node_modules/deku/node_modules/component-emitter/index.js +161 -0
  33. data/deps/node_modules/deku/node_modules/component-emitter/package.json +174 -0
  34. data/deps/node_modules/deku/node_modules/component-raf/.npmignore +2 -0
  35. data/deps/node_modules/deku/node_modules/component-raf/History.md +26 -0
  36. data/deps/node_modules/deku/node_modules/component-raf/Makefile +11 -0
  37. data/deps/node_modules/deku/node_modules/component-raf/Readme.md +46 -0
  38. data/deps/node_modules/deku/node_modules/component-raf/component.json +16 -0
  39. data/deps/node_modules/deku/node_modules/component-raf/example.html +43 -0
  40. data/deps/node_modules/deku/node_modules/component-raf/index.js +34 -0
  41. data/deps/node_modules/deku/node_modules/component-raf/package.json +164 -0
  42. data/deps/node_modules/deku/node_modules/component-type/.npmignore +3 -0
  43. data/deps/node_modules/deku/node_modules/component-type/Makefile +14 -0
  44. data/deps/node_modules/deku/node_modules/component-type/Readme.md +37 -0
  45. data/deps/node_modules/deku/node_modules/component-type/component.json +13 -0
  46. data/deps/node_modules/deku/node_modules/component-type/index.js +34 -0
  47. data/deps/node_modules/deku/node_modules/component-type/package.json +120 -0
  48. data/deps/node_modules/deku/node_modules/component-type/test/index.html +17 -0
  49. data/deps/node_modules/deku/node_modules/component-type/test/mocha.css +231 -0
  50. data/deps/node_modules/deku/node_modules/component-type/test/mocha.js +5340 -0
  51. data/deps/node_modules/deku/node_modules/component-type/test/tests.js +72 -0
  52. data/deps/node_modules/deku/node_modules/dom-pool/.npmignore +1 -0
  53. data/deps/node_modules/deku/node_modules/dom-pool/Pool.js +52 -0
  54. data/deps/node_modules/deku/node_modules/dom-pool/README.md +42 -0
  55. data/deps/node_modules/deku/node_modules/dom-pool/authors.txt +4 -0
  56. data/deps/node_modules/deku/node_modules/dom-pool/bower.json +26 -0
  57. data/deps/node_modules/deku/node_modules/dom-pool/package.json +46 -0
  58. data/deps/node_modules/deku/node_modules/dom-pool/tests.html +16 -0
  59. data/deps/node_modules/deku/node_modules/dom-pool/tests.js +102 -0
  60. data/deps/node_modules/deku/node_modules/dom-walk/.npmignore +3 -0
  61. data/deps/node_modules/deku/node_modules/dom-walk/LICENCE +19 -0
  62. data/deps/node_modules/deku/node_modules/dom-walk/Makefile +2 -0
  63. data/deps/node_modules/deku/node_modules/dom-walk/README.md +23 -0
  64. data/deps/node_modules/deku/node_modules/dom-walk/example/index.js +5 -0
  65. data/deps/node_modules/deku/node_modules/dom-walk/example/static/bundle.js +211 -0
  66. data/deps/node_modules/deku/node_modules/dom-walk/example/static/index.html +16 -0
  67. data/deps/node_modules/deku/node_modules/dom-walk/index.js +24 -0
  68. data/deps/node_modules/deku/node_modules/dom-walk/package.json +57 -0
  69. data/deps/node_modules/deku/node_modules/fast.js/.jshintignore +7 -0
  70. data/deps/node_modules/deku/node_modules/fast.js/.jshintrc +80 -0
  71. data/deps/node_modules/deku/node_modules/fast.js/.npmignore +6 -0
  72. data/deps/node_modules/deku/node_modules/fast.js/.travis.yml +3 -0
  73. data/deps/node_modules/deku/node_modules/fast.js/LICENSE.md +21 -0
  74. data/deps/node_modules/deku/node_modules/fast.js/README.md +552 -0
  75. data/deps/node_modules/deku/node_modules/fast.js/array/clone.js +21 -0
  76. data/deps/node_modules/deku/node_modules/fast.js/array/concat.js +32 -0
  77. data/deps/node_modules/deku/node_modules/fast.js/array/every.js +25 -0
  78. data/deps/node_modules/deku/node_modules/fast.js/array/fill.js +29 -0
  79. data/deps/node_modules/deku/node_modules/fast.js/array/filter.js +26 -0
  80. data/deps/node_modules/deku/node_modules/fast.js/array/forEach.js +21 -0
  81. data/deps/node_modules/deku/node_modules/fast.js/array/index.js +15 -0
  82. data/deps/node_modules/deku/node_modules/fast.js/array/indexOf.js +33 -0
  83. data/deps/node_modules/deku/node_modules/fast.js/array/lastIndexOf.js +29 -0
  84. data/deps/node_modules/deku/node_modules/fast.js/array/map.js +24 -0
  85. data/deps/node_modules/deku/node_modules/fast.js/array/pluck.js +24 -0
  86. data/deps/node_modules/deku/node_modules/fast.js/array/reduce.js +35 -0
  87. data/deps/node_modules/deku/node_modules/fast.js/array/reduceRight.js +35 -0
  88. data/deps/node_modules/deku/node_modules/fast.js/array/some.js +25 -0
  89. data/deps/node_modules/deku/node_modules/fast.js/bower.json +28 -0
  90. data/deps/node_modules/deku/node_modules/fast.js/clone.js +27 -0
  91. data/deps/node_modules/deku/node_modules/fast.js/dist/bench.html +15 -0
  92. data/deps/node_modules/deku/node_modules/fast.js/dist/bench.js +19900 -0
  93. data/deps/node_modules/deku/node_modules/fast.js/dist/fast.js +1450 -0
  94. data/deps/node_modules/deku/node_modules/fast.js/dist/fast.min.js +1 -0
  95. data/deps/node_modules/deku/node_modules/fast.js/filter.js +23 -0
  96. data/deps/node_modules/deku/node_modules/fast.js/forEach.js +22 -0
  97. data/deps/node_modules/deku/node_modules/fast.js/function/apply.js +19 -0
  98. data/deps/node_modules/deku/node_modules/fast.js/function/applyNoContext.js +29 -0
  99. data/deps/node_modules/deku/node_modules/fast.js/function/applyWithContext.js +29 -0
  100. data/deps/node_modules/deku/node_modules/fast.js/function/bind.js +71 -0
  101. data/deps/node_modules/deku/node_modules/fast.js/function/bindInternal3.js +11 -0
  102. data/deps/node_modules/deku/node_modules/fast.js/function/bindInternal4.js +11 -0
  103. data/deps/node_modules/deku/node_modules/fast.js/function/index.js +7 -0
  104. data/deps/node_modules/deku/node_modules/fast.js/function/partial.js +42 -0
  105. data/deps/node_modules/deku/node_modules/fast.js/function/partialConstructor.js +45 -0
  106. data/deps/node_modules/deku/node_modules/fast.js/function/try.js +35 -0
  107. data/deps/node_modules/deku/node_modules/fast.js/index.js +241 -0
  108. data/deps/node_modules/deku/node_modules/fast.js/map.js +23 -0
  109. data/deps/node_modules/deku/node_modules/fast.js/object/assign.js +34 -0
  110. data/deps/node_modules/deku/node_modules/fast.js/object/clone.js +25 -0
  111. data/deps/node_modules/deku/node_modules/fast.js/object/filter.js +28 -0
  112. data/deps/node_modules/deku/node_modules/fast.js/object/forEach.js +23 -0
  113. data/deps/node_modules/deku/node_modules/fast.js/object/index.js +11 -0
  114. data/deps/node_modules/deku/node_modules/fast.js/object/keys.js +17 -0
  115. data/deps/node_modules/deku/node_modules/fast.js/object/map.js +26 -0
  116. data/deps/node_modules/deku/node_modules/fast.js/object/reduce.js +37 -0
  117. data/deps/node_modules/deku/node_modules/fast.js/object/reduceRight.js +37 -0
  118. data/deps/node_modules/deku/node_modules/fast.js/object/values.js +20 -0
  119. data/deps/node_modules/deku/node_modules/fast.js/package.json +73 -0
  120. data/deps/node_modules/deku/node_modules/fast.js/reduce.js +24 -0
  121. data/deps/node_modules/deku/node_modules/fast.js/reduceRight.js +24 -0
  122. data/deps/node_modules/deku/node_modules/fast.js/string/index.js +3 -0
  123. data/deps/node_modules/deku/node_modules/fast.js/string/intern.js +56 -0
  124. data/deps/node_modules/deku/node_modules/get-uid/README.md +44 -0
  125. data/deps/node_modules/deku/node_modules/get-uid/index.js +6 -0
  126. data/deps/node_modules/deku/node_modules/get-uid/package.json +56 -0
  127. data/deps/node_modules/deku/node_modules/is-dom/HISTORY.md +2 -0
  128. data/deps/node_modules/deku/node_modules/is-dom/LICENSE +21 -0
  129. data/deps/node_modules/deku/node_modules/is-dom/README.md +32 -0
  130. data/deps/node_modules/deku/node_modules/is-dom/index.js +15 -0
  131. data/deps/node_modules/deku/node_modules/is-dom/package.json +62 -0
  132. data/deps/node_modules/deku/node_modules/object-path/.npmignore +7 -0
  133. data/deps/node_modules/deku/node_modules/object-path/.travis.yml +6 -0
  134. data/deps/node_modules/deku/node_modules/object-path/LICENSE +21 -0
  135. data/deps/node_modules/deku/node_modules/object-path/README.md +96 -0
  136. data/deps/node_modules/deku/node_modules/object-path/bower.json +17 -0
  137. data/deps/node_modules/deku/node_modules/object-path/component.json +22 -0
  138. data/deps/node_modules/deku/node_modules/object-path/index.js +269 -0
  139. data/deps/node_modules/deku/node_modules/object-path/package.json +89 -0
  140. data/deps/node_modules/deku/node_modules/object-path/test.js +510 -0
  141. data/deps/node_modules/deku/node_modules/per-frame/.npmignore +68 -0
  142. data/deps/node_modules/deku/node_modules/per-frame/History.md +32 -0
  143. data/deps/node_modules/deku/node_modules/per-frame/README.md +44 -0
  144. data/deps/node_modules/deku/node_modules/per-frame/component.json +13 -0
  145. data/deps/node_modules/deku/node_modules/per-frame/index.js +37 -0
  146. data/deps/node_modules/deku/node_modules/per-frame/package.json +143 -0
  147. data/deps/node_modules/deku/node_modules/per-frame/test/test.js +94 -0
  148. data/deps/node_modules/deku/node_modules/sliced/.npmignore +2 -0
  149. data/deps/node_modules/deku/node_modules/sliced/.travis.yml +4 -0
  150. data/deps/node_modules/deku/node_modules/sliced/History.md +30 -0
  151. data/deps/node_modules/deku/node_modules/sliced/LICENSE +22 -0
  152. data/deps/node_modules/deku/node_modules/sliced/Makefile +5 -0
  153. data/deps/node_modules/deku/node_modules/sliced/README.md +62 -0
  154. data/deps/node_modules/deku/node_modules/sliced/bench.js +95 -0
  155. data/deps/node_modules/deku/node_modules/sliced/component.json +14 -0
  156. data/deps/node_modules/deku/node_modules/sliced/index.js +1 -0
  157. data/deps/node_modules/deku/node_modules/sliced/lib/sliced.js +33 -0
  158. data/deps/node_modules/deku/node_modules/sliced/package.json +52 -0
  159. data/deps/node_modules/deku/node_modules/sliced/test/index.js +80 -0
  160. data/deps/node_modules/deku/package.json +67 -0
  161. data/lib/deku.rb +11 -0
  162. data/lib/deku/application.rb +16 -0
  163. data/lib/deku/component.rb +36 -0
  164. data/lib/deku/context.rb +38 -0
  165. data/lib/deku/element_node.rb +17 -0
  166. data/lib/deku/version.rb +4 -0
  167. metadata +278 -0
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * # Clone Array
5
+ *
6
+ * Clone an array or array like object (e.g. `arguments`).
7
+ * This is the equivalent of calling `Array.prototype.slice.call(arguments)`, but
8
+ * significantly faster.
9
+ *
10
+ * @param {Array} input The array or array-like object to clone.
11
+ * @return {Array} The cloned array.
12
+ */
13
+ module.exports = function fastCloneArray (input) {
14
+ var length = input.length,
15
+ sliced = new Array(length),
16
+ i;
17
+ for (i = 0; i < length; i++) {
18
+ sliced[i] = input[i];
19
+ }
20
+ return sliced;
21
+ };
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * # Concat
5
+ *
6
+ * Concatenate multiple arrays.
7
+ *
8
+ * > Note: This function is effectively identical to `Array.prototype.concat()`.
9
+ *
10
+ *
11
+ * @param {Array|mixed} item, ... The item(s) to concatenate.
12
+ * @return {Array} The array containing the concatenated items.
13
+ */
14
+ module.exports = function fastConcat () {
15
+ var length = arguments.length,
16
+ arr = [],
17
+ i, item, childLength, j;
18
+
19
+ for (i = 0; i < length; i++) {
20
+ item = arguments[i];
21
+ if (Array.isArray(item)) {
22
+ childLength = item.length;
23
+ for (j = 0; j < childLength; j++) {
24
+ arr.push(item[j]);
25
+ }
26
+ }
27
+ else {
28
+ arr.push(item);
29
+ }
30
+ }
31
+ return arr;
32
+ };
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ var bindInternal3 = require('../function/bindInternal3');
4
+
5
+ /**
6
+ * # Every
7
+ *
8
+ * A fast `.every()` implementation.
9
+ *
10
+ * @param {Array} subject The array (or array-like) to iterate over.
11
+ * @param {Function} fn The visitor function.
12
+ * @param {Object} thisContext The context for the visitor.
13
+ * @return {Boolean} true if all items in the array passes the truth test.
14
+ */
15
+ module.exports = function fastEvery (subject, fn, thisContext) {
16
+ var length = subject.length,
17
+ iterator = thisContext !== undefined ? bindInternal3(fn, thisContext) : fn,
18
+ i;
19
+ for (i = 0; i < length; i++) {
20
+ if (!iterator(subject[i], i, subject)) {
21
+ return false;
22
+ }
23
+ }
24
+ return true;
25
+ };
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * # Fill
5
+ * Fill an array with values, optionally starting and stopping at a given index.
6
+ *
7
+ * > Note: unlike the specced Array.prototype.fill(), this version does not support
8
+ * > negative start / end arguments.
9
+ *
10
+ * @param {Array} subject The array to fill.
11
+ * @param {mixed} value The value to insert.
12
+ * @param {Integer} start The start position, defaults to 0.
13
+ * @param {Integer} end The end position, defaults to subject.length
14
+ * @return {Array} The now filled subject.
15
+ */
16
+ module.exports = function fastFill (subject, value, start, end) {
17
+ var length = subject.length,
18
+ i;
19
+ if (start === undefined) {
20
+ start = 0;
21
+ }
22
+ if (end === undefined) {
23
+ end = length;
24
+ }
25
+ for (i = start; i < end; i++) {
26
+ subject[i] = value;
27
+ }
28
+ return subject;
29
+ };
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var bindInternal3 = require('../function/bindInternal3');
4
+
5
+ /**
6
+ * # Filter
7
+ *
8
+ * A fast `.filter()` implementation.
9
+ *
10
+ * @param {Array} subject The array (or array-like) to filter.
11
+ * @param {Function} fn The filter function.
12
+ * @param {Object} thisContext The context for the filter.
13
+ * @return {Array} The array containing the results.
14
+ */
15
+ module.exports = function fastFilter (subject, fn, thisContext) {
16
+ var length = subject.length,
17
+ result = [],
18
+ iterator = thisContext !== undefined ? bindInternal3(fn, thisContext) : fn,
19
+ i;
20
+ for (i = 0; i < length; i++) {
21
+ if (iterator(subject[i], i, subject)) {
22
+ result.push(subject[i]);
23
+ }
24
+ }
25
+ return result;
26
+ };
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var bindInternal3 = require('../function/bindInternal3');
4
+
5
+ /**
6
+ * # For Each
7
+ *
8
+ * A fast `.forEach()` implementation.
9
+ *
10
+ * @param {Array} subject The array (or array-like) to iterate over.
11
+ * @param {Function} fn The visitor function.
12
+ * @param {Object} thisContext The context for the visitor.
13
+ */
14
+ module.exports = function fastForEach (subject, fn, thisContext) {
15
+ var length = subject.length,
16
+ iterator = thisContext !== undefined ? bindInternal3(fn, thisContext) : fn,
17
+ i;
18
+ for (i = 0; i < length; i++) {
19
+ iterator(subject[i], i, subject);
20
+ }
21
+ };
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ exports.clone = require('./clone');
4
+ exports.concat = require('./concat');
5
+ exports.every = require('./every');
6
+ exports.filter = require('./filter');
7
+ exports.forEach = require('./forEach');
8
+ exports.indexOf = require('./indexOf');
9
+ exports.lastIndexOf = require('./lastIndexOf');
10
+ exports.map = require('./map');
11
+ exports.pluck = require('./pluck');
12
+ exports.reduce = require('./reduce');
13
+ exports.reduceRight = require('./reduceRight');
14
+ exports.some = require('./some');
15
+ exports.fill = require('./fill');
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * # Index Of
5
+ *
6
+ * A faster `Array.prototype.indexOf()` implementation.
7
+ *
8
+ * @param {Array} subject The array (or array-like) to search within.
9
+ * @param {mixed} target The target item to search for.
10
+ * @param {Number} fromIndex The position to start searching from, if known.
11
+ * @return {Number} The position of the target in the subject, or -1 if it does not exist.
12
+ */
13
+ module.exports = function fastIndexOf (subject, target, fromIndex) {
14
+ var length = subject.length,
15
+ i = 0;
16
+
17
+ if (typeof fromIndex === 'number') {
18
+ i = fromIndex;
19
+ if (i < 0) {
20
+ i += length;
21
+ if (i < 0) {
22
+ i = 0;
23
+ }
24
+ }
25
+ }
26
+
27
+ for (; i < length; i++) {
28
+ if (subject[i] === target) {
29
+ return i;
30
+ }
31
+ }
32
+ return -1;
33
+ };
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * # Last Index Of
5
+ *
6
+ * A faster `Array.prototype.lastIndexOf()` implementation.
7
+ *
8
+ * @param {Array} subject The array (or array-like) to search within.
9
+ * @param {mixed} target The target item to search for.
10
+ * @param {Number} fromIndex The position to start searching backwards from, if known.
11
+ * @return {Number} The last position of the target in the subject, or -1 if it does not exist.
12
+ */
13
+ module.exports = function fastLastIndexOf (subject, target, fromIndex) {
14
+ var length = subject.length,
15
+ i = length - 1;
16
+
17
+ if (typeof fromIndex === 'number') {
18
+ i = fromIndex;
19
+ if (i < 0) {
20
+ i += length;
21
+ }
22
+ }
23
+ for (; i >= 0; i--) {
24
+ if (subject[i] === target) {
25
+ return i;
26
+ }
27
+ }
28
+ return -1;
29
+ };
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ var bindInternal3 = require('../function/bindInternal3');
4
+
5
+ /**
6
+ * # Map
7
+ *
8
+ * A fast `.map()` implementation.
9
+ *
10
+ * @param {Array} subject The array (or array-like) to map over.
11
+ * @param {Function} fn The mapper function.
12
+ * @param {Object} thisContext The context for the mapper.
13
+ * @return {Array} The array containing the results.
14
+ */
15
+ module.exports = function fastMap (subject, fn, thisContext) {
16
+ var length = subject.length,
17
+ result = new Array(length),
18
+ iterator = thisContext !== undefined ? bindInternal3(fn, thisContext) : fn,
19
+ i;
20
+ for (i = 0; i < length; i++) {
21
+ result[i] = iterator(subject[i], i, subject);
22
+ }
23
+ return result;
24
+ };
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * # Pluck
5
+ * Pluck the property with the given name from an array of objects.
6
+ *
7
+ * @param {Array} input The values to pluck from.
8
+ * @param {String} field The name of the field to pluck.
9
+ * @return {Array} The plucked array of values.
10
+ */
11
+ module.exports = function fastPluck (input, field) {
12
+ var length = input.length,
13
+ plucked = [],
14
+ count = 0,
15
+ value, i;
16
+
17
+ for (i = 0; i < length; i++) {
18
+ value = input[i];
19
+ if (value != null && value[field] !== undefined) {
20
+ plucked[count++] = value[field];
21
+ }
22
+ }
23
+ return plucked;
24
+ };
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var bindInternal4 = require('../function/bindInternal4');
4
+
5
+ /**
6
+ * # Reduce
7
+ *
8
+ * A fast `.reduce()` implementation.
9
+ *
10
+ * @param {Array} subject The array (or array-like) to reduce.
11
+ * @param {Function} fn The reducer function.
12
+ * @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
13
+ * @param {Object} thisContext The context for the reducer.
14
+ * @return {mixed} The final result.
15
+ */
16
+ module.exports = function fastReduce (subject, fn, initialValue, thisContext) {
17
+ var length = subject.length,
18
+ iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
19
+ i, result;
20
+
21
+ if (initialValue === undefined) {
22
+ i = 1;
23
+ result = subject[0];
24
+ }
25
+ else {
26
+ i = 0;
27
+ result = initialValue;
28
+ }
29
+
30
+ for (; i < length; i++) {
31
+ result = iterator(result, subject[i], i, subject);
32
+ }
33
+
34
+ return result;
35
+ };
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var bindInternal4 = require('../function/bindInternal4');
4
+
5
+ /**
6
+ * # Reduce Right
7
+ *
8
+ * A fast `.reduceRight()` implementation.
9
+ *
10
+ * @param {Array} subject The array (or array-like) to reduce.
11
+ * @param {Function} fn The reducer function.
12
+ * @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
13
+ * @param {Object} thisContext The context for the reducer.
14
+ * @return {mixed} The final result.
15
+ */
16
+ module.exports = function fastReduce (subject, fn, initialValue, thisContext) {
17
+ var length = subject.length,
18
+ iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
19
+ i, result;
20
+
21
+ if (initialValue === undefined) {
22
+ i = length - 2;
23
+ result = subject[length - 1];
24
+ }
25
+ else {
26
+ i = length - 1;
27
+ result = initialValue;
28
+ }
29
+
30
+ for (; i >= 0; i--) {
31
+ result = iterator(result, subject[i], i, subject);
32
+ }
33
+
34
+ return result;
35
+ };
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ var bindInternal3 = require('../function/bindInternal3');
4
+
5
+ /**
6
+ * # Some
7
+ *
8
+ * A fast `.some()` implementation.
9
+ *
10
+ * @param {Array} subject The array (or array-like) to iterate over.
11
+ * @param {Function} fn The visitor function.
12
+ * @param {Object} thisContext The context for the visitor.
13
+ * @return {Boolean} true if at least one item in the array passes the truth test.
14
+ */
15
+ module.exports = function fastSome (subject, fn, thisContext) {
16
+ var length = subject.length,
17
+ iterator = thisContext !== undefined ? bindInternal3(fn, thisContext) : fn,
18
+ i;
19
+ for (i = 0; i < length; i++) {
20
+ if (iterator(subject[i], i, subject)) {
21
+ return true;
22
+ }
23
+ }
24
+ return false;
25
+ };
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "fast.js",
3
+ "version": "0.1.1",
4
+ "homepage": "https://github.com/codemix/fast.js",
5
+ "authors": [
6
+ "Charles Pick <charles@codemix.com>"
7
+ ],
8
+ "description": "Fast re-implementations of native JavaScript functions",
9
+ "main": "dist/fast.js",
10
+ "moduleType": [
11
+ "globals"
12
+ ],
13
+ "keywords": [
14
+ "fast",
15
+ "performance",
16
+ "native",
17
+ "benchmarks"
18
+ ],
19
+ "license": "MIT",
20
+ "ignore": [
21
+ "**/.*",
22
+ "node_modules",
23
+ "bower_components",
24
+ "test",
25
+ "tests",
26
+ "coverage"
27
+ ]
28
+ }
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var cloneArray = require('./array/clone');
4
+ var cloneObject = require('./object/clone');
5
+
6
+ /**
7
+ * # Clone
8
+ *
9
+ * Clone an item. Primitive values will be returned directly,
10
+ * arrays and objects will be shallow cloned. If you know the
11
+ * type of input you're dealing with, call `.cloneArray()` or `.cloneObject()`
12
+ * instead.
13
+ *
14
+ * @param {mixed} input The input to clone.
15
+ * @return {mixed} The cloned input.
16
+ */
17
+ module.exports = function clone (input) {
18
+ if (!input || typeof input !== 'object') {
19
+ return input;
20
+ }
21
+ else if (Array.isArray(input)) {
22
+ return cloneArray(input);
23
+ }
24
+ else {
25
+ return cloneObject(input);
26
+ }
27
+ };