Lodash _.noConflict() 方法
Lodash是一个基于 underscore.js 的 JavaScript 库。 Lodash 有助于处理数组、字符串、对象、数字等。
Util 的_.noConflict() 方法用于将变量恢复为以前的值并返回对lodash函数的引用。
句法:
_.noConflict()
参数:此方法不接受任何参数。
返回值:此方法返回lodash函数。
例子:
Javascript
// Requiring lodash library
const _ = require('lodash');
// Calling _.noConflict() method
var lod = _.noConflict();
// Displays output
console.log(lod);
输出:
[Function: lodash] {
templateSettings: {
escape: /<%-([\s\S]+?)%>/g,
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
variable: '',
imports: { _: [Circular] }
},
after: [Function: after],
ary: [Function: ary],
assign: [Function],
assignIn: [Function],
assignInWith: [Function],
assignWith: [Function],
at: [Function],
before: [Function: before],
bind: [Function] { placeholder: [Circular] },
bindAll: [Function],
bindKey: [Function] { placeholder: [Circular] },
castArray: [Function: castArray],
chain: [Function: chain],
chunk: [Function: chunk],
compact: [Function: compact],
concat: [Function: concat],
cond: [Function: cond],
conforms: [Function: conforms],
constant: [Function: constant],
countBy: [Function],
create: [Function: create],
curry: [Function: curry] { placeholder: [Circular] },
curryRight: [Function: curryRight] { placeholder: [Circular] },
debounce: [Function: debounce],
defaults: [Function],
defaultsDeep: [Function],
defer: [Function],
delay: [Function],
difference: [Function],
differenceBy: [Function],
differenceWith: [Function],
drop: [Function: drop],
dropRight: [Function: dropRight],
dropRightWhile: [Function: dropRightWhile],
dropWhile: [Function: dropWhile],
fill: [Function: fill],
filter: [Function: filter],
flatMap: [Function: flatMap],
flatMapDeep: [Function: flatMapDeep],
flatMapDepth: [Function: flatMapDepth],
flatten: [Function: flatten],
flattenDeep: [Function: flattenDeep],
flattenDepth: [Function: flattenDepth],
flip: [Function: flip],
flow: [Function],
flowRight: [Function],
fromPairs: [Function: fromPairs],
functions: [Function: functions],
functionsIn: [Function: functionsIn],
groupBy: [Function],
initial: [Function: initial],
intersection: [Function],
intersectionBy: [Function],
intersectionWith: [Function],
invert: [Function],
invertBy: [Function],
invokeMap: [Function],
iteratee: [Function: iteratee],
keyBy: [Function],
keys: [Function: keys],
keysIn: [Function: keysIn],
map: [Function: map],
mapKeys: [Function: mapKeys],
mapValues: [Function: mapValues],
matches: [Function: matches],
matchesProperty: [Function: matchesProperty],
memoize: [Function: memoize] { Cache: [Function: MapCache] },
merge: [Function],
mergeWith: [Function],
method: [Function],
methodOf: [Function],
mixin: [Function: mixin],
negate: [Function: negate],
nthArg: [Function: nthArg],
omit: [Function],
omitBy: [Function: omitBy],
once: [Function: once],
orderBy: [Function: orderBy],
over: [Function],
overArgs: [Function],
overEvery: [Function],
overSome: [Function],
partial: [Function] { placeholder: [Circular] },
partialRight: [Function] { placeholder: [Circular] },
partition: [Function],
pick: [Function],
pickBy: [Function: pickBy],
property: [Function: property],
propertyOf: [Function: propertyOf],
pull: [Function],
pullAll: [Function: pullAll],
pullAllBy: [Function: pullAllBy],
pullAllWith: [Function: pullAllWith],
pullAt: [Function],
range: [Function],
rangeRight: [Function],
rearg: [Function],
reject: [Function: reject],
remove: [Function: remove],
rest: [Function: rest],
reverse: [Function: reverse],
sampleSize: [Function: sampleSize],
set: [Function: set],
setWith: [Function: setWith],
shuffle: [Function: shuffle],
slice: [Function: slice],
sortBy: [Function],
sortedUniq: [Function: sortedUniq],
sortedUniqBy: [Function: sortedUniqBy],
split: [Function: split],
spread: [Function: spread],
tail: [Function: tail],
take: [Function: take],
takeRight: [Function: takeRight],
takeRightWhile: [Function: takeRightWhile],
takeWhile: [Function: takeWhile],
tap: [Function: tap],
throttle: [Function: throttle],
thru: [Function: thru],
toArray: [Function: toArray],
toPairs: [Function],
toPairsIn: [Function],
toPath: [Function: toPath],
toPlainObject: [Function: toPlainObject],
transform: [Function: transform],
unary: [Function: unary],
union: [Function],
unionBy: [Function],
unionWith: [Function],
uniq: [Function: uniq],
uniqBy: [Function: uniqBy],
uniqWith: [Function: uniqWith],
unset: [Function: unset],
unzip: [Function: unzip],
unzipWith: [Function: unzipWith],
update: [Function: update],
updateWith: [Function: updateWith],
values: [Function: values],
valuesIn: [Function: valuesIn],
without: [Function],
words: [Function: words],
wrap: [Function: wrap],
xor: [Function],
xorBy: [Function],
xorWith: [Function],
zip: [Function],
zipObject: [Function: zipObject],
zipObjectDeep: [Function: zipObjectDeep],
zipWith: [Function],
entries: [Function],
entriesIn: [Function],
extend: [Function],
extendWith: [Function],
add: [Function],
attempt: [Function],
camelCase: [Function],
capitalize: [Function: capitalize],
ceil: [Function],
clamp: [Function: clamp],
clone: [Function: clone],
cloneDeep: [Function: cloneDeep],
cloneDeepWith: [Function: cloneDeepWith],
cloneWith: [Function: cloneWith],
conformsTo: [Function: conformsTo],
deburr: [Function: deburr],
defaultTo: [Function: defaultTo],
divide: [Function],
endsWith: [Function: endsWith],
eq: [Function: eq],
escape: [Function: escape],
escapeRegExp: [Function: escapeRegExp],
every: [Function: every],
find: [Function],
findIndex: [Function: findIndex],
findKey: [Function: findKey],
findLast: [Function],
findLastIndex: [Function: findLastIndex],
findLastKey: [Function: findLastKey],
floor: [Function],
forEach: [Function: forEach],
forEachRight: [Function: forEachRight],
forIn: [Function: forIn],
forInRight: [Function: forInRight],
forOwn: [Function: forOwn],
forOwnRight: [Function: forOwnRight],
get: [Function: get],
gt: [Function],
gte: [Function],
has: [Function: has],
hasIn: [Function: hasIn],
head: [Function: head],
identity: [Function: identity],
includes: [Function: includes],
indexOf: [Function: indexOf],
inRange: [Function: inRange],
invoke: [Function],
isArguments: [Function: baseIsArguments],
isArray: [Function: isArray],
isArrayBuffer: [Function],
isArrayLike: [Function: isArrayLike],
isArrayLikeObject: [Function: isArrayLikeObject],
isBoolean: [Function: isBoolean],
isBuffer: [Function: isBuffer],
isDate: [Function],
isElement: [Function: isElement],
isEmpty: [Function: isEmpty],
isEqual: [Function: isEqual],
isEqualWith: [Function: isEqualWith],
isError: [Function: isError],
isFinite: [Function: isFinite],
isFunction: [Function: isFunction],
isInteger: [Function: isInteger],
isLength: [Function: isLength],
isMap: [Function],
isMatch: [Function: isMatch],
isMatchWith: [Function: isMatchWith],
isNaN: [Function: isNaN],
isNative: [Function: isNative],
isNil: [Function: isNil],
isNull: [Function: isNull],
isNumber: [Function: isNumber],
isObject: [Function: isObject],
isObjectLike: [Function: isObjectLike],
isPlainObject: [Function: isPlainObject],
isRegExp: [Function],
isSafeInteger: [Function: isSafeInteger],
isSet: [Function],
isString: [Function: isString],
isSymbol: [Function: isSymbol],
isTypedArray: [Function],
isUndefined: [Function: isUndefined],
isWeakMap: [Function: isWeakMap],
isWeakSet: [Function: isWeakSet],
join: [Function: join],
kebabCase: [Function],
last: [Function: last],
lastIndexOf: [Function: lastIndexOf],
lowerCase: [Function],
lowerFirst: [Function],
lt: [Function],
lte: [Function],
max: [Function: max],
maxBy: [Function: maxBy],
mean: [Function: mean],
meanBy: [Function: meanBy],
min: [Function: min],
minBy: [Function: minBy],
stubArray: [Function: stubArray],
stubFalse: [Function: stubFalse],
stubObject: [Function: stubObject],
stubString: [Function: stubString],
stubTrue: [Function: stubTrue],
multiply: [Function],
nth: [Function: nth],
noConflict: [Function: noConflict],
noop: [Function: noop],
now: [Function],
pad: [Function: pad],
padEnd: [Function: padEnd],
padStart: [Function: padStart],
parseInt: [Function: parseInt],
random: [Function: random],
reduce: [Function: reduce],
reduceRight: [Function: reduceRight],
repeat: [Function: repeat],
replace: [Function: replace],
result: [Function: result],
round: [Function],
runInContext: [Function: runInContext],
sample: [Function: sample],
size: [Function: size],
snakeCase: [Function],
some: [Function: some],
sortedIndex: [Function: sortedIndex],
sortedIndexBy: [Function: sortedIndexBy],
sortedIndexOf: [Function: sortedIndexOf],
sortedLastIndex: [Function: sortedLastIndex],
sortedLastIndexBy: [Function: sortedLastIndexBy],
sortedLastIndexOf: [Function: sortedLastIndexOf],
startCase: [Function],
startsWith: [Function: startsWith],
subtract: [Function],
sum: [Function: sum],
sumBy: [Function: sumBy],
template: [Function: template],
times: [Function: times],
toFinite: [Function: toFinite],
toInteger: [Function: toInteger],
toLength: [Function: toLength],
toLower: [Function: toLower],
toNumber: [Function: toNumber],
toSafeInteger: [Function: toSafeInteger],
toString: [Function: toString],
toUpper: [Function: toUpper],
trim: [Function: trim],
trimEnd: [Function: trimEnd],
trimStart: [Function: trimStart],
truncate: [Function: truncate],
unescape: [Function: unescape],
uniqueId: [Function: uniqueId],
upperCase: [Function],
upperFirst: [Function],
each: [Function: forEach],
eachRight: [Function: forEachRight],
first: [Function: head],
VERSION: '4.17.15',
_: [Circular]
}