UNPKG

funtool

Version:

A modern, efficient, and modular JavaScript utility library designed to enhance developer productivity.

3 lines (2 loc) 2.31 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).funtool={})}(this,(function(t){"use strict";function e(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}function n(t){if(!function(t){return"function"==typeof t||"object"==typeof t&&null!==t}(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype||null===Object.getPrototypeOf(e)}function o(t){return"function"==typeof t}function r(t){return"object"!=typeof t&&"function"!=typeof t||null==t}function c(t,e){if(r(t))return[];return("undefined"!=typeof Reflect&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys(t):[...Object.getOwnPropertyNames?Object.getOwnPropertyNames(t):[],...Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]]).filter((n=>{const r=Object.getOwnPropertyDescriptor(t,n);return!!r&&(o(e)?e(n,r):r.enumerable)}))}t.hasOwn=function(t,e){return!r(t)&&Object.prototype.hasOwnProperty.call(t,e)},t.keys=c,t.merge=function(t,e){const n={...t};return c(e).forEach((t=>{const o=Object.getOwnPropertyDescriptor(e,t);o&&Object.defineProperty(n,t,o)})),n},t.mergeDeep=function t(o,f){if(e(o)&&e(f)){const e=Math.max(o.length,f.length),n=[];for(let c=0;c<e;c++){const e=o[c],u=f[c];r(e)||r(u)?n[c]=void 0!==u?u:e:n[c]=t(e,u)}return n}if(n(o)&&n(f)){const e={...o};return c(f).forEach((n=>{const c=o[n],u=f[n];r(c)||r(u)?e[n]=u:e[n]=t(c,u)})),e}return f},t.omit=function(t,e){const n={};return c(t).forEach((o=>{e.includes(o)||(n[o]=t[o])})),n},t.omitBy=function(t,e){const n={};return c(t).forEach((o=>{e(t[o],o)||(n[o]=t[o])})),n},t.pick=function(t,e){const n={};for(const o of e)o in t&&(n[o]=t[o]);return n},t.pickBy=function(t,e){const n={};for(const o in t)e(t[o],o)&&(n[o]=t[o]);return n},t.values=function(t,e){return r(t)?[]:("undefined"!=typeof Reflect&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys(t):[...Object.getOwnPropertyNames?Object.getOwnPropertyNames(t):[],...Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]]).filter((n=>{const r=Object.getOwnPropertyDescriptor(t,n);return!!r&&(o(e)?e(n,r):r.enumerable)})).map((e=>t[e]))}})); //# sourceMappingURL=index.umd.js.map