MCPcopy Create free account
hub / github.com/node-modules/utility / assign

Function assign

src/object.ts:7–23  ·  view source on GitHub ↗
(target: any, objects: any | any[])

Source from the content-addressed store, hash-verified

5 * @return {Object} - return target object
6 */
7export function assign(target: any, objects: any | any[]): any {
8 if (!Array.isArray(objects)) {
9 objects = [ objects ];
10 }
11
12 for (let i = 0; i < objects.length; i++) {
13 const obj = objects[i];
14 if (obj) {
15 const keys = Object.keys(obj);
16 for (let j = 0; j < keys.length; j++) {
17 const key = keys[j];
18 target[key] = obj[key];
19 }
20 }
21 }
22 return target;
23}
24
25export function has(obj: object, prop: string) {
26 return Object.prototype.hasOwnProperty.call(obj, prop);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…