Browse Source

Merge pull request #572 in VISUAL/fineui from ~IMP/fineui_fui:master to master

* commit 'e5970963ebe78da3f3bb309989d577f91700d683':
  移动端utils方法
es6
imp 6 years ago
parent
commit
24579da086
  1. 97
      dist/bundle.js
  2. 97
      dist/core.js
  3. 97
      dist/fineui.js
  4. 97
      dist/utils.js
  5. 2
      lodash.md
  6. 758
      package-lock.json
  7. 8
      src/core/base.js
  8. 89
      src/core/lodash.js

97
dist/bundle.js vendored

@ -9613,7 +9613,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
})( window );/** })( window );/**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -10333,6 +10333,39 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return cache.has(key); return cache.has(key);
} }
/**
* Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the first unmatched string symbol.
*/
function charsStartIndex(strSymbols, chrSymbols) {
var index = -1,
length = strSymbols.length;
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
/**
* Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the last unmatched string symbol.
*/
function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
/** /**
* Gets the number of `placeholder` occurrences in `array`. * Gets the number of `placeholder` occurrences in `array`.
* *
@ -13053,6 +13086,21 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return isKey(value, object) ? [value] : stringToPath(toString(value)); return isKey(value, object) ? [value] : stringToPath(toString(value));
} }
/**
* Casts `array` to a slice if it's needed.
*
* @private
* @param {Array} array The array to inspect.
* @param {number} start The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the cast slice.
*/
function castSlice(array, start, end) {
var length = array.length;
end = end === undefined ? length : end;
return (!start && end >= length) ? array : baseSlice(array, start, end);
}
/** /**
* Creates a clone of `buffer`. * Creates a clone of `buffer`.
* *
@ -18836,6 +18884,44 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
: string; : string;
} }
/**
* Removes leading and trailing whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
* _.trim(' abc ');
* // => 'abc'
*
* _.trim('-_-abc-_-', '_-');
* // => 'abc'
*
* _.map([' foo ', ' bar '], _.trim);
* // => ['foo', 'bar']
*/
function trim(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined)) {
return string.replace(reTrim, '');
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string),
chrSymbols = stringToArray(chars),
start = charsStartIndex(strSymbols, chrSymbols),
end = charsEndIndex(strSymbols, chrSymbols) + 1;
return castSlice(strSymbols, start, end).join('');
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -19356,6 +19442,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.result = result; lodash.result = result;
lodash.size = size; lodash.size = size;
lodash.some = some; lodash.some = some;
lodash.trim = trim;
lodash.uniqueId = uniqueId; lodash.uniqueId = uniqueId;
// Add aliases. // Add aliases.
@ -20144,8 +20231,8 @@ if (!window.BI) {
return BI.isString(obj) && !BI.isEmptyString(obj); return BI.isString(obj) && !BI.isEmptyString(obj);
}, },
isWindow: function () { isWindow: function (obj) {
return $.isWindow.apply($, arguments); return obj != null && obj == obj.window;
} }
}); });
@ -20428,7 +20515,7 @@ if (!window.BI) {
}, },
isNumeric: function (number) { isNumeric: function (number) {
return $.isNumeric(number); return !isNaN( parseFloat(number) ) && isFinite( number );
}, },
isFloat: function (number) { isFloat: function (number) {
@ -20473,7 +20560,7 @@ if (!window.BI) {
// 字符串相关方法 // 字符串相关方法
_.extend(BI, { _.extend(BI, {
trim: function () { trim: function () {
return $.trim.apply($, arguments); return _.trim.apply(_, arguments);
}, },
toUpperCase: function (string) { toUpperCase: function (string) {

97
dist/core.js vendored

@ -9613,7 +9613,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
})( window );/** })( window );/**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -10333,6 +10333,39 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return cache.has(key); return cache.has(key);
} }
/**
* Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the first unmatched string symbol.
*/
function charsStartIndex(strSymbols, chrSymbols) {
var index = -1,
length = strSymbols.length;
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
/**
* Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the last unmatched string symbol.
*/
function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
/** /**
* Gets the number of `placeholder` occurrences in `array`. * Gets the number of `placeholder` occurrences in `array`.
* *
@ -13053,6 +13086,21 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return isKey(value, object) ? [value] : stringToPath(toString(value)); return isKey(value, object) ? [value] : stringToPath(toString(value));
} }
/**
* Casts `array` to a slice if it's needed.
*
* @private
* @param {Array} array The array to inspect.
* @param {number} start The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the cast slice.
*/
function castSlice(array, start, end) {
var length = array.length;
end = end === undefined ? length : end;
return (!start && end >= length) ? array : baseSlice(array, start, end);
}
/** /**
* Creates a clone of `buffer`. * Creates a clone of `buffer`.
* *
@ -18836,6 +18884,44 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
: string; : string;
} }
/**
* Removes leading and trailing whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
* _.trim(' abc ');
* // => 'abc'
*
* _.trim('-_-abc-_-', '_-');
* // => 'abc'
*
* _.map([' foo ', ' bar '], _.trim);
* // => ['foo', 'bar']
*/
function trim(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined)) {
return string.replace(reTrim, '');
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string),
chrSymbols = stringToArray(chars),
start = charsStartIndex(strSymbols, chrSymbols),
end = charsEndIndex(strSymbols, chrSymbols) + 1;
return castSlice(strSymbols, start, end).join('');
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -19356,6 +19442,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.result = result; lodash.result = result;
lodash.size = size; lodash.size = size;
lodash.some = some; lodash.some = some;
lodash.trim = trim;
lodash.uniqueId = uniqueId; lodash.uniqueId = uniqueId;
// Add aliases. // Add aliases.
@ -20144,8 +20231,8 @@ if (!window.BI) {
return BI.isString(obj) && !BI.isEmptyString(obj); return BI.isString(obj) && !BI.isEmptyString(obj);
}, },
isWindow: function () { isWindow: function (obj) {
return $.isWindow.apply($, arguments); return obj != null && obj == obj.window;
} }
}); });
@ -20428,7 +20515,7 @@ if (!window.BI) {
}, },
isNumeric: function (number) { isNumeric: function (number) {
return $.isNumeric(number); return !isNaN( parseFloat(number) ) && isFinite( number );
}, },
isFloat: function (number) { isFloat: function (number) {
@ -20473,7 +20560,7 @@ if (!window.BI) {
// 字符串相关方法 // 字符串相关方法
_.extend(BI, { _.extend(BI, {
trim: function () { trim: function () {
return $.trim.apply($, arguments); return _.trim.apply(_, arguments);
}, },
toUpperCase: function (string) { toUpperCase: function (string) {

97
dist/fineui.js vendored

@ -9834,7 +9834,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
})( window );/** })( window );/**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -10554,6 +10554,39 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return cache.has(key); return cache.has(key);
} }
/**
* Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the first unmatched string symbol.
*/
function charsStartIndex(strSymbols, chrSymbols) {
var index = -1,
length = strSymbols.length;
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
/**
* Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the last unmatched string symbol.
*/
function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
/** /**
* Gets the number of `placeholder` occurrences in `array`. * Gets the number of `placeholder` occurrences in `array`.
* *
@ -13274,6 +13307,21 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return isKey(value, object) ? [value] : stringToPath(toString(value)); return isKey(value, object) ? [value] : stringToPath(toString(value));
} }
/**
* Casts `array` to a slice if it's needed.
*
* @private
* @param {Array} array The array to inspect.
* @param {number} start The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the cast slice.
*/
function castSlice(array, start, end) {
var length = array.length;
end = end === undefined ? length : end;
return (!start && end >= length) ? array : baseSlice(array, start, end);
}
/** /**
* Creates a clone of `buffer`. * Creates a clone of `buffer`.
* *
@ -19057,6 +19105,44 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
: string; : string;
} }
/**
* Removes leading and trailing whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
* _.trim(' abc ');
* // => 'abc'
*
* _.trim('-_-abc-_-', '_-');
* // => 'abc'
*
* _.map([' foo ', ' bar '], _.trim);
* // => ['foo', 'bar']
*/
function trim(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined)) {
return string.replace(reTrim, '');
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string),
chrSymbols = stringToArray(chars),
start = charsStartIndex(strSymbols, chrSymbols),
end = charsEndIndex(strSymbols, chrSymbols) + 1;
return castSlice(strSymbols, start, end).join('');
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -19577,6 +19663,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.result = result; lodash.result = result;
lodash.size = size; lodash.size = size;
lodash.some = some; lodash.some = some;
lodash.trim = trim;
lodash.uniqueId = uniqueId; lodash.uniqueId = uniqueId;
// Add aliases. // Add aliases.
@ -20365,8 +20452,8 @@ if (!window.BI) {
return BI.isString(obj) && !BI.isEmptyString(obj); return BI.isString(obj) && !BI.isEmptyString(obj);
}, },
isWindow: function () { isWindow: function (obj) {
return $.isWindow.apply($, arguments); return obj != null && obj == obj.window;
} }
}); });
@ -20649,7 +20736,7 @@ if (!window.BI) {
}, },
isNumeric: function (number) { isNumeric: function (number) {
return $.isNumeric(number); return !isNaN( parseFloat(number) ) && isFinite( number );
}, },
isFloat: function (number) { isFloat: function (number) {
@ -20694,7 +20781,7 @@ if (!window.BI) {
// 字符串相关方法 // 字符串相关方法
_.extend(BI, { _.extend(BI, {
trim: function () { trim: function () {
return $.trim.apply($, arguments); return _.trim.apply(_, arguments);
}, },
toUpperCase: function (string) { toUpperCase: function (string) {

97
dist/utils.js vendored

@ -1,7 +1,7 @@
/** /**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -721,6 +721,39 @@
return cache.has(key); return cache.has(key);
} }
/**
* Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the first unmatched string symbol.
*/
function charsStartIndex(strSymbols, chrSymbols) {
var index = -1,
length = strSymbols.length;
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
/**
* Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the last unmatched string symbol.
*/
function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
/** /**
* Gets the number of `placeholder` occurrences in `array`. * Gets the number of `placeholder` occurrences in `array`.
* *
@ -3441,6 +3474,21 @@
return isKey(value, object) ? [value] : stringToPath(toString(value)); return isKey(value, object) ? [value] : stringToPath(toString(value));
} }
/**
* Casts `array` to a slice if it's needed.
*
* @private
* @param {Array} array The array to inspect.
* @param {number} start The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the cast slice.
*/
function castSlice(array, start, end) {
var length = array.length;
end = end === undefined ? length : end;
return (!start && end >= length) ? array : baseSlice(array, start, end);
}
/** /**
* Creates a clone of `buffer`. * Creates a clone of `buffer`.
* *
@ -9224,6 +9272,44 @@
: string; : string;
} }
/**
* Removes leading and trailing whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
* _.trim(' abc ');
* // => 'abc'
*
* _.trim('-_-abc-_-', '_-');
* // => 'abc'
*
* _.map([' foo ', ' bar '], _.trim);
* // => ['foo', 'bar']
*/
function trim(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined)) {
return string.replace(reTrim, '');
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string),
chrSymbols = stringToArray(chars),
start = charsStartIndex(strSymbols, chrSymbols),
end = charsEndIndex(strSymbols, chrSymbols) + 1;
return castSlice(strSymbols, start, end).join('');
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -9744,6 +9830,7 @@
lodash.result = result; lodash.result = result;
lodash.size = size; lodash.size = size;
lodash.some = some; lodash.some = some;
lodash.trim = trim;
lodash.uniqueId = uniqueId; lodash.uniqueId = uniqueId;
// Add aliases. // Add aliases.
@ -11369,8 +11456,8 @@ if (!window.BI) {
return BI.isString(obj) && !BI.isEmptyString(obj); return BI.isString(obj) && !BI.isEmptyString(obj);
}, },
isWindow: function () { isWindow: function (obj) {
return $.isWindow.apply($, arguments); return obj != null && obj == obj.window;
} }
}); });
@ -11653,7 +11740,7 @@ if (!window.BI) {
}, },
isNumeric: function (number) { isNumeric: function (number) {
return $.isNumeric(number); return !isNaN( parseFloat(number) ) && isFinite( number );
}, },
isFloat: function (number) { isFloat: function (number) {
@ -11698,7 +11785,7 @@ if (!window.BI) {
// 字符串相关方法 // 字符串相关方法
_.extend(BI, { _.extend(BI, {
trim: function () { trim: function () {
return $.trim.apply($, arguments); return _.trim.apply(_, arguments);
}, },
toUpperCase: function (string) { toUpperCase: function (string) {

2
lodash.md

@ -1 +1 @@
lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim"

758
package-lock.json generated

File diff suppressed because it is too large Load Diff

8
src/core/base.js

@ -521,8 +521,8 @@ if (!window.BI) {
return BI.isString(obj) && !BI.isEmptyString(obj); return BI.isString(obj) && !BI.isEmptyString(obj);
}, },
isWindow: function () { isWindow: function (obj) {
return $.isWindow.apply($, arguments); return obj != null && obj == obj.window;
} }
}); });
@ -805,7 +805,7 @@ if (!window.BI) {
}, },
isNumeric: function (number) { isNumeric: function (number) {
return $.isNumeric(number); return !isNaN( parseFloat(number) ) && isFinite( number );
}, },
isFloat: function (number) { isFloat: function (number) {
@ -850,7 +850,7 @@ if (!window.BI) {
// 字符串相关方法 // 字符串相关方法
_.extend(BI, { _.extend(BI, {
trim: function () { trim: function () {
return $.trim.apply($, arguments); return _.trim.apply(_, arguments);
}, },
toUpperCase: function (string) { toUpperCase: function (string) {

89
src/core/lodash.js

@ -1,7 +1,7 @@
/** /**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -721,6 +721,39 @@
return cache.has(key); return cache.has(key);
} }
/**
* Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the first unmatched string symbol.
*/
function charsStartIndex(strSymbols, chrSymbols) {
var index = -1,
length = strSymbols.length;
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
/**
* Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the last unmatched string symbol.
*/
function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
/** /**
* Gets the number of `placeholder` occurrences in `array`. * Gets the number of `placeholder` occurrences in `array`.
* *
@ -3441,6 +3474,21 @@
return isKey(value, object) ? [value] : stringToPath(toString(value)); return isKey(value, object) ? [value] : stringToPath(toString(value));
} }
/**
* Casts `array` to a slice if it's needed.
*
* @private
* @param {Array} array The array to inspect.
* @param {number} start The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the cast slice.
*/
function castSlice(array, start, end) {
var length = array.length;
end = end === undefined ? length : end;
return (!start && end >= length) ? array : baseSlice(array, start, end);
}
/** /**
* Creates a clone of `buffer`. * Creates a clone of `buffer`.
* *
@ -9224,6 +9272,44 @@
: string; : string;
} }
/**
* Removes leading and trailing whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
* _.trim(' abc ');
* // => 'abc'
*
* _.trim('-_-abc-_-', '_-');
* // => 'abc'
*
* _.map([' foo ', ' bar '], _.trim);
* // => ['foo', 'bar']
*/
function trim(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined)) {
return string.replace(reTrim, '');
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string),
chrSymbols = stringToArray(chars),
start = charsStartIndex(strSymbols, chrSymbols),
end = charsEndIndex(strSymbols, chrSymbols) + 1;
return castSlice(strSymbols, start, end).join('');
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -9744,6 +9830,7 @@
lodash.result = result; lodash.result = result;
lodash.size = size; lodash.size = size;
lodash.some = some; lodash.some = some;
lodash.trim = trim;
lodash.uniqueId = uniqueId; lodash.uniqueId = uniqueId;
// Add aliases. // Add aliases.

Loading…
Cancel
Save