@deboxsoft/module-core
Advanced tools
Comparing version 2.2.1 to 2.2.2
# Change Log | ||
## 2.2.2 | ||
### Patch Changes | ||
- fix module exports | ||
## 2.2.1 | ||
@@ -4,0 +10,0 @@ |
298
index.js
@@ -372,10 +372,10 @@ 'use strict'; | ||
*/ | ||
function isObject$1(val) { | ||
function isObject(val) { | ||
return val != null && typeof val === "object" && Array.isArray(val) === false; | ||
} | ||
function isPlainObject$2(o) { | ||
function isPlainObject(o) { | ||
let ctor, prot; | ||
if (isObject$1(o) === false) return false; | ||
if (isObject(o) === false) return false; | ||
@@ -388,3 +388,3 @@ // If has modified constructor | ||
prot = ctor.prototype; | ||
if (isObject$1(prot) === false) return false; | ||
if (isObject(prot) === false) return false; | ||
@@ -408,3 +408,3 @@ // If constructor does not have an Object-specific method | ||
const toString$1 = Object.prototype.toString; | ||
const toString = Object.prototype.toString; | ||
@@ -415,3 +415,3 @@ /** | ||
*/ | ||
function kindOf$1(val) { | ||
function kindOf(val) { | ||
if (val === void 0) return "undefined"; | ||
@@ -426,13 +426,13 @@ if (val === null) return "null"; | ||
if (type === "function") { | ||
return isGeneratorFn$1(val) ? "generatorfunction" : "function"; | ||
return isGeneratorFn(val) ? "generatorfunction" : "function"; | ||
} | ||
if (isArray$1(val)) return "array"; | ||
if (isBuffer$1(val)) return "buffer"; | ||
if (isArguments$1(val)) return "arguments"; | ||
if (isDate$1(val)) return "date"; | ||
if (isError$1(val)) return "error"; | ||
if (isRegexp$1(val)) return "regexp"; | ||
if (isArray(val)) return "array"; | ||
if (isBuffer(val)) return "buffer"; | ||
if (isArguments(val)) return "arguments"; | ||
if (isDate(val)) return "date"; | ||
if (isError(val)) return "error"; | ||
if (isRegexp(val)) return "regexp"; | ||
switch (ctorName$1(val)) { | ||
switch (ctorName(val)) { | ||
case "Symbol": | ||
@@ -478,3 +478,3 @@ return "symbol"; | ||
if (isGeneratorObj$1(val)) { | ||
if (isGeneratorObj(val)) { | ||
return "generator"; | ||
@@ -484,3 +484,3 @@ } | ||
// Non-plain objects | ||
type = toString$1.call(val); | ||
type = toString.call(val); | ||
switch (type) { | ||
@@ -504,7 +504,7 @@ case "[object Object]": | ||
function ctorName$1(val) { | ||
function ctorName(val) { | ||
return typeof val.constructor === "function" ? val.constructor.name : null; | ||
} | ||
function isArray$1(val) { | ||
function isArray(val) { | ||
if (Array.isArray) return Array.isArray(val); | ||
@@ -514,3 +514,3 @@ return val instanceof Array; | ||
function isError$1(val) { | ||
function isError(val) { | ||
return ( | ||
@@ -524,3 +524,3 @@ val instanceof Error || | ||
function isDate$1(val) { | ||
function isDate(val) { | ||
if (val instanceof Date) return true; | ||
@@ -534,3 +534,3 @@ return ( | ||
function isRegexp$1(val) { | ||
function isRegexp(val) { | ||
if (val instanceof RegExp) return true; | ||
@@ -545,7 +545,7 @@ return ( | ||
function isGeneratorFn$1(name) { | ||
return ctorName$1(name) === "GeneratorFunction"; | ||
function isGeneratorFn(name) { | ||
return ctorName(name) === "GeneratorFunction"; | ||
} | ||
function isGeneratorObj$1(val) { | ||
function isGeneratorObj(val) { | ||
return ( | ||
@@ -558,3 +558,3 @@ typeof val.throw === "function" && | ||
function isArguments$1(val) { | ||
function isArguments(val) { | ||
try { | ||
@@ -577,3 +577,3 @@ if (typeof val.length === "number" && typeof val.callee === "function") { | ||
function isBuffer$1(val) { | ||
function isBuffer(val) { | ||
if (val.constructor && typeof val.constructor.isBuffer === "function") { | ||
@@ -707,3 +707,3 @@ return val.constructor.isBuffer(val); | ||
const omit = (obj, props, fn) => { | ||
if (!isObject$1(obj)) return {}; | ||
if (!isObject(obj)) return {}; | ||
@@ -734,166 +734,39 @@ if (typeof props === "function") { | ||
var toString = Object.prototype.toString; | ||
const valueOf = Symbol.prototype.valueOf; | ||
var kindOf = function kindOf(val) { | ||
if (val === void 0) return 'undefined'; | ||
if (val === null) return 'null'; | ||
var type = typeof val; | ||
if (type === 'boolean') return 'boolean'; | ||
if (type === 'string') return 'string'; | ||
if (type === 'number') return 'number'; | ||
if (type === 'symbol') return 'symbol'; | ||
if (type === 'function') { | ||
return isGeneratorFn(val) ? 'generatorfunction' : 'function'; | ||
} | ||
if (isArray(val)) return 'array'; | ||
if (isBuffer(val)) return 'buffer'; | ||
if (isArguments(val)) return 'arguments'; | ||
if (isDate(val)) return 'date'; | ||
if (isError(val)) return 'error'; | ||
if (isRegexp(val)) return 'regexp'; | ||
switch (ctorName(val)) { | ||
case 'Symbol': return 'symbol'; | ||
case 'Promise': return 'promise'; | ||
// Set, Map, WeakSet, WeakMap | ||
case 'WeakMap': return 'weakmap'; | ||
case 'WeakSet': return 'weakset'; | ||
case 'Map': return 'map'; | ||
case 'Set': return 'set'; | ||
// 8-bit typed arrays | ||
case 'Int8Array': return 'int8array'; | ||
case 'Uint8Array': return 'uint8array'; | ||
case 'Uint8ClampedArray': return 'uint8clampedarray'; | ||
// 16-bit typed arrays | ||
case 'Int16Array': return 'int16array'; | ||
case 'Uint16Array': return 'uint16array'; | ||
// 32-bit typed arrays | ||
case 'Int32Array': return 'int32array'; | ||
case 'Uint32Array': return 'uint32array'; | ||
case 'Float32Array': return 'float32array'; | ||
case 'Float64Array': return 'float64array'; | ||
} | ||
if (isGeneratorObj(val)) { | ||
return 'generator'; | ||
} | ||
// Non-plain objects | ||
type = toString.call(val); | ||
switch (type) { | ||
case '[object Object]': return 'object'; | ||
// iterators | ||
case '[object Map Iterator]': return 'mapiterator'; | ||
case '[object Set Iterator]': return 'setiterator'; | ||
case '[object String Iterator]': return 'stringiterator'; | ||
case '[object Array Iterator]': return 'arrayiterator'; | ||
} | ||
// other | ||
return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); | ||
}; | ||
function ctorName(val) { | ||
return typeof val.constructor === 'function' ? val.constructor.name : null; | ||
} | ||
function isArray(val) { | ||
if (Array.isArray) return Array.isArray(val); | ||
return val instanceof Array; | ||
} | ||
function isError(val) { | ||
return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'); | ||
} | ||
function isDate(val) { | ||
if (val instanceof Date) return true; | ||
return typeof val.toDateString === 'function' | ||
&& typeof val.getDate === 'function' | ||
&& typeof val.setDate === 'function'; | ||
} | ||
function isRegexp(val) { | ||
if (val instanceof RegExp) return true; | ||
return typeof val.flags === 'string' | ||
&& typeof val.ignoreCase === 'boolean' | ||
&& typeof val.multiline === 'boolean' | ||
&& typeof val.global === 'boolean'; | ||
} | ||
function isGeneratorFn(name, val) { | ||
return ctorName(name) === 'GeneratorFunction'; | ||
} | ||
function isGeneratorObj(val) { | ||
return typeof val.throw === 'function' | ||
&& typeof val.return === 'function' | ||
&& typeof val.next === 'function'; | ||
} | ||
function isArguments(val) { | ||
try { | ||
if (typeof val.length === 'number' && typeof val.callee === 'function') { | ||
return true; | ||
} | ||
} catch (err) { | ||
if (err.message.indexOf('callee') !== -1) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
/** | ||
* If you need to support Safari 5-7 (8-10 yr-old browser), | ||
* take a look at https://github.com/feross/is-buffer | ||
* pick from {@link https://github.com/jonschlinkert/shallow-clone shallow-clone} | ||
* @param val | ||
*/ | ||
function isBuffer(val) { | ||
if (val.constructor && typeof val.constructor.isBuffer === 'function') { | ||
return val.constructor.isBuffer(val); | ||
} | ||
return false; | ||
} | ||
const valueOf = Symbol.prototype.valueOf; | ||
const typeOf$1 = kindOf; | ||
function clone$1(val, deep) { | ||
switch (typeOf$1(val)) { | ||
case 'array': | ||
function clone(val) { | ||
switch (kindOf(val)) { | ||
case "array": | ||
return val.slice(); | ||
case 'object': | ||
case "object": | ||
return Object.assign({}, val); | ||
case 'date': | ||
case "date": | ||
return new val.constructor(Number(val)); | ||
case 'map': | ||
case "map": | ||
return new Map(val); | ||
case 'set': | ||
case "set": | ||
return new Set(val); | ||
case 'buffer': | ||
case "buffer": | ||
return cloneBuffer(val); | ||
case 'symbol': | ||
case "symbol": | ||
return cloneSymbol(val); | ||
case 'arraybuffer': | ||
case "arraybuffer": | ||
return cloneArrayBuffer(val); | ||
case 'float32array': | ||
case 'float64array': | ||
case 'int16array': | ||
case 'int32array': | ||
case 'int8array': | ||
case 'uint16array': | ||
case 'uint32array': | ||
case 'uint8clampedarray': | ||
case 'uint8array': | ||
case "float32array": | ||
case "float64array": | ||
case "int16array": | ||
case "int32array": | ||
case "int8array": | ||
case "uint16array": | ||
case "uint32array": | ||
case "uint8clampedarray": | ||
case "uint8array": | ||
return cloneTypedArray(val); | ||
case 'regexp': | ||
case "regexp": | ||
return cloneRegExp(val); | ||
case 'error': | ||
case "error": | ||
return Object.create(val); | ||
@@ -907,3 +780,3 @@ default: { | ||
function cloneRegExp(val) { | ||
const flags = val.flags !== void 0 ? val.flags : (/\w+$/.exec(val) || void 0); | ||
const flags = val.flags !== void 0 ? val.flags : /\w+$/.exec(val) || void 0; | ||
const re = new val.constructor(val.source, flags); | ||
@@ -920,3 +793,3 @@ re.lastIndex = val.lastIndex; | ||
function cloneTypedArray(val, deep) { | ||
function cloneTypedArray(val) { | ||
return new val.constructor(val.buffer, val.byteOffset, val.length); | ||
@@ -937,53 +810,10 @@ } | ||
/** | ||
* Expose `clone` | ||
*/ | ||
var shallowClone = clone$1; | ||
var isobject = function isObject(val) { | ||
return val != null && typeof val === 'object' && Array.isArray(val) === false; | ||
}; | ||
var isObject = isobject; | ||
function isObjectObject(o) { | ||
return isObject(o) === true | ||
&& Object.prototype.toString.call(o) === '[object Object]'; | ||
} | ||
var isPlainObject$1 = function isPlainObject(o) { | ||
var ctor,prot; | ||
if (isObjectObject(o) === false) return false; | ||
// If has modified constructor | ||
ctor = o.constructor; | ||
if (typeof ctor !== 'function') return false; | ||
// If has modified prototype | ||
prot = ctor.prototype; | ||
if (isObjectObject(prot) === false) return false; | ||
// If constructor does not have an Object-specific method | ||
if (prot.hasOwnProperty('isPrototypeOf') === false) { | ||
return false; | ||
} | ||
// Most likely a plain Object | ||
return true; | ||
}; | ||
/** | ||
* Module dependenices | ||
*/ | ||
const clone = shallowClone; | ||
const typeOf = kindOf; | ||
const isPlainObject = isPlainObject$1; | ||
function cloneDeep(val, instanceClone) { | ||
switch (typeOf(val)) { | ||
case 'object': | ||
switch (kindOf(val)) { | ||
case "object": | ||
return cloneObjectDeep(val, instanceClone); | ||
case 'array': | ||
case "array": | ||
return cloneArrayDeep(val, instanceClone); | ||
@@ -997,3 +827,3 @@ default: { | ||
function cloneObjectDeep(val, instanceClone) { | ||
if (typeof instanceClone === 'function') { | ||
if (typeof instanceClone === "function") { | ||
return instanceClone(val); | ||
@@ -1019,8 +849,2 @@ } | ||
/** | ||
* Expose `cloneDeep` | ||
*/ | ||
var cloneDeep_1 = cloneDeep; | ||
var dist = {}; | ||
@@ -1045,3 +869,2 @@ | ||
exports.Logger = Logger; | ||
exports.__moduleExports = cloneDeep_1; | ||
exports.base64 = base64; | ||
@@ -1054,2 +877,3 @@ exports.camelCase = camelCase; | ||
exports.clamp = clamp; | ||
exports.cloneDeep = cloneDeep; | ||
exports.constantCase = constantCase; | ||
@@ -1062,6 +886,6 @@ exports.debounce = debounce; | ||
exports.isEmpty = isEmpty; | ||
exports.isObject = isObject$1; | ||
exports.isPlainObject = isPlainObject$2; | ||
exports.isObject = isObject; | ||
exports.isPlainObject = isPlainObject; | ||
exports.isString = isString; | ||
exports.kindOf = kindOf$1; | ||
exports.kindOf = kindOf; | ||
exports.noCase = noCase; | ||
@@ -1068,0 +892,0 @@ exports.omit = omit; |
{ | ||
"name": "@deboxsoft/module-core", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"license": "SEE LICENSE IN LICENSE", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -13,3 +13,3 @@ export * from "change-case"; | ||
export * from "./omit"; | ||
export * from "clone-deep"; | ||
export * from "./clone-deep"; | ||
export * from "./base64"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
71765
1901