underscore-transducer
Advanced tools
+7
-6
| "use strict"; | ||
| var tr = require('transduce'), undef; | ||
| var tr = require('transduce'), | ||
| merge = tr.objectMerge, | ||
| undef; | ||
| var _r = function(obj, transform) { | ||
| var _ = _r._; | ||
| if (_r.as(obj)){ | ||
@@ -10,6 +11,6 @@ if(transform === undef){ | ||
| } | ||
| var wrappedFns = _.clone(obj._wrappedFns); | ||
| var wrappedFns = obj._wrappedFns.slice(); | ||
| wrappedFns.push(transform); | ||
| var copy = new _r(obj._wrapped, wrappedFns); | ||
| copy._opts = _.clone(obj._opts); | ||
| copy._opts = merge({}, obj._opts); | ||
| return copy; | ||
@@ -21,3 +22,3 @@ } | ||
| if(_r.as(transform)){ | ||
| this._opts = _.clone(transform._opts); | ||
| this._opts = merge({}, transform._opts); | ||
| transform = transform._wrappedFns; | ||
@@ -39,3 +40,3 @@ } else { | ||
| _r.VERSION = '0.2.1'; | ||
| _r.VERSION = '0.3.0'; | ||
@@ -42,0 +43,0 @@ // Export for browser or Common-JS |
+1
-1
@@ -175,3 +175,3 @@ "use strict"; | ||
| wrap.register(function(value){ | ||
| if(_.isString(value)){ | ||
| if(tr.isString(value)){ | ||
| value = [value]; | ||
@@ -178,0 +178,0 @@ } else if(value === null || value === undef){ |
+0
-3
@@ -6,5 +6,2 @@ "use strict"; | ||
| _r._ = _; | ||
| _.clone = require('lodash-node/underscore/objects/clone'); | ||
| _.isString = require('lodash-node/underscore/objects/isString'); | ||
| _.isBoolean = require('lodash-node/underscore/objects/isBoolean'); | ||
| _.iteratee = require('lodash-node/underscore/functions/createCallback'); | ||
@@ -11,0 +8,0 @@ _.matches = _.iteratee; |
+4
-2
| "use strict"; | ||
| var un = require('transduce-unique'), undef; | ||
| var tr = require('transduce'), | ||
| un = require('transduce-unique'), | ||
| undef; | ||
@@ -19,3 +21,3 @@ module.exports = function(_r){ | ||
| function unique(isSorted, f) { | ||
| if (!_.isBoolean(isSorted)) { | ||
| if (isSorted !== true && isSorted !== false) { | ||
| f = isSorted; | ||
@@ -22,0 +24,0 @@ isSorted = false; |
+9
-11
| { | ||
| "name": "underscore-transducer", | ||
| "version": "0.2.1", | ||
| "version": "0.3.0", | ||
| "description": "Transducers for Underscore", | ||
@@ -27,10 +27,10 @@ "main": "underscore-transducer.js", | ||
| "dependencies": { | ||
| "transduce": "0.0.12", | ||
| "transduce-math": "0.0.3", | ||
| "transduce-array": "0.0.8", | ||
| "transduce-push": "0.0.7", | ||
| "transduce-string": "0.0.8", | ||
| "redispatch": "0.0.2", | ||
| "transduce-unique": "0.0.1", | ||
| "lodash-node": "~2.4.1" | ||
| "lodash-node": "~2.4.1", | ||
| "transduce": "~0.2.0", | ||
| "transduce-array": "~0.1.0", | ||
| "transduce-math": "~0.1.0", | ||
| "transduce-push": "~0.1.0", | ||
| "transduce-string": "~0.1.0", | ||
| "transduce-unique": "~0.1.0", | ||
| "redispatch": "0.0.2" | ||
| }, | ||
@@ -40,4 +40,2 @@ "devDependencies": { | ||
| "uglify-js": "~2.3.6", | ||
| "transducers-js": "~0.4.135", | ||
| "transducers.js": "~0.2.3", | ||
| "browserify": "~6.1.0", | ||
@@ -44,0 +42,0 @@ "tap-bail": "0.0.0" |
+11
-17
@@ -5,10 +5,16 @@ # Underscore Transducer | ||
| Use [transducers-js][10] or [transducers.js][11] (your choice) with the familiar [Underscore.js][1] API with extra goodies like [lazy generators and callback processes][4]. | ||
| Use JavaScript transducers with the familiar [Underscore.js][1] API with extra goodies like [lazy generators and callback processes][4]. | ||
| If you are not familiar with transducers, check out [Transducers Explained][3]. | ||
| Too much API for you? Just grab what you need from the [transduce][14] libraries, which underscore-transudcer is based. Want more? Check out [underarm][18] for asynchronous (reactive) extensions. | ||
| ## Install | ||
| ```bash | ||
| $ npm install underscore-transducer | ||
| $ bower install underscore-transducer | ||
| ``` | ||
| ### Browser | ||
| Install browser version of [transducers-js][10] or [transducers.js][11] and include with `<script>`. Then include the browser version of underscore-transducer. | ||
@@ -18,19 +24,5 @@ * [Development][12] | ||
| ### Node.js | ||
| Library depends on either [transducers-js][10] or [transducers.js][11]. It is your choice. Must `npm install` either one and it will be detected automatically. | ||
| Checkout other [builds][19] that optionally bundle custom build of lodash and base versions without extensions. | ||
| Using transducers-js: | ||
| ```bash | ||
| $ npm install transducers-js | ||
| $ npm install underscore-transducer | ||
| ``` | ||
| Using transducers.js: | ||
| ```bash | ||
| $ npm install transducers.js | ||
| $ npm install underscore-transducer | ||
| ``` | ||
| If both are installed, prefers transducers-js by default. If you need to override this (maybe you want to test against both), you can change the implementation using the `TRANSDUCE_IMPL` environment variable. | ||
| ### Transducers | ||
@@ -609,1 +601,3 @@ | ||
| [17]: https://github.com/transduce/transduce-push | ||
| [18]: https://github.com/kevinbeaty/underarm | ||
| [19]: https://github.com/kevinbeaty/underscore-transducer/tree/master/build |
4
-33.33%46891
-0.94%601
-0.99%+ Added
- Removed
Updated
Updated
Updated
Updated
Updated
Updated