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.
- 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,30 @@
|
|
|
1
|
+
|
|
2
|
+
0.0.5 / 2013-02-05
|
|
3
|
+
==================
|
|
4
|
+
|
|
5
|
+
* optimization: remove use of arguments [jkroso](https://github.com/jkroso)
|
|
6
|
+
* add scripts to component.json [jkroso](https://github.com/jkroso)
|
|
7
|
+
* tests; remove time for travis
|
|
8
|
+
|
|
9
|
+
0.0.4 / 2013-01-07
|
|
10
|
+
==================
|
|
11
|
+
|
|
12
|
+
* added component.json #1 [jkroso](https://github.com/jkroso)
|
|
13
|
+
* reversed array loop #1 [jkroso](https://github.com/jkroso)
|
|
14
|
+
* remove fn params
|
|
15
|
+
|
|
16
|
+
0.0.3 / 2012-09-29
|
|
17
|
+
==================
|
|
18
|
+
|
|
19
|
+
* faster with negative start args
|
|
20
|
+
|
|
21
|
+
0.0.2 / 2012-09-29
|
|
22
|
+
==================
|
|
23
|
+
|
|
24
|
+
* support full [].slice semantics
|
|
25
|
+
|
|
26
|
+
0.0.1 / 2012-09-29
|
|
27
|
+
===================
|
|
28
|
+
|
|
29
|
+
* initial release
|
|
30
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2012 [Aaron Heckmann](aaron.heckmann+github@gmail.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#sliced
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
A faster alternative to `[].slice.call(arguments)`.
|
|
5
|
+
|
|
6
|
+
[](http://travis-ci.org/aheckmann/sliced)
|
|
7
|
+
|
|
8
|
+
Example output from [benchmark.js](https://github.com/bestiejs/benchmark.js)
|
|
9
|
+
|
|
10
|
+
Array.prototype.slice.call x 1,320,205 ops/sec ±2.35% (92 runs sampled)
|
|
11
|
+
[].slice.call x 1,314,605 ops/sec ±1.60% (95 runs sampled)
|
|
12
|
+
cached slice.call x 10,468,380 ops/sec ±1.45% (95 runs sampled)
|
|
13
|
+
sliced x 16,608,237 ops/sec ±1.40% (92 runs sampled)
|
|
14
|
+
fastest is sliced
|
|
15
|
+
|
|
16
|
+
Array.prototype.slice.call(arguments, 1) x 1,383,584 ops/sec ±1.73% (97 runs sampled)
|
|
17
|
+
[].slice.call(arguments, 1) x 1,494,735 ops/sec ±1.33% (95 runs sampled)
|
|
18
|
+
cached slice.call(arguments, 1) x 10,085,270 ops/sec ±1.51% (97 runs sampled)
|
|
19
|
+
sliced(arguments, 1) x 16,620,480 ops/sec ±1.29% (95 runs sampled)
|
|
20
|
+
fastest is sliced(arguments, 1)
|
|
21
|
+
|
|
22
|
+
Array.prototype.slice.call(arguments, -1) x 1,303,262 ops/sec ±1.62% (94 runs sampled)
|
|
23
|
+
[].slice.call(arguments, -1) x 1,325,615 ops/sec ±1.36% (97 runs sampled)
|
|
24
|
+
cached slice.call(arguments, -1) x 9,673,603 ops/sec ±1.70% (96 runs sampled)
|
|
25
|
+
sliced(arguments, -1) x 16,384,575 ops/sec ±1.06% (91 runs sampled)
|
|
26
|
+
fastest is sliced(arguments, -1)
|
|
27
|
+
|
|
28
|
+
Array.prototype.slice.call(arguments, -2, -10) x 1,404,390 ops/sec ±1.61% (95 runs sampled)
|
|
29
|
+
[].slice.call(arguments, -2, -10) x 1,514,367 ops/sec ±1.21% (96 runs sampled)
|
|
30
|
+
cached slice.call(arguments, -2, -10) x 9,836,017 ops/sec ±1.21% (95 runs sampled)
|
|
31
|
+
sliced(arguments, -2, -10) x 18,544,882 ops/sec ±1.30% (91 runs sampled)
|
|
32
|
+
fastest is sliced(arguments, -2, -10)
|
|
33
|
+
|
|
34
|
+
Array.prototype.slice.call(arguments, -2, -1) x 1,458,604 ops/sec ±1.41% (97 runs sampled)
|
|
35
|
+
[].slice.call(arguments, -2, -1) x 1,536,547 ops/sec ±1.63% (99 runs sampled)
|
|
36
|
+
cached slice.call(arguments, -2, -1) x 10,060,633 ops/sec ±1.37% (96 runs sampled)
|
|
37
|
+
sliced(arguments, -2, -1) x 18,608,712 ops/sec ±1.08% (93 runs sampled)
|
|
38
|
+
fastest is sliced(arguments, -2, -1)
|
|
39
|
+
|
|
40
|
+
_Benchmark [source](https://github.com/aheckmann/sliced/blob/master/bench.js)._
|
|
41
|
+
|
|
42
|
+
##Usage
|
|
43
|
+
|
|
44
|
+
`sliced` accepts the same arguments as `Array#slice` so you can easily swap it out.
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
function zing () {
|
|
48
|
+
var slow = [].slice.call(arguments, 1, 8);
|
|
49
|
+
var args = slice(arguments, 1, 8);
|
|
50
|
+
|
|
51
|
+
var slow = Array.prototype.slice.call(arguments);
|
|
52
|
+
var args = slice(arguments);
|
|
53
|
+
// etc
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## install
|
|
58
|
+
|
|
59
|
+
npm install sliced
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
[LICENSE](https://github.com/aheckmann/sliced/blob/master/LICENSE)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
|
|
2
|
+
var sliced = require('./')
|
|
3
|
+
var Bench = require('benchmark');
|
|
4
|
+
var s = new Bench.Suite;
|
|
5
|
+
var slice = [].slice;
|
|
6
|
+
|
|
7
|
+
s.add('Array.prototype.slice.call', function () {
|
|
8
|
+
Array.prototype.slice.call(arguments);
|
|
9
|
+
}).add('[].slice.call', function () {
|
|
10
|
+
[].slice.call(arguments);
|
|
11
|
+
}).add('cached slice.call', function () {
|
|
12
|
+
slice.call(arguments)
|
|
13
|
+
}).add('sliced', function () {
|
|
14
|
+
sliced(arguments)
|
|
15
|
+
}).on('cycle', function (evt) {
|
|
16
|
+
console.log(String(evt.target));
|
|
17
|
+
}).on('complete', function () {
|
|
18
|
+
console.log('fastest is %s', this.filter('fastest').pluck('name'));
|
|
19
|
+
})
|
|
20
|
+
.run();
|
|
21
|
+
|
|
22
|
+
var s = new Bench.Suite;
|
|
23
|
+
s.add('Array.prototype.slice.call(arguments, 1)', function () {
|
|
24
|
+
Array.prototype.slice.call(arguments, 1);
|
|
25
|
+
}).add('[].slice.call(arguments, 1)', function () {
|
|
26
|
+
[].slice.call(arguments, 1);
|
|
27
|
+
}).add('cached slice.call(arguments, 1)', function () {
|
|
28
|
+
slice.call(arguments, 1)
|
|
29
|
+
}).add('sliced(arguments, 1)', function () {
|
|
30
|
+
sliced(arguments, 1)
|
|
31
|
+
}).on('cycle', function (evt) {
|
|
32
|
+
console.log(String(evt.target));
|
|
33
|
+
}).on('complete', function () {
|
|
34
|
+
console.log('fastest is %s', this.filter('fastest').pluck('name'));
|
|
35
|
+
})
|
|
36
|
+
.run();
|
|
37
|
+
|
|
38
|
+
var s = new Bench.Suite;
|
|
39
|
+
s.add('Array.prototype.slice.call(arguments, -1)', function () {
|
|
40
|
+
Array.prototype.slice.call(arguments, -1);
|
|
41
|
+
}).add('[].slice.call(arguments, -1)', function () {
|
|
42
|
+
[].slice.call(arguments, -1);
|
|
43
|
+
}).add('cached slice.call(arguments, -1)', function () {
|
|
44
|
+
slice.call(arguments, -1)
|
|
45
|
+
}).add('sliced(arguments, -1)', function () {
|
|
46
|
+
sliced(arguments, -1)
|
|
47
|
+
}).on('cycle', function (evt) {
|
|
48
|
+
console.log(String(evt.target));
|
|
49
|
+
}).on('complete', function () {
|
|
50
|
+
console.log('fastest is %s', this.filter('fastest').pluck('name'));
|
|
51
|
+
})
|
|
52
|
+
.run();
|
|
53
|
+
|
|
54
|
+
var s = new Bench.Suite;
|
|
55
|
+
s.add('Array.prototype.slice.call(arguments, -2, -10)', function () {
|
|
56
|
+
Array.prototype.slice.call(arguments, -2, -10);
|
|
57
|
+
}).add('[].slice.call(arguments, -2, -10)', function () {
|
|
58
|
+
[].slice.call(arguments, -2, -10);
|
|
59
|
+
}).add('cached slice.call(arguments, -2, -10)', function () {
|
|
60
|
+
slice.call(arguments, -2, -10)
|
|
61
|
+
}).add('sliced(arguments, -2, -10)', function () {
|
|
62
|
+
sliced(arguments, -2, -10)
|
|
63
|
+
}).on('cycle', function (evt) {
|
|
64
|
+
console.log(String(evt.target));
|
|
65
|
+
}).on('complete', function () {
|
|
66
|
+
console.log('fastest is %s', this.filter('fastest').pluck('name'));
|
|
67
|
+
})
|
|
68
|
+
.run();
|
|
69
|
+
|
|
70
|
+
var s = new Bench.Suite;
|
|
71
|
+
s.add('Array.prototype.slice.call(arguments, -2, -1)', function () {
|
|
72
|
+
Array.prototype.slice.call(arguments, -2, -1);
|
|
73
|
+
}).add('[].slice.call(arguments, -2, -1)', function () {
|
|
74
|
+
[].slice.call(arguments, -2, -1);
|
|
75
|
+
}).add('cached slice.call(arguments, -2, -1)', function () {
|
|
76
|
+
slice.call(arguments, -2, -1)
|
|
77
|
+
}).add('sliced(arguments, -2, -1)', function () {
|
|
78
|
+
sliced(arguments, -2, -1)
|
|
79
|
+
}).on('cycle', function (evt) {
|
|
80
|
+
console.log(String(evt.target));
|
|
81
|
+
}).on('complete', function () {
|
|
82
|
+
console.log('fastest is %s', this.filter('fastest').pluck('name'));
|
|
83
|
+
})
|
|
84
|
+
.run();
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Output:
|
|
88
|
+
*
|
|
89
|
+
* Array.prototype.slice.call x 1,289,592 ops/sec ±2.88% (87 runs sampled)
|
|
90
|
+
* [].slice.call x 1,345,451 ops/sec ±1.68% (97 runs sampled)
|
|
91
|
+
* cached slice.call x 10,719,886 ops/sec ±1.04% (99 runs sampled)
|
|
92
|
+
* sliced x 15,809,545 ops/sec ±1.46% (93 runs sampled)
|
|
93
|
+
* fastest is sliced
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sliced",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "A faster Node.js alternative to Array.prototype.slice.call(arguments)",
|
|
5
|
+
"repo" : "aheckmann/sliced",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"arguments",
|
|
8
|
+
"slice",
|
|
9
|
+
"array"
|
|
10
|
+
],
|
|
11
|
+
"scripts": ["lib/sliced.js", "index.js"],
|
|
12
|
+
"author": "Aaron Heckmann <aaron.heckmann+github@gmail.com>",
|
|
13
|
+
"license": "MIT"
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = exports = require('./lib/sliced');
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* An Array.prototype.slice.call(arguments) alternative
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} args something with a length
|
|
6
|
+
* @param {Number} slice
|
|
7
|
+
* @param {Number} sliceEnd
|
|
8
|
+
* @api public
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
module.exports = function (args, slice, sliceEnd) {
|
|
12
|
+
var ret = [];
|
|
13
|
+
var len = args.length;
|
|
14
|
+
|
|
15
|
+
if (0 === len) return ret;
|
|
16
|
+
|
|
17
|
+
var start = slice < 0
|
|
18
|
+
? Math.max(0, slice + len)
|
|
19
|
+
: slice || 0;
|
|
20
|
+
|
|
21
|
+
if (sliceEnd !== undefined) {
|
|
22
|
+
len = sliceEnd < 0
|
|
23
|
+
? sliceEnd + len
|
|
24
|
+
: sliceEnd
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
while (len-- > start) {
|
|
28
|
+
ret[len - start] = args[len];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return ret;
|
|
32
|
+
}
|
|
33
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sliced",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "A faster Node.js alternative to Array.prototype.slice.call(arguments)",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "make test"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git://github.com/aheckmann/sliced"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"arguments",
|
|
15
|
+
"slice",
|
|
16
|
+
"array"
|
|
17
|
+
],
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "Aaron Heckmann",
|
|
20
|
+
"email": "aaron.heckmann+github@gmail.com"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"mocha": "1.5.0",
|
|
25
|
+
"benchmark": "~1.0.0"
|
|
26
|
+
},
|
|
27
|
+
"readme": "#sliced\n==========\n\nA faster alternative to `[].slice.call(arguments)`.\n\n[](http://travis-ci.org/aheckmann/sliced)\n\nExample output from [benchmark.js](https://github.com/bestiejs/benchmark.js)\n\n Array.prototype.slice.call x 1,320,205 ops/sec ±2.35% (92 runs sampled)\n [].slice.call x 1,314,605 ops/sec ±1.60% (95 runs sampled)\n cached slice.call x 10,468,380 ops/sec ±1.45% (95 runs sampled)\n sliced x 16,608,237 ops/sec ±1.40% (92 runs sampled)\n fastest is sliced\n\n Array.prototype.slice.call(arguments, 1) x 1,383,584 ops/sec ±1.73% (97 runs sampled)\n [].slice.call(arguments, 1) x 1,494,735 ops/sec ±1.33% (95 runs sampled)\n cached slice.call(arguments, 1) x 10,085,270 ops/sec ±1.51% (97 runs sampled)\n sliced(arguments, 1) x 16,620,480 ops/sec ±1.29% (95 runs sampled)\n fastest is sliced(arguments, 1)\n\n Array.prototype.slice.call(arguments, -1) x 1,303,262 ops/sec ±1.62% (94 runs sampled)\n [].slice.call(arguments, -1) x 1,325,615 ops/sec ±1.36% (97 runs sampled)\n cached slice.call(arguments, -1) x 9,673,603 ops/sec ±1.70% (96 runs sampled)\n sliced(arguments, -1) x 16,384,575 ops/sec ±1.06% (91 runs sampled)\n fastest is sliced(arguments, -1)\n\n Array.prototype.slice.call(arguments, -2, -10) x 1,404,390 ops/sec ±1.61% (95 runs sampled)\n [].slice.call(arguments, -2, -10) x 1,514,367 ops/sec ±1.21% (96 runs sampled)\n cached slice.call(arguments, -2, -10) x 9,836,017 ops/sec ±1.21% (95 runs sampled)\n sliced(arguments, -2, -10) x 18,544,882 ops/sec ±1.30% (91 runs sampled)\n fastest is sliced(arguments, -2, -10)\n\n Array.prototype.slice.call(arguments, -2, -1) x 1,458,604 ops/sec ±1.41% (97 runs sampled)\n [].slice.call(arguments, -2, -1) x 1,536,547 ops/sec ±1.63% (99 runs sampled)\n cached slice.call(arguments, -2, -1) x 10,060,633 ops/sec ±1.37% (96 runs sampled)\n sliced(arguments, -2, -1) x 18,608,712 ops/sec ±1.08% (93 runs sampled)\n fastest is sliced(arguments, -2, -1)\n\n_Benchmark [source](https://github.com/aheckmann/sliced/blob/master/bench.js)._\n\n##Usage\n\n`sliced` accepts the same arguments as `Array#slice` so you can easily swap it out.\n\n```js\nfunction zing () {\n var slow = [].slice.call(arguments, 1, 8);\n var args = slice(arguments, 1, 8);\n\n var slow = Array.prototype.slice.call(arguments);\n var args = slice(arguments);\n // etc\n}\n```\n\n## install\n\n npm install sliced\n\n\n[LICENSE](https://github.com/aheckmann/sliced/blob/master/LICENSE)\n",
|
|
28
|
+
"_id": "sliced@0.0.5",
|
|
29
|
+
"dist": {
|
|
30
|
+
"shasum": "5edc044ca4eb6f7816d50ba2fc63e25d8fe4707f",
|
|
31
|
+
"tarball": "http://registry.npmjs.org/sliced/-/sliced-0.0.5.tgz"
|
|
32
|
+
},
|
|
33
|
+
"_npmVersion": "1.1.59",
|
|
34
|
+
"_npmUser": {
|
|
35
|
+
"name": "aaron",
|
|
36
|
+
"email": "aaron.heckmann+github@gmail.com"
|
|
37
|
+
},
|
|
38
|
+
"maintainers": [
|
|
39
|
+
{
|
|
40
|
+
"name": "aaron",
|
|
41
|
+
"email": "aaron.heckmann+github@gmail.com"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"directories": {},
|
|
45
|
+
"_shasum": "5edc044ca4eb6f7816d50ba2fc63e25d8fe4707f",
|
|
46
|
+
"_resolved": "https://registry.npmjs.org/sliced/-/sliced-0.0.5.tgz",
|
|
47
|
+
"_from": "sliced@0.0.5",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/aheckmann/sliced/issues"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/aheckmann/sliced"
|
|
52
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
|
|
2
|
+
var sliced = require('../')
|
|
3
|
+
var assert = require('assert')
|
|
4
|
+
|
|
5
|
+
describe('sliced', function(){
|
|
6
|
+
it('exports a function', function(){
|
|
7
|
+
assert.equal('function', typeof sliced);
|
|
8
|
+
})
|
|
9
|
+
describe('with 1 arg', function(){
|
|
10
|
+
it('returns an array of the arg', function(){
|
|
11
|
+
var o = [3, "4", {}];
|
|
12
|
+
var r = sliced(o);
|
|
13
|
+
assert.equal(3, r.length);
|
|
14
|
+
assert.equal(o[0], r[0]);
|
|
15
|
+
assert.equal(o[1], r[1]);
|
|
16
|
+
assert.equal(o[1], r[1]);
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
describe('with 2 args', function(){
|
|
20
|
+
it('returns an array of the arg starting at the 2nd arg', function(){
|
|
21
|
+
var o = [3, "4", 5, null];
|
|
22
|
+
var r = sliced(o, 2);
|
|
23
|
+
assert.equal(2, r.length);
|
|
24
|
+
assert.equal(o[2], r[0]);
|
|
25
|
+
assert.equal(o[3], r[1]);
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
describe('with 3 args', function(){
|
|
29
|
+
it('returns an array of the arg from the 2nd to the 3rd arg', function(){
|
|
30
|
+
var o = [3, "4", 5, null];
|
|
31
|
+
var r = sliced(o, 1, 2);
|
|
32
|
+
assert.equal(1, r.length);
|
|
33
|
+
assert.equal(o[1], r[0]);
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
describe('with negative start and no end', function(){
|
|
37
|
+
it('begins at an offset from the end and includes all following elements', function(){
|
|
38
|
+
var o = [3, "4", 5, null];
|
|
39
|
+
var r = sliced(o, -2);
|
|
40
|
+
assert.equal(2, r.length);
|
|
41
|
+
assert.equal(o[2], r[0]);
|
|
42
|
+
assert.equal(o[3], r[1]);
|
|
43
|
+
|
|
44
|
+
var r = sliced(o, -12);
|
|
45
|
+
assert.equal(4, r.length);
|
|
46
|
+
assert.equal(o[0], r[0]);
|
|
47
|
+
assert.equal(o[1], r[1]);
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
describe('with negative start and positive end', function(){
|
|
51
|
+
it('begins at an offset from the end and includes `end` elements', function(){
|
|
52
|
+
var o = [3, "4", {x:1}, null];
|
|
53
|
+
|
|
54
|
+
var r = sliced(o, -2, 1);
|
|
55
|
+
assert.equal(0, r.length);
|
|
56
|
+
|
|
57
|
+
var r = sliced(o, -2, 2);
|
|
58
|
+
assert.equal(0, r.length);
|
|
59
|
+
|
|
60
|
+
var r = sliced(o, -2, 3);
|
|
61
|
+
assert.equal(1, r.length);
|
|
62
|
+
assert.equal(o[2], r[0]);
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
describe('with negative start and negative end', function(){
|
|
66
|
+
it('begins at `start` offset from the end and includes all elements up to `end` offset from the end', function(){
|
|
67
|
+
var o = [3, "4", {x:1}, null];
|
|
68
|
+
var r = sliced(o, -3, -1);
|
|
69
|
+
assert.equal(2, r.length);
|
|
70
|
+
assert.equal(o[1], r[0]);
|
|
71
|
+
assert.equal(o[2], r[1]);
|
|
72
|
+
|
|
73
|
+
var r = sliced(o, -3, -3);
|
|
74
|
+
assert.equal(0, r.length);
|
|
75
|
+
|
|
76
|
+
var r = sliced(o, -3, -4);
|
|
77
|
+
assert.equal(0, r.length);
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
})
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "deku",
|
|
3
|
+
"version": "0.2.17",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/segmentio/deku"
|
|
7
|
+
},
|
|
8
|
+
"description": "Create view components using a virtual DOM",
|
|
9
|
+
"main": "lib/index.js",
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"babelify": "^5.0.4",
|
|
12
|
+
"benchmark": "^1.0.0",
|
|
13
|
+
"bfc": "~0.3.1",
|
|
14
|
+
"browserify": "^8.1.1",
|
|
15
|
+
"bump": "git://github.com/ianstormtaylor/bump.git#0.4.2",
|
|
16
|
+
"component-classes": "^1.2.3",
|
|
17
|
+
"duo-test": "^0.3.13",
|
|
18
|
+
"memoizee": "^0.3.8",
|
|
19
|
+
"minify": "^1.4.11",
|
|
20
|
+
"mochify": "^2.1.1",
|
|
21
|
+
"standard": "^3.6.1",
|
|
22
|
+
"trigger-event": "^1.0.0",
|
|
23
|
+
"zuul": "~1.16.4"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"array-flatten": "^1.0.2",
|
|
27
|
+
"component-emitter": "^1.1.3",
|
|
28
|
+
"component-raf": "^1.2.0",
|
|
29
|
+
"component-type": "^1.1.0",
|
|
30
|
+
"dom-pool": "^0.1.1",
|
|
31
|
+
"dom-walk": "^0.1.1",
|
|
32
|
+
"fast.js": "^0.1.1",
|
|
33
|
+
"get-uid": "^1.0.1",
|
|
34
|
+
"is-dom": "^1.0.5",
|
|
35
|
+
"object-path": "^0.8.1",
|
|
36
|
+
"per-frame": "^3.0.0",
|
|
37
|
+
"sliced": "0.0.5"
|
|
38
|
+
},
|
|
39
|
+
"gitHead": "c8e9cd6ea49b2c27ec5625f9653335d70a17cf73",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/segmentio/deku/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/segmentio/deku",
|
|
44
|
+
"_id": "deku@0.2.17",
|
|
45
|
+
"scripts": {},
|
|
46
|
+
"_shasum": "a2071d982bd0306763e4fa0303a6b59f0f4dbc42",
|
|
47
|
+
"_from": "deku@*",
|
|
48
|
+
"_npmVersion": "2.6.0",
|
|
49
|
+
"_nodeVersion": "0.12.0",
|
|
50
|
+
"_npmUser": {
|
|
51
|
+
"name": "anthonyshort",
|
|
52
|
+
"email": "antshort@gmail.com"
|
|
53
|
+
},
|
|
54
|
+
"maintainers": [
|
|
55
|
+
{
|
|
56
|
+
"name": "anthonyshort",
|
|
57
|
+
"email": "antshort@gmail.com"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"dist": {
|
|
61
|
+
"shasum": "a2071d982bd0306763e4fa0303a6b59f0f4dbc42",
|
|
62
|
+
"tarball": "http://registry.npmjs.org/deku/-/deku-0.2.17.tgz"
|
|
63
|
+
},
|
|
64
|
+
"directories": {},
|
|
65
|
+
"_resolved": "https://registry.npmjs.org/deku/-/deku-0.2.17.tgz",
|
|
66
|
+
"readme": "ERROR: No README data found!"
|
|
67
|
+
}
|