merge-options
Advanced tools
+10
-10
| 'use strict'; | ||
| const isOptionObject = require('is-plain-obj'); | ||
| import isOptionObject from 'is-plain-obj'; | ||
| const {hasOwnProperty} = Object.prototype; | ||
| const {propertyIsEnumerable} = Object; | ||
| const defineProperty = (obj, name, value) => Object.defineProperty(obj, name, { | ||
| const defineProperty = (object, name, value) => Object.defineProperty(object, name, { | ||
| value, | ||
@@ -14,3 +14,3 @@ writable: true, | ||
| const globalThis = this; | ||
| const defaultMergeOpts = { | ||
| const defaultMergeOptions = { | ||
| concatArrays: false, | ||
@@ -65,7 +65,7 @@ ignoreUndefined: false | ||
| function cloneOptionObject(obj) { | ||
| const result = Object.getPrototypeOf(obj) === null ? Object.create(null) : {}; | ||
| function cloneOptionObject(object) { | ||
| const result = Object.getPrototypeOf(object) === null ? Object.create(null) : {}; | ||
| getEnumerableOwnPropertyKeys(obj).forEach(key => { | ||
| defineProperty(result, key, clone(obj[key])); | ||
| getEnumerableOwnPropertyKeys(object).forEach(key => { | ||
| defineProperty(result, key, clone(object[key])); | ||
| }); | ||
@@ -156,4 +156,4 @@ | ||
| module.exports = function (...options) { | ||
| const config = merge(clone(defaultMergeOpts), (this !== globalThis && this) || {}, defaultMergeOpts); | ||
| export default function mergeOptions(...options) { | ||
| const config = merge(clone(defaultMergeOptions), (this !== globalThis && this) || {}, defaultMergeOptions); | ||
| let merged = {_: {}}; | ||
@@ -174,2 +174,2 @@ | ||
| return merged._; | ||
| }; | ||
| } |
+16
-8
| { | ||
| "name": "merge-options", | ||
| "version": "2.0.0", | ||
| "version": "3.0.0", | ||
| "type": "module", | ||
| "description": "Merge Option Objects", | ||
@@ -12,3 +13,3 @@ "license": "MIT", | ||
| "engines": { | ||
| "node": ">=8" | ||
| "node": ">=14" | ||
| }, | ||
@@ -33,11 +34,18 @@ "scripts": { | ||
| "devDependencies": { | ||
| "ava": "^2.4.0", | ||
| "coveralls": "^3.0.3", | ||
| "nyc": "^14.1.1", | ||
| "rimraf": "^3.0.0", | ||
| "xo": "^0.25.3" | ||
| "ava": "^3.11.1", | ||
| "coveralls": "^3.1.0", | ||
| "nyc": "^15.1.0", | ||
| "rimraf": "^3.0.2", | ||
| "xo": "^0.33.0" | ||
| }, | ||
| "dependencies": { | ||
| "is-plain-obj": "^2.0.0" | ||
| "is-plain-obj": "^2.1.0" | ||
| }, | ||
| "xo": { | ||
| "rules": { | ||
| "import/extensions": "off", | ||
| "import/no-useless-path-segments": "off", | ||
| "unicorn/import-index": "off" | ||
| } | ||
| } | ||
| } |
10153
2.08%Yes
NaNUpdated