source: imaps-frontend/node_modules/lodash-es/_createAssigner.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.0 KB
Line 
1import baseRest from './_baseRest.js';
2import isIterateeCall from './_isIterateeCall.js';
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
37export default createAssigner;
Note: See TracBrowser for help on using the repository browser.