/usr/lib/nodejs/mixin-deep/index.js is in node-mixin-deep 1.1.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 'use strict';
var isExtendable = require('is-extendable');
var forIn = require('for-in');
function mixinDeep(target, objects) {
var len = arguments.length, i = 0;
while (++i < len) {
var obj = arguments[i];
if (isObject(obj)) {
forIn(obj, copy, target);
}
}
return target;
}
/**
* Copy properties from the source object to the
* target object.
*
* @param {*} `val`
* @param {String} `key`
*/
function copy(val, key) {
var obj = this[key];
if (isObject(val) && isObject(obj)) {
mixinDeep(obj, val);
} else {
this[key] = val;
}
}
/**
* Returns true if `val` is an object or function.
*
* @param {any} val
* @return {Boolean}
*/
function isObject(val) {
return isExtendable(val) && !Array.isArray(val);
}
/**
* Expose `mixinDeep`
*/
module.exports = mixinDeep;
|