mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Move split out functions.
This commit is contained in:
94
lodash.js
94
lodash.js
@@ -5681,6 +5681,18 @@
|
||||
return { 'start': start, 'end': end };
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the wrapper details from the `source` body comment.
|
||||
*
|
||||
* @private
|
||||
* @param {string} source The source to inspect.
|
||||
* @returns {Array} Returns the wrapper details.
|
||||
*/
|
||||
function getWrapDetails(source) {
|
||||
var match = source.match(reWrapDetails);
|
||||
return match ? match[1].split(reSplitDetails) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `path` exists on `object`.
|
||||
*
|
||||
@@ -5810,6 +5822,23 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the wrapper `details` in a comment at the top of the `source` body.
|
||||
*
|
||||
* @private
|
||||
* @param {string} source The source to modify.
|
||||
* @returns {Array} details The details to insert.
|
||||
* @returns {string} Returns the modified source.
|
||||
*/
|
||||
function insertWrapDetails(source, details) {
|
||||
var length = details.length,
|
||||
lastIndex = length - 1;
|
||||
|
||||
details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
|
||||
details = details.join(length > 2 ? ', ' : ' ');
|
||||
return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is a flattenable `arguments` object or array.
|
||||
*
|
||||
@@ -6163,53 +6192,6 @@
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Extracts the wrapper details from the `source` body comment.
|
||||
*
|
||||
* @private
|
||||
* @param {string} source The source to inspect.
|
||||
* @returns {Array} Returns the wrapper details.
|
||||
*/
|
||||
function getWrapDetails(source) {
|
||||
var match = source.match(reWrapDetails);
|
||||
return match ? match[1].split(reSplitDetails) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the wrapper `details` in a comment at the top of the `source` body.
|
||||
*
|
||||
* @private
|
||||
* @param {string} source The source to modify.
|
||||
* @returns {Array} details The details to insert.
|
||||
* @returns {string} Returns the modified source.
|
||||
*/
|
||||
function insertWrapDetails(source, details) {
|
||||
var length = details.length,
|
||||
lastIndex = length - 1;
|
||||
|
||||
details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
|
||||
details = details.join(length > 2 ? ', ' : ' ');
|
||||
return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the wrapper `details` base on the `bitmask` flags.
|
||||
*
|
||||
* @private
|
||||
* @returns {Array} details The details to insert.
|
||||
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
||||
* @returns {Array} Returns `details`.
|
||||
*/
|
||||
function updateWrapDetails(details, bitmask) {
|
||||
arrayEach(wrapFlags, function(pair) {
|
||||
var value = '_.' + pair[0];
|
||||
if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
|
||||
details.push(value);
|
||||
}
|
||||
});
|
||||
return details.sort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts `string` to a property path array.
|
||||
*
|
||||
@@ -6259,6 +6241,24 @@
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the wrapper `details` base on the `bitmask` flags.
|
||||
*
|
||||
* @private
|
||||
* @returns {Array} details The details to insert.
|
||||
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
||||
* @returns {Array} Returns `details`.
|
||||
*/
|
||||
function updateWrapDetails(details, bitmask) {
|
||||
arrayEach(wrapFlags, function(pair) {
|
||||
var value = '_.' + pair[0];
|
||||
if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
|
||||
details.push(value);
|
||||
}
|
||||
});
|
||||
return details.sort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a clone of `wrapper`.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user