Repository URL to install this package:
|
Version:
5.0.0-rc.11 ▾
|
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var index = require('../is-extendable/index.js');
var index$1 = require('../arr-union/index.js');
var index$4 = require('../get-value/index.js');
var index$5 = require('../set-value/index.js');
var unionValue = function unionValue(obj, prop, value) {
if (!index.default(obj)) {
throw new TypeError('union-value expects the first argument to be an object.');
}
if (typeof prop !== 'string') {
throw new TypeError('union-value expects `prop` to be a string.');
}
var arr = arrayify(index$4.default(obj, prop));
index$5.default(obj, prop, index$1.default(arr, arrayify(value)));
return obj;
};
function arrayify(val) {
if (val === null || typeof val === 'undefined') {
return [];
}
if (Array.isArray(val)) {
return val;
}
return [val];
}
exports.__moduleExports = unionValue;
exports.default = unionValue;
//# sourceMappingURL=index.js.map