source: trip-planner-front/node_modules/lodash/_createAssigner.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1var baseRest = require('./_baseRest'),
2 isIterateeCall = require('./_isIterateeCall');
3
4/**
5 * Creates a function like `_.assign`.
6 *
7 * @private
8 * @param {Function} assigner The function to assign values.
9 * @returns {Function} Returns the new assigner function.
10 */
11function createAssigner(assigner) {
12 return baseRest(function(object, sources) {
13 var index = -1,
14 length = sources.length,
15 customizer = length > 1 ? sources[length - 1] : undefined,
16 guard = length > 2 ? sources[2] : undefined;
17
18 customizer = (assigner.length > 3 && typeof customizer == 'function')
19 ? (length--, customizer)
20 : undefined;
21
22 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
23 customizer = length < 3 ? undefined : customizer;
24 length = 1;
25 }
26 object = Object(object);
27 while (++index < length) {
28 var source = sources[index];
29 if (source) {
30 assigner(object, source, index, customizer);
31 }
32 }
33 return object;
34 });
35}
36
37module.exports = createAssigner;
Note: See TracBrowser for help on using the repository browser.