options-defaults
Advanced tools
Comparing version 2.0.39 to 2.0.40
@@ -1,15 +0,1 @@ | ||
var defaults=function(r){"use strict"; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function t(r,t){var e="function"==typeof Symbol&&r[Symbol.iterator];if(!e)return r;var n,o,u=e.call(r),a=[];try{for(;(void 0===t||t-- >0)&&!(n=u.next()).done;)a.push(n.value)}catch(r){o={error:r}}finally{try{n&&!n.done&&(e=u.return)&&e.call(u)}finally{if(o)throw o.error}}return a}function e(r,t){for(var e=0,n=t.length,o=r.length;e<n;e++,o++)r[o]=t[e];return r}var n=["__proto__","constructor","prototype"],o=function(r){for(var e=[],u=1;u<arguments.length;u++)e[u-1]=arguments[u];return e.forEach((function(e){e&&"object"==typeof e&&Object.entries(e).forEach((function(e){var u=t(e,2),a=u[0],c=u[1];if(!n.includes(a)){var f="object"==typeof c,l=f&&"Object"!==(null==c?void 0:c.constructor.name);null===c||!f||Array.isArray(c)||l?r[a]=c:(r[a]||(r[a]={}),o(r[a],c))}}))})),r};return r.defaults=function(r,n,u,a,c,f,l){for(var i=[],v=7;v<arguments.length;v++)i[v-7]=arguments[v];return o.apply(void 0,e([{},r,n,u,a,c,f,l],t(i)))},r.merge=o,Object.defineProperty(r,"__esModule",{value:!0}),r}({}); | ||
var defaults=function(e){"use strict";const t=["__proto__","constructor","prototype"],r=(e,...o)=>(o.forEach((o=>{o&&"object"==typeof o&&Object.entries(o).forEach((([o,c])=>{if(t.includes(o))return;const n="object"==typeof c,u=n&&"Object"!==(null==c?void 0:c.constructor.name);null===c||!n||Array.isArray(c)||u?e[o]=c:(e[o]||(e[o]={}),r(e[o],c))}))})),e);return e.defaults=(e,t,o,c,n,u,s,...a)=>r({},e,t,o,c,n,u,s,...a),e.merge=r,Object.defineProperty(e,"__esModule",{value:!0}),e}({}); |
export declare const merge: (object: any, ...sources: any[]) => any; | ||
/** | ||
* Merges objects deeply, overrides arrays and classes, does not mutate objects. | ||
*/ | ||
export declare const defaults: <Defaults, Source, Source2, Source3, Source4, Source5, Source6>(defaultOptions: Defaults, source: Source, source2?: Source2, source3?: Source3, source4?: Source4, source5?: Source5, source6?: Source6, ...args: any[]) => Defaults & Source & Source2 & Source3 & Source4 & Source5; | ||
export declare const defaults: <Defaults, Source, Source2, Source3, Source4, Source5, Source6>(defaultOptions: Defaults, source: Source, source2?: Source2 | undefined, source3?: Source3 | undefined, source4?: Source4 | undefined, source5?: Source5 | undefined, source6?: Source6 | undefined, ...args: any[]) => Defaults & Source & Source2 & Source3 & Source4 & Source5; |
@@ -1,16 +0,1 @@ | ||
"use strict"; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function r(r,t){var e="function"==typeof Symbol&&r[Symbol.iterator];if(!e)return r;var o,n,c=e.call(r),l=[];try{for(;(void 0===t||t-- >0)&&!(o=c.next()).done;)l.push(o.value)}catch(r){n={error:r}}finally{try{o&&!o.done&&(e=c.return)&&e.call(c)}finally{if(n)throw n.error}}return l}function t(r,t){for(var e=0,o=t.length,n=r.length;e<o;e++,n++)r[n]=t[e];return r}Object.defineProperty(exports,"__esModule",{value:!0});var e=["__proto__","constructor","prototype"],o=function(t){for(var n=[],c=1;c<arguments.length;c++)n[c-1]=arguments[c];return n.forEach((function(n){n&&"object"==typeof n&&Object.entries(n).forEach((function(n){var c=r(n,2),l=c[0],u=c[1];if(!e.includes(l)){var a="object"==typeof u,f=a&&"Object"!==(null==u?void 0:u.constructor.name);null===u||!a||Array.isArray(u)||f?t[l]=u:(t[l]||(t[l]={}),o(t[l],u))}}))})),t};exports.defaults=function(e,n,c,l,u,a,f){for(var i=[],y=7;y<arguments.length;y++)i[y-7]=arguments[y];return o.apply(void 0,t([{},e,n,c,l,u,a,f],r(i)))},exports.merge=o; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=["__proto__","constructor","prototype"],t=(o,...r)=>(r.forEach((r=>{r&&"object"==typeof r&&Object.entries(r).forEach((([r,c])=>{if(e.includes(r))return;const s="object"==typeof c,n=s&&"Object"!==(null==c?void 0:c.constructor.name);null===c||!s||Array.isArray(c)||n?o[r]=c:(o[r]||(o[r]={}),t(o[r],c))}))})),o);exports.defaults=(e,o,r,c,s,n,u,...p)=>t({},e,o,r,c,s,n,u,...p),exports.merge=t; |
@@ -1,15 +0,1 @@ | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function r(r,t){var o="function"==typeof Symbol&&r[Symbol.iterator];if(!o)return r;var n,e,c=o.call(r),a=[];try{for(;(void 0===t||t-- >0)&&!(n=c.next()).done;)a.push(n.value)}catch(r){e={error:r}}finally{try{n&&!n.done&&(o=c.return)&&o.call(c)}finally{if(e)throw e.error}}return a}function t(r,t){for(var o=0,n=t.length,e=r.length;o<n;o++,e++)r[e]=t[o];return r}var o=["__proto__","constructor","prototype"],n=function(t){for(var e=[],c=1;c<arguments.length;c++)e[c-1]=arguments[c];return e.forEach((function(e){e&&"object"==typeof e&&Object.entries(e).forEach((function(e){var c=r(e,2),a=c[0],f=c[1];if(!o.includes(a)){var l="object"==typeof f,u=l&&"Object"!==(null==f?void 0:f.constructor.name);null===f||!l||Array.isArray(f)||u?t[a]=f:(t[a]||(t[a]={}),n(t[a],f))}}))})),t},e=function(o,e,c,a,f,l,u){for(var i=[],y=7;y<arguments.length;y++)i[y-7]=arguments[y];return n.apply(void 0,t([{},o,e,c,a,f,l,u],r(i)))};export{e as defaults,n as merge}; | ||
const o=["__proto__","constructor","prototype"],t=(r,...c)=>(c.forEach((c=>{c&&"object"==typeof c&&Object.entries(c).forEach((([c,e])=>{if(o.includes(c))return;const n="object"==typeof e,s=n&&"Object"!==(null==e?void 0:e.constructor.name);null===e||!n||Array.isArray(e)||s?r[c]=e:(r[c]||(r[c]={}),t(r[c],e))}))})),r),r=(o,r,c,e,n,s,p,...u)=>t({},o,r,c,e,n,s,p,...u);export{r as defaults,t as merge}; |
{ | ||
"name": "options-defaults", | ||
"version": "2.0.39", | ||
"version": "2.0.40", | ||
"description": "Options-defaults design pattern implementation for reliable configuration. It merges objects deeply, overrides arrays and classes (different than Object) and the result remains strongly typed.", | ||
@@ -25,9 +25,9 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^8.2.0", | ||
"@types/node": "^14.14.35", | ||
"rollup": "^2.42.2", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"typescript": "^4.2.3" | ||
"@rollup/plugin-typescript": "8.3.3", | ||
"@types/node": "16.11.41", | ||
"rollup": "2.75.6", | ||
"rollup-plugin-terser": "7.0.2", | ||
"typescript": "4.7.3" | ||
}, | ||
"gitHead": "9abd1f655dfcb6980b73f313ae1ce39324eed2a2" | ||
"gitHead": "5f409f3708573a20e3ce2e5088531dcd8951df7b" | ||
} |
@@ -6,3 +6,3 @@ ### Design pattern | ||
export interface ISomeOptions { | ||
export interface SomeOptions { | ||
logger?: Partial<Console>; | ||
@@ -16,5 +16,5 @@ } | ||
options: ISomeOptions & typeof Something.defaults; | ||
constructor(options?: ISomeOptions) { | ||
this.options = defaults(Rat.defaults, options); | ||
options: SomeOptions & typeof Something.defaults; | ||
constructor(options?: SomeOptions) { | ||
this.options = defaults(Something.defaults, options); | ||
} | ||
@@ -21,0 +21,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25117
11
9
1