mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
891d0482c6 |
@@ -1,4 +1,4 @@
|
||||
# lodash-es v3.0.0
|
||||
# lodash-es v3.0.1
|
||||
|
||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [ES](https://people.mozilla.org/~jorendorff/es6-draft.html) modules.
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ import thru from './thru';
|
||||
function wrapperReverse() {
|
||||
var value = this.__wrapped__;
|
||||
if (value instanceof LazyWrapper) {
|
||||
if (this.__actions__.length) {
|
||||
value = new LazyWrapper(this);
|
||||
}
|
||||
return new LodashWrapper(value.reverse());
|
||||
}
|
||||
return this.thru(function(value) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import isArray from '../lang/isArray';
|
||||
* @returns {Array|Object|string} Returns `collection`.
|
||||
* @example
|
||||
*
|
||||
* _([1, 2, 3]).forEach(function(n) { console.log(n); });
|
||||
* _([1, 2, 3]).forEach(function(n) { console.log(n); }).value();
|
||||
* // => logs each value from left to right and returns the array
|
||||
*
|
||||
* _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(n, key) { console.log(n, key); });
|
||||
|
||||
@@ -35,7 +35,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
* // => 'FRED'
|
||||
*
|
||||
* // modifying the result cache
|
||||
* upperCase.cache.set('fred, 'BARNEY');
|
||||
* upperCase.cache.set('fred', 'BARNEY');
|
||||
* upperCase('fred');
|
||||
* // => 'BARNEY'
|
||||
*
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import baseMatches from './baseMatches';
|
||||
import baseProperty from './baseProperty';
|
||||
import baseToString from './baseToString';
|
||||
import bindCallback from './bindCallback';
|
||||
import identity from '../utility/identity';
|
||||
import isBindable from './isBindable';
|
||||
@@ -28,7 +27,7 @@ function baseCallback(func, thisArg, argCount) {
|
||||
// Handle "_.property" and "_.matches" style callback shorthands.
|
||||
return type == 'object'
|
||||
? baseMatches(func, !argCount)
|
||||
: baseProperty(argCount ? baseToString(func) : func);
|
||||
: baseProperty(func + '');
|
||||
}
|
||||
|
||||
export default baseCallback;
|
||||
|
||||
@@ -47,6 +47,9 @@ function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stack
|
||||
? toPlainObject(value)
|
||||
: (isPlainObject(value) ? value : {});
|
||||
}
|
||||
else {
|
||||
isCommon = false;
|
||||
}
|
||||
}
|
||||
// Add the source value to the stack of traversed objects and associate
|
||||
// it with its merged value.
|
||||
|
||||
@@ -19,7 +19,8 @@ function baseSlice(array, start, end) {
|
||||
if (end < 0) {
|
||||
end += length;
|
||||
}
|
||||
length = start > end ? 0 : (end - start);
|
||||
length = start > end ? 0 : (end - start) >>> 0;
|
||||
start >>>= 0;
|
||||
|
||||
var result = Array(length);
|
||||
while (++index < length) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import baseToString from './baseToString';
|
||||
import repeat from '../string/repeat';
|
||||
import root from './root';
|
||||
|
||||
@@ -27,7 +26,7 @@ function createPad(string, length, chars) {
|
||||
return '';
|
||||
}
|
||||
var padLength = length - strLength;
|
||||
chars = chars == null ? ' ' : baseToString(chars);
|
||||
chars = chars == null ? ' ' : (chars + '');
|
||||
return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import baseToString from './baseToString';
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var boolTag = '[object Boolean]',
|
||||
dateTag = '[object Date]',
|
||||
@@ -43,7 +41,7 @@ function equalByTag(object, other, tag) {
|
||||
case stringTag:
|
||||
// Coerce regexes to strings and treat strings primitives and string
|
||||
// objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
|
||||
return object == baseToString(other);
|
||||
return object == (other + '');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,14 @@ import LazyWrapper from './LazyWrapper';
|
||||
* @returns {Object} Returns the new reversed `LazyWrapper` object.
|
||||
*/
|
||||
function lazyReverse() {
|
||||
var filtered = this.filtered,
|
||||
result = filtered ? new LazyWrapper(this) : this.clone();
|
||||
|
||||
result.dir = this.dir * -1;
|
||||
result.filtered = filtered;
|
||||
if (this.filtered) {
|
||||
var result = new LazyWrapper(this);
|
||||
result.dir = -1;
|
||||
result.filtered = true;
|
||||
} else {
|
||||
result = this.clone();
|
||||
result.dir *= -1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ function lazyValue() {
|
||||
}
|
||||
var dir = this.dir,
|
||||
isRight = dir < 0,
|
||||
length = array.length,
|
||||
view = getView(0, length, this.views),
|
||||
view = getView(0, array.length, this.views),
|
||||
start = view.start,
|
||||
end = view.end,
|
||||
length = end - start,
|
||||
dropCount = this.dropCount,
|
||||
takeCount = nativeMin(end - start, this.takeCount - dropCount),
|
||||
takeCount = nativeMin(length, this.takeCount - dropCount),
|
||||
index = isRight ? end : start - 1,
|
||||
iteratees = this.iteratees,
|
||||
iterLength = iteratees ? iteratees.length : 0,
|
||||
@@ -65,7 +65,7 @@ function lazyValue() {
|
||||
result[resIndex++] = value;
|
||||
}
|
||||
}
|
||||
return isRight ? result.reverse() : result;
|
||||
return result;
|
||||
}
|
||||
|
||||
export default lazyValue;
|
||||
|
||||
11
lodash.js
11
lodash.js
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @license
|
||||
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
|
||||
* lodash 3.0.1 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize modern exports="es" -o ./`
|
||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
|
||||
@@ -37,7 +37,7 @@ import support from './support';
|
||||
import thru from './chain/thru';
|
||||
|
||||
/** Used as the semantic version number. */
|
||||
var VERSION = '3.0.0';
|
||||
var VERSION = '3.0.1';
|
||||
|
||||
/** Used to indicate the type of lazy iteratees. */
|
||||
var LAZY_FILTER_FLAG = 0,
|
||||
@@ -416,7 +416,8 @@ LazyWrapper.prototype.slice = function(start, end) {
|
||||
|
||||
// Add `LazyWrapper` methods to `lodash.prototype`.
|
||||
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
||||
var retUnwrapped = /^(?:first|last)$/.test(methodName);
|
||||
var lodashFunc = lodash[methodName],
|
||||
retUnwrapped = /^(?:first|last)$/.test(methodName);
|
||||
|
||||
lodash.prototype[methodName] = function() {
|
||||
var value = this.__wrapped__,
|
||||
@@ -429,12 +430,12 @@ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
||||
if (retUnwrapped && !chainAll) {
|
||||
return onlyLazy
|
||||
? func.call(value)
|
||||
: lodash[methodName](this.value());
|
||||
: lodashFunc.call(lodash, this.value());
|
||||
}
|
||||
var interceptor = function(value) {
|
||||
var otherArgs = [value];
|
||||
push.apply(otherArgs, args);
|
||||
return lodash[methodName].apply(lodash, otherArgs);
|
||||
return lodashFunc.apply(lodash, otherArgs);
|
||||
};
|
||||
if (isLazy || isArray(value)) {
|
||||
var wrapper = onlyLazy ? value : new LazyWrapper(this),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lodash-es",
|
||||
"version": "3.0.0",
|
||||
"version": "3.0.1",
|
||||
"description": "The modern build of lodash exported as ES modules.",
|
||||
"homepage": "https://lodash.com/custom-builds",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -2,7 +2,7 @@ import createCompounder from '../internal/createCompounder';
|
||||
|
||||
/**
|
||||
* Converts `string` to kebab case (a.k.a. spinal case).
|
||||
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Computers) for
|
||||
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) for
|
||||
* more details.
|
||||
*
|
||||
* @static
|
||||
|
||||
Reference in New Issue
Block a user