mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 01:17:50 +00:00
Add lodash.prototype methods that return non-wrapped values.
Former-commit-id: b7ecb8c91ec9647827a80a297b966639c6580ef0
This commit is contained in:
50
test/test.js
50
test/test.js
@@ -1915,7 +1915,7 @@
|
||||
wrapped.shift();
|
||||
|
||||
deepEqual(wrapped.keys().value(), ['length']);
|
||||
equal(wrapped.first().value(), undefined);
|
||||
equal(wrapped.first(), undefined);
|
||||
});
|
||||
}());
|
||||
|
||||
@@ -1929,7 +1929,7 @@
|
||||
wrapped.splice(0, 1);
|
||||
|
||||
deepEqual(wrapped.keys().value(), ['length']);
|
||||
equal(wrapped.first().value(), undefined);
|
||||
equal(wrapped.first(), undefined);
|
||||
});
|
||||
}());
|
||||
|
||||
@@ -1957,6 +1957,52 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash(...) methods returning non-wrapped values');
|
||||
|
||||
(function() {
|
||||
var array = [1, 2, 3];
|
||||
|
||||
var funcs = [
|
||||
'contains',
|
||||
'every',
|
||||
'find',
|
||||
'first',
|
||||
'has',
|
||||
'isArguments',
|
||||
'isArray',
|
||||
'isBoolean',
|
||||
'isDate',
|
||||
'isElement',
|
||||
'isEmpty',
|
||||
'isEqual',
|
||||
'isFinite',
|
||||
'isFunction',
|
||||
'isNaN',
|
||||
'isNull',
|
||||
'isNumber',
|
||||
'isObject',
|
||||
'isPlainObject',
|
||||
'isRegExp',
|
||||
'isString',
|
||||
'isUndefined',
|
||||
'last',
|
||||
'reduce',
|
||||
'reduceRight',
|
||||
'some'
|
||||
];
|
||||
|
||||
_.each(funcs, function(methodName) {
|
||||
test('_.' + methodName + ' should return non-wrapped values', function() {
|
||||
var func = _[methodName],
|
||||
result = methodName == 'reduceRight' ? func(array, _.identity) : func;
|
||||
|
||||
notEqual(typeof result, 'object', '_.' + methodName + ' returns non-wrapped values');
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash methods');
|
||||
|
||||
(function() {
|
||||
|
||||
Reference in New Issue
Block a user