Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

underscore-transducer

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

underscore-transducer - npm Package Compare versions

Comparing version
0.4.1
to
0.4.2
+2
-1
.jshintrc
{
"node":true,
"strict":true
"strict":true,
"asi":true
}

@@ -1,4 +0,5 @@

"use strict";
var array = require('transduce/array'), undef;
'use strict'
var forEach = require('transduce/array/forEach')
module.exports = function(_r){

@@ -8,4 +9,4 @@ // Array Functions

_r.mixin({
forEach: array.forEach,
each: array.forEach,
forEach: forEach,
each: forEach,
find: find,

@@ -20,19 +21,20 @@ detect: find,

findWhere: findWhere,
push: array.push,
unshift: array.unshift,
push: require('transduce/array/push'),
unshift: require('transduce/array/unshift'),
at: at,
slice: array.slice,
initial: array.initial,
slice: require('transduce/array/slice'),
initial: require('transduce/array/initial'),
last: last
});
})
var iteratee = _r.iteratee,
resolveSingleValue = _r.resolveSingleValue,
_ = _r._;
_ = _r._
// Return the first value which passes a truth test. Aliased as `detect`.
var _find = require('transduce/array/find')
function find(predicate) {
/*jshint validthis:true*/
resolveSingleValue(this);
return array.find(iteratee(predicate));
resolveSingleValue(this)
return _find(iteratee(predicate))
}

@@ -42,6 +44,7 @@

// Aliased as `all`.
var _every = require('transduce/array/every')
function every(predicate) {
/*jshint validthis:true*/
resolveSingleValue(this);
return array.every(iteratee(predicate));
resolveSingleValue(this)
return _every(iteratee(predicate))
}

@@ -51,6 +54,7 @@

// Aliased as `any`.
var _some = require('transduce/array/some')
function some(predicate) {
/*jshint validthis:true*/
resolveSingleValue(this);
return array.some(iteratee(predicate));
resolveSingleValue(this)
return _some(iteratee(predicate))
}

@@ -62,3 +66,3 @@

/*jshint validthis:true*/
return some.call(this, function(x){ return x === target; });
return some.call(this, function(x){ return x === target })
}

@@ -70,10 +74,11 @@

/*jshint validthis:true*/
return find.call(this, _.matches(attrs));
return find.call(this, _.matches(attrs))
}
// Retrieves the value at the given index. Resolves as single value.
var _slice = require('transduce/array/slice')
function at(idx){
/*jshint validthis:true*/
resolveSingleValue(this);
return array.slice(idx, idx+1);
resolveSingleValue(this)
return _slice(idx, idx+1)
}

@@ -83,9 +88,10 @@

// Note that no items will be sent until completion.
var _last = require('transduce/array/last')
function last(n) {
if(n === undef){
if(n === void 0){
/*jshint validthis:true*/
resolveSingleValue(this);
resolveSingleValue(this)
}
return array.last(n);
return _last(n)
}
};
}

@@ -1,58 +0,58 @@

"use strict";
var tr = require('transduce'),
merge = tr.objectMerge,
undef;
'use strict'
var merge = require('transduce/util/objectMerge'),
isArray = require('transduce/util/isArray'),
isFunction = require('transduce/util/isFunction')
var _r = function(obj, transform) {
if (_r.as(obj)){
if(transform === undef){
return obj;
if(transform === void 0){
return obj
}
var wrappedFns = obj._wrappedFns.slice();
wrappedFns.push(transform);
var copy = new _r(obj._wrapped, wrappedFns);
copy._opts = merge({}, obj._opts);
return copy;
var wrappedFns = obj._wrappedFns.slice()
wrappedFns.push(transform)
var copy = new _r(obj._wrapped, wrappedFns)
copy._opts = merge({}, obj._opts)
return copy
}
if (!(_r.as(this))) return new _r(obj, transform);
if (!(_r.as(this))) return new _r(obj, transform)
if(_r.as(transform)){
this._opts = merge({}, transform._opts);
transform = transform._wrappedFns;
this._opts = merge({}, transform._opts)
transform = transform._wrappedFns
} else {
this._opts = {};
this._opts = {}
}
if(tr.isFunction(transform)){
this._wrappedFns = [transform];
} else if(tr.isArray(transform)){
this._wrappedFns = transform;
if(isFunction(transform)){
this._wrappedFns = [transform]
} else if(isArray(transform)){
this._wrappedFns = transform
} else {
this._wrappedFns = [];
this._wrappedFns = []
}
this._wrapped = _r.wrap.call(this, obj);
};
this._wrapped = _r.wrap.call(this, obj)
}
_r.VERSION = '0.3.2';
_r.VERSION = '0.4.2'
// Export for browser or Common-JS
// Save the previous value of the `_r` variable.
var previous_r, root;
var previous_r, root
if(typeof window !== 'undefined'){
/*global window*/
var root = window;
previous_r = root._r;
root._r = _r;
_r._ = root._;
var root = window
previous_r = root._r
root._r = _r
_r._ = root._
} else {
root = {};
root = {}
}
module.exports = _r;
module.exports = _r
// Returns the value if it is a chained transformation, else null
_r.as = function(value){
return value instanceof _r ? value : null;
};
return value instanceof _r ? value : null
}

@@ -62,5 +62,5 @@ // Run Underscore.js in *noConflict* mode, returning the `_` variable to its

_r.noConflict = function() {
root._r = previous_r;
return this;
};
root._r = previous_r
return this
}

@@ -70,22 +70,22 @@ // Returns a new chained instance using current transformation, but

_r.prototype.withSource = function(obj){
return _r(obj, this);
};
return _r(obj, this)
}
// Add your own custom transducers to the Underscore.transducer object.
_r.mixin = function(obj) {
var name, fn;
var name, fn
for(name in obj){
fn = obj[name];
fn = obj[name]
if(typeof fn === 'function'){
_r[name] = fn;
_r.prototype[name] = _method(fn);
_r[name] = fn
_r.prototype[name] = _method(fn)
}
}
};
}
function _method(func){
return function() {
var method = func.apply(this, arguments);
return _r(this, method);
};
var method = func.apply(this, arguments)
return _r(this, method)
}
}

@@ -1,5 +0,3 @@

"use strict";
var tr = require('transduce'),
dispatcher = require('redispatch'),
undef;
'use strict'
var dispatcher = require('redispatch')

@@ -10,3 +8,3 @@ module.exports = function(_r){

// sentinel to ignore wrapped objects (maintain only last item)
IGNORE = _r.IGNORE = {};
IGNORE = _r.IGNORE = {}

@@ -21,36 +19,44 @@ // Transducer Functions

reduce = _r.reduce = dispatcher(),
_reduce = require('transduce/reduce'),
_unreduced = require('transduce/util/unreduced'),
transduce = _r.transduce = dispatcher(),
_transduce = require('transduce/transduce'),
into = _r.into = dispatcher(),
transducer = _r.transducer = dispatcher(),
iterator = _r.iterator = dispatcher(),
_iterator = require('transduce/iterator/iterator'),
toArray = _r.toArray = dispatcher(),
iteratee = _r.iteratee = dispatcher();
_r.resolveSingleValue = resolveSingleValue;
_r.resolveMultipleValues = resolveMultipleValues;
_r.reduced = tr.reduced;
_r.isReduced = tr.isReduced;
_r.foldl = reduce;
_r.inject = reduce;
_r.deref = unwrap;
_r.conj = append;
_r.conjoin = append;
_r.dispatch = dispatch;
_toArray = require('transduce/toArray'),
iteratee = _r.iteratee = dispatcher()
_r.resolveSingleValue = resolveSingleValue
_r.resolveMultipleValues = resolveMultipleValues
_r.reduced = require('transduce/util/reduced')
_r.isReduced = require('transduce/util/isReduced')
_r.foldl = reduce
_r.inject = reduce
_r.deref = unwrap
_r.conj = append
_r.conjoin = append
_r.dispatch = dispatch
_r.compose = tr.compose;
_r.isIterable = tr.isIterable;
_r.isIterator = tr.isIterator;
_r.iterable = tr.iterable;
_r.isTransformer = tr.isTransformer;
_r.transformer = tr.transformer;
_r.protocols = tr.protocols;
_r.isFunction = tr.isFunction;
_r.isArray = tr.isArray;
_r.isString = tr.isString;
_r.isRegExp = tr.isRegExp;
_r.isNumber = tr.isNumber;
_r.isUndefined = tr.isUndefined;
_r.arrayPush = tr.arrayPush;
_r.objectMerge = tr.objectMerge;
_r.stringAppend = tr.stringAppend;
_r.identity = tr.identity;
var compose = _r.compose = require('transduce/util/compose')
_r.isIterable = require('transduce/iterator/isIterable')
_r.isIterator = require('transduce/iterator/isIterator')
_r.iterable = require('transduce/iterator/iterable')
_r.isTransformer = require('transduce/transformer/isTransformer')
_r.transformer = require('transduce/transformer/transformer')
_r.protocols = {
iterator: require('transduce/iterator/symbol'),
transformer: require('transduce/transformer/symbol')
}
_r.isFunction = require('transduce/util/isFunction')
var isArray = _r.isArray = require('transduce/util/isArray')
var isString = _r.isString = require('transduce/util/isString')
_r.isRegExp = require('transduce/util/isRegExp')
_r.isNumber = require('transduce/util/isNumber')
_r.isUndefined = require('transduce/util/isUndefined')
_r.arrayPush = require('transduce/util/arrayPush')
_r.objectMerge = require('transduce/util/objectMerge')
_r.stringAppend = require('transduce/util/stringAppend')
var identity = _r.identity = require('transduce/util/identity')

@@ -66,12 +72,12 @@

if(!self._opts.resolveSingleValue){
return self.into();
return self.into()
}
var ret = self.into(IGNORE);
return ret === IGNORE ? undef : ret;
});
var ret = self.into(IGNORE)
return ret === IGNORE ? void 0 : ret
})
_r.prototype.value = function(){
return value(this);
};
return value(this)
}

@@ -82,3 +88,3 @@ // Helper to mark transducer to expect single value when

function resolveSingleValue(self){
_resolveSingleValue(self, true);
_resolveSingleValue(self, true)
}

@@ -90,3 +96,3 @@

function resolveMultipleValues(self){
_resolveSingleValue(self, false);
_resolveSingleValue(self, false)
}

@@ -96,3 +102,3 @@

if(as(self)){
self._opts.resolveSingleValue = single;
self._opts.resolveSingleValue = single
}

@@ -103,42 +109,42 @@ }

transducer.register(function(self){
var fns = self._wrappedFns;
return fns.length ? tr.compose.apply(null, fns) : tr.identity;
});
var fns = self._wrappedFns
return fns.length ? compose.apply(null, fns) : identity
})
_r.prototype.transducer = _r.prototype.compose = function() {
return transducer(this);
};
return transducer(this)
}
reduce.register(function(xf, init, coll) {
if(as(xf)){
xf = transducer(xf);
xf = transducer(xf)
}
if (coll === null || coll === undef) coll = empty(coll);
return tr.reduce(xf, init, coll);
});
if (coll === null || coll === void 0) coll = empty(coll)
return _reduce(xf, init, coll)
})
// Calls transduce using the chained transformation if function not passed
_r.prototype.reduce = function(init, coll){
if(coll === undef){
coll = this._wrapped;
if(coll === void 0){
coll = this._wrapped
}
return reduce(this, init, coll);
};
return reduce(this, init, coll)
}
transduce.register(function(xf, f, init, coll){
if(as(xf)){
xf = transducer(xf);
xf = transducer(xf)
}
return unwrap(tr.transduce(xf, f, init, coll));
});
return unwrap(_transduce(xf, f, init, coll))
})
// Calls transduce using the chained transformation
_r.prototype.transduce = function(f, init, coll){
if(coll === undef){
coll = this._wrapped;
if(coll === void 0){
coll = this._wrapped
}
return transduce(this, f, init, coll);
};
return transduce(this, f, init, coll)
}

@@ -149,33 +155,33 @@

into.register(function(to, xf, from){
if(from === undef){
from = xf;
xf = undef;
if(from === void 0){
from = xf
xf = void 0
}
if(from === undef){
from = empty();
if(from === void 0){
from = empty()
}
if(as(xf)){
xf = transducer(xf);
xf = transducer(xf)
}
if(to === undef){
to = empty(from);
if(to === void 0){
to = empty(from)
}
if(xf === undef){
return reduce(append, to, from);
if(xf === void 0){
return reduce(append, to, from)
}
return transduce(xf, append, to, from);
});
return transduce(xf, append, to, from)
})
// Calls into using the chained transformation
_r.prototype.into = function(to, from){
if(from === undef){
from = this._wrapped;
if(from === void 0){
from = this._wrapped
}
return into(to, this, from);
};
return into(to, this, from)
}

@@ -185,14 +191,14 @@ // Returns a new collection of the empty value of the from collection

if(as(xf)){
xf = transducer(xf);
xf = transducer(xf)
}
return tr.toArray(xf, from);
});
return _toArray(xf, from)
})
// calls toArray with chained transformation and optional wrapped object
_r.prototype.toArray = function(from){
if(from === undef){
from = this._wrapped;
if(from === void 0){
from = this._wrapped
}
return toArray(this, from);
};
return toArray(this, from)
}

@@ -206,9 +212,9 @@ // Wraps a value used as source for use during chained transformation.

wrap.register(function(value){
if(tr.isString(value)){
value = [value];
} else if(value === null || value === undef){
value = empty();
if(isString(value)){
value = [value]
} else if(value === null || value === void 0){
value = empty()
}
return value;
});
return value
})

@@ -224,6 +230,6 @@ // Unwraps (deref) a possibly wrapped value

if(as(value)){
return value.value();
return value.value()
}
return tr.unreduced(value);
});
return _unreduced(value)
})

@@ -240,3 +246,3 @@ // Returns an iterator that has next function

// dispatched functions can be checked
iterator.register(tr.iterator);
iterator.register(_iterator)

@@ -255,11 +261,11 @@ // Mostly internal function that generates a callback from the given value.

if(as(value)){
return _riteratee(value);
return _riteratee(value)
}
return _.iteratee(value);
});
return _.iteratee(value)
})
function _riteratee(value){
return function(item){
return value.withSource(item).value();
};
return value.withSource(item).value()
}
}

@@ -277,11 +283,11 @@

empty.register(function(obj){
if(obj === undef || tr.isArray(obj) || iterator(obj)){
return []; // array if not specified or from array
if(obj === void 0 || isArray(obj) || iterator(obj)){
return [] // array if not specified or from array
} else if(_.isObject(obj)){
return {}; // object if from object
return {} // object if from object
}
// ignore by default. Default append just maintains last item.
return IGNORE;
});
return IGNORE
})

@@ -297,20 +303,20 @@ // Appends (conjoins) the item to the collection, and returns collection

append.register(function(obj, item){
if(tr.isArray(obj)){
obj.push(item);
return obj;
if(isArray(obj)){
obj.push(item)
return obj
}
// just maintain last item
return item;
});
return item
})
// Reducer that dispatches to empty, unwrap and append
function Dispatch(){}
Dispatch.prototype.init = empty;
Dispatch.prototype.result = unwrap;
Dispatch.prototype.step = append;
Dispatch.prototype.init = empty
Dispatch.prototype.result = unwrap
Dispatch.prototype.step = append
function dispatch(){
return new Dispatch();
return new Dispatch()
}
};
}

@@ -1,6 +0,6 @@

"use strict";
var transduce = require('transduce'), undef;
'use strict'
var symIterator = require('transduce/iterator/symbol')
module.exports = function(_r){
_r.generate = generate;
_r.generate = generate

@@ -10,4 +10,4 @@ // Transduces the current chained object by using the chained trasnformation

_r.prototype.generate = function(callback, callToInit){
return this.withSource(generate(callback, callToInit));
};
return this.withSource(generate(callback, callToInit))
}

@@ -19,14 +19,14 @@ // Creates an (duck typed) iterator that calls the provided next callback repeatedly

function generate(callback, callToInit){
var gen = {};
gen[transduce.protocols.iterator] = function(){
var next = callToInit ? callback() : callback;
var gen = {}
gen[symIterator] = function(){
var next = callToInit ? callback() : callback
return {
next: function(){
var value = next();
return (value === undef) ? {done: true} : {done: false, value: value};
var value = next()
return (value === void 0) ? {done: true} : {done: false, value: value}
}
};
};
return gen;
}
}
return gen
}
};
}

@@ -1,18 +0,17 @@

"use strict";
var undef;
'use strict'
module.exports = function(libs, _r){
var i = 0, len = libs.length, lib;
if(_r === undef){
_r = require('./base');
var i = 0, len = libs.length, lib
if(_r === void 0){
_r = require('./base')
}
for(; i < len; i++){
lib = libs[i];
lib = libs[i]
// only import if included in build
if(typeof lib === 'function'){
lib(_r);
lib(_r)
}
}
return _r;
};
return _r
}

@@ -1,2 +0,2 @@

"use strict";
'use strict'

@@ -10,24 +10,28 @@ // Based on Underscore.js 1.7.0

var tr = require('transduce'), undef;
var isFunction = require('transduce/util/isFunction'),
isArray = require('transduce/util/isArray'),
isString = require('transduce/util/isString'),
isNumber = require('transduce/util/isNumber'),
identity = require('transduce/util/identity')
module.exports = function(_r){
var _ = {};
_r._ = _;
_.iteratee = iteratee;
_.matches = matches;
_.property = property;
};
var _ = {}
_r._ = _
_.iteratee = iteratee
_.matches = matches
_.property = property
}
function iteratee(value){
var f;
var f
if(isNull(value)){
f = tr.identity;
} else if(tr.isFunction(value)){
f = value;
f = identity
} else if(isFunction(value)){
f = value
} else if(isKey(value)){
f = property(value);
f = property(value)
} else {
f = matches(value);
f = matches(value)
}
return f;
return f
}

@@ -37,4 +41,4 @@

return function(value){
return value[key];
};
return value[key]
}
}

@@ -44,36 +48,36 @@

var ps = pairs(attrs),
len = ps.length;
len = ps.length
return function(value){
if(isNull(value)){
return len === 0;
return len === 0
}
var i = 0, p, k, v;
var i = 0, p, k, v
for(; i < len; i++){
p = ps[i];
k = p[0];
v = p[1];
p = ps[i]
k = p[0]
v = p[1]
if(v !== value[k] || !(k in value)){
return false;
return false
}
}
return true;
};
return true
}
}
function isNull(value){
return value === undef || value === null;
return value === void 0 || value === null
}
function isKey(value){
return tr.isString(value) || tr.isNumber(value);
return isString(value) || isNumber(value)
}
function pairs(value){
var key, ps = [];
var key, ps = []
for(key in value){
if(value.hasOwnProperty(key)){
ps.push([key, value[key]]);
ps.push([key, value[key]])
}
}
return ps;
return ps
}

@@ -1,3 +0,4 @@

"use strict";
var math = require('transduce/math'), undef;
'use strict'
var _max = require('transduce/math/max'),
_min = require('transduce/math/min')

@@ -10,6 +11,6 @@ module.exports = function(_r){

min: min
});
})
var iteratee = _r.iteratee,
resolveSingleValue = _r.resolveSingleValue;
resolveSingleValue = _r.resolveSingleValue

@@ -19,4 +20,4 @@ // Return the maximum element (or element-based computation).

/*jshint validthis:true */
resolveSingleValue(this);
return math.max(iteratee(f));
resolveSingleValue(this)
return _max(iteratee(f))
}

@@ -27,5 +28,5 @@

/*jshint validthis:true */
resolveSingleValue(this);
return math.min(iteratee(f));
resolveSingleValue(this)
return _min(iteratee(f))
}
};
}

@@ -1,14 +0,15 @@

"use strict";
var push = require('transduce/push'),
undef;
'use strict'
var tap = require('transduce/push/tap'),
_asCallback = require('transduce/push/asCallback'),
_asyncCallback = require('transduce/push/asyncCallback')
module.exports = function(_r){
_r.mixin({tap: push.tap});
_r.asCallback = asCallback;
_r.asyncCallback = asyncCallback;
_r.mixin({tap: tap})
_r.asCallback = asCallback
_r.asyncCallback = asyncCallback
var as = _r.as,
dispatch = _r.dispatch,
transducer = _r.transducer;
transducer = _r.transducer

@@ -30,15 +31,15 @@ // Creates a callback that starts a transducer process and accepts

if(as(xf)){
xf = transducer(xf);
xf = transducer(xf)
}
var reducer;
if(init !== undef){
reducer = dispatch();
var reducer
if(init !== void 0){
reducer = dispatch()
}
return push.asCallback(xf, reducer);
return _asCallback(xf, reducer)
}
_r.prototype.asCallback = function(init){
return asCallback(this, init);
};
return asCallback(this, init)
}

@@ -60,15 +61,15 @@ // Creates an async callback that starts a transducer process and accepts

if(as(xf)){
xf = transducer(xf);
xf = transducer(xf)
}
var reducer;
if(init !== undef){
reducer = dispatch();
var reducer
if(init !== void 0){
reducer = dispatch()
}
return push.asyncCallback(xf, continuation, reducer);
return _asyncCallback(xf, continuation, reducer)
}
_r.prototype.asyncCallback = function(continuation, init){
return asyncCallback(this, continuation, init);
};
};
return asyncCallback(this, continuation, init)
}
}

@@ -1,14 +0,13 @@

"use strict";
'use strict'
var seq = require('transduce/iterator/sequence'),
symbol = require('transduce/iterator/symbol'),
undef;
symbol = require('transduce/iterator/symbol')
module.exports = function(_r){
// Returns a new collection of the empty value of the from collection
_r.sequence = sequence;
_r.sequence = sequence
function sequence(xf, from){
if(_r.as(xf)){
xf = _r.transducer(xf);
xf = _r.transducer(xf)
}
return seq(xf, from);
return seq(xf, from)
}

@@ -18,11 +17,11 @@

_r.prototype.sequence = function(from){
if(from == undef){
from = this._wrapped;
if(from === void 0){
from = this._wrapped
}
return sequence(this, from);
};
return sequence(this, from)
}
_r.prototype[symbol] = function(){
return _r.iterator(this.sequence());
};
};
return _r.iterator(this.sequence())
}
}

@@ -1,4 +0,2 @@

"use strict";
var undef,
string = require('transduce/string');
'use strict'

@@ -9,15 +7,16 @@ module.exports = function(_r){

_r.mixin({
split: string.split,
split: require('transduce/string/split'),
join: join,
nonEmpty: string.nonEmpty,
lines: string.lines,
chars: string.chars,
words: string.words
});
nonEmpty: require('transduce/string/nonEmpty'),
lines: require('transduce/string/lines'),
chars: require('transduce/string/chars'),
words: require('transduce/string/words')
})
var _join = require('transduce/string/join')
function join(separator){
/*jshint validthis:true */
_r.resolveSingleValue(this);
return string.join(separator);
_r.resolveSingleValue(this)
return _join(separator)
}
};
}

@@ -1,4 +0,3 @@

"use strict";
var transduce = require('transduce'),
slice = Array.prototype.slice, undef;
'use strict'
var slice = Array.prototype.slice

@@ -32,10 +31,13 @@ module.exports = function(_r){

where: where
});
})
var iteratee = _r.iteratee,
_ = _r._;
_ = _r._,
isFunction = require('transduce/util/isFunction'),
identity = require('transduce/util/identity')
// Return the results of applying the iteratee to each element.
var _map = require('transduce/map')
function map(f) {
return transduce.map(iteratee(f));
return _map(iteratee(f))
}

@@ -45,9 +47,11 @@

// Aliased as `select`.
var _filter = require('transduce/filter')
function filter(predicate) {
return transduce.filter(iteratee(predicate));
return _filter(iteratee(predicate))
}
// Return all the elements for which a truth test fails.
var _remove = require('transduce/remove')
function remove(predicate) {
return transduce.remove(iteratee(predicate));
return _remove(iteratee(predicate))
}

@@ -57,16 +61,18 @@

// values in the array. Aliased as `head` and `take`.
var _take = require('transduce/take')
function take(n) {
if(n === undef){
if(n === void 0){
/*jshint validthis:true*/
_r.resolveSingleValue(this);
n = 1;
_r.resolveSingleValue(this)
n = 1
} else {
n = (n > 0) ? n : 0;
n = (n > 0) ? n : 0
}
return transduce.take(n);
return _take(n)
}
// takes items until predicate returns false
var _takeWhile = require('transduce/takeWhile')
function takeWhile(predicate) {
return transduce.takeWhile(iteratee(predicate));
return _takeWhile(iteratee(predicate))
}

@@ -76,10 +82,12 @@

// Passing an **n** will return the rest N values.
var _drop = require('transduce/drop')
function drop(n) {
n = (n === undef) ? 1 : (n > 0) ? n : 0;
return transduce.drop(n);
n = (n === void 0) ? 1 : (n > 0) ? n : 0
return _drop(n)
}
// Drops items while the predicate returns true
var _dropWhile = require('transduce/dropWhile')
function dropWhile(predicate) {
return transduce.dropWhile(iteratee(predicate));
return _dropWhile(iteratee(predicate))
}

@@ -90,4 +98,5 @@

// _r.cat() not _r.cat
var _cat = require('transduce/cat')
function cat(){
return transduce.cat;
return _cat
}

@@ -97,4 +106,5 @@

// Composition of _r.map(f) and _r.cat()
var _mapcat = require('transduce/mapcat')
function mapcat(f){
return transduce.mapcat(iteratee(f));
return _mapcat(iteratee(f))
}

@@ -105,4 +115,5 @@

// Alias chunkAll
var _partitionAll = require('transduce/partitionAll')
function partitionAll(n){
return transduce.partitionAll(n);
return _partitionAll(n)
}

@@ -112,9 +123,11 @@

// changes equality.
var _partitionBy = require('transduce/partitionBy')
function partitionBy(f){
return transduce.partitionBy(iteratee(f));
return _partitionBy(iteratee(f))
}
// Trim out all falsy values from an array.
function compact() {
return filter(_.identity);
return filter(identity)
}

@@ -124,7 +137,7 @@

function invoke(method) {
var args = slice.call(arguments, 2);
var isFunc = transduce.isFunction(method);
var args = slice.call(arguments, 2),
isFunc = isFunction(method)
return map(function(value) {
return (isFunc ? method : value[method]).apply(value, args);
});
return (isFunc ? method : value[method]).apply(value, args)
})
}

@@ -134,3 +147,3 @@

function pluck(key) {
return map(_.property(key));
return map(_.property(key))
}

@@ -141,4 +154,4 @@

function where(attrs) {
return filter(_.matches(attrs));
return filter(_.matches(attrs))
}
};
}

@@ -1,5 +0,4 @@

"use strict";
var tr = require('transduce'),
un = require('transduce/unique'),
undef;
'use strict'
var _unique = require('transduce/unique/unique'),
_dedupe = require('transduce/unique/dedupe')

@@ -12,6 +11,6 @@ module.exports = function(_r){

uniq: unique
});
})
var _ = _r._,
iteratee = _r.iteratee;
iteratee = _r.iteratee

@@ -23,12 +22,12 @@ // Produce a duplicate-free version of the array. If the array has already

if (isSorted !== true && isSorted !== false) {
f = isSorted;
isSorted = false;
f = isSorted
isSorted = false
}
if(isSorted){
return un.dedupe();
return _dedupe()
}
if (f !== undef) f = iteratee(f);
return un.unique(f);
if (f !== void 0) f = iteratee(f)
return _unique(f)
}
};
}
{
"name": "underscore-transducer",
"version": "0.4.1",
"version": "0.4.2",
"description": "Transducers for Underscore",

@@ -27,3 +27,3 @@ "main": "underscore-transducer.js",

"dependencies": {
"transduce": "~0.4.1",
"transduce": "~0.4.2",
"redispatch": "0.0.2"

@@ -30,0 +30,0 @@ },

module.exports = require('./lib/load')([
require('./lib/lodash'),
require('./lib/dispatch'),
require('./lib/transduce')]);
require('./lib/transduce')])

@@ -11,2 +11,2 @@ module.exports = require('./lib/load')([

require('./lib/math'),
require('./lib/string')]);
require('./lib/string')])