mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Make _.defaults follow _.assign and only assign own properties of source.
Former-commit-id: 114dc47bbfa6db6a53a2fa03dd477fe86c3395cb
This commit is contained in:
20
build.js
20
build.js
@@ -1125,6 +1125,26 @@
|
||||
' }'
|
||||
].join('\n'));
|
||||
|
||||
// replace `_.defaults`
|
||||
source = source.replace(/^( *)var defaults *= *createIterator[\s\S]+?\);/m, [
|
||||
' function defaults(object) {',
|
||||
' if (!object) {',
|
||||
' return object;',
|
||||
' }',
|
||||
' for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {',
|
||||
' var iteratee = arguments[argsIndex];',
|
||||
' if (iteratee) {',
|
||||
' for (var key in iteratee) {',
|
||||
' if (object[key] == null) {',
|
||||
' object[key] = iteratee[key];',
|
||||
' }',
|
||||
' }',
|
||||
' }',
|
||||
' }',
|
||||
' return object;',
|
||||
' }'
|
||||
].join('\n'));
|
||||
|
||||
// replace `_.intersection`
|
||||
source = source.replace(/^( *)function intersection[\s\S]+?\n\1}/m, [
|
||||
' function intersection(array) {',
|
||||
|
||||
Reference in New Issue
Block a user