Add array chaining tests and fix _#unshift.

This commit is contained in:
John-David Dalton
2014-09-18 09:43:03 -07:00
parent d13f8749d4
commit 995ec2b104
2 changed files with 198 additions and 100 deletions

View File

@@ -9623,9 +9623,9 @@
// add `Array.prototype` functions
arrayEach(['concat', 'join', 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
var arrayFunc = arrayProto[methodName],
retUnwrapped = /join|pop|shift/.test(methodName),
chainName = /push|reverse|sort|unshift/.test(methodName) ? 'tap' : 'thru',
fixObjects = !support.spliceObjects && /pop|shift|splice/.test(methodName);
retUnwrapped = /^(?:join|pop|shift)$/.test(methodName),
chainName = /^(?:push|reverse|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
fixObjects = !support.spliceObjects && /^(?:pop|shift|splice)$/.test(methodName);
// avoid array-like object bugs with `Array#shift` and `Array#splice` in
// IE < 9, Firefox < 10, Narwhal, and RingoJS