@br88c/node-utils
Advanced tools
Comparing version
@@ -27,4 +27,4 @@ "use strict"; | ||
case `[object ArrayBuffer]`: { | ||
const clone = new obj.buffer.constructor(obj.buffer.byteLength); | ||
new Uint8Array(clone).set(new Uint8Array(obj.buffer)); | ||
const clone = new obj.constructor(obj.byteLength); | ||
new Uint8Array(clone).set(new Uint8Array(obj)); | ||
return clone; | ||
@@ -62,5 +62,2 @@ } | ||
} | ||
case `[object Symbol]`: { | ||
return Object(Symbol.prototype.valueOf.call(obj)); | ||
} | ||
case `[object Float32Array]`: | ||
@@ -80,3 +77,3 @@ case `[object Float64Array]`: | ||
default: { | ||
const prototype = (Object.getPrototypeOf ? Object.getPrototypeOf(obj) : obj.__proto__); | ||
const prototype = Object.getPrototypeOf(obj); | ||
const clone = Object.create(prototype); | ||
@@ -83,0 +80,0 @@ Object.keys(obj).forEach((key) => { |
@@ -18,11 +18,23 @@ "use strict"; | ||
traversedProps.add(currentObj); | ||
Object.keys(currentObj).forEach((key) => { | ||
const value = currentObj[key]; | ||
if (Array.isArray(value)) { | ||
value.forEach((v, i) => traverse(v, path.concat(key, i))); | ||
} | ||
else if (currentObj[key] !== null && typeof currentObj[key] === `object`) { | ||
traverse(value, path.concat(key)); | ||
} | ||
}); | ||
if (Array.isArray(currentObj)) { | ||
currentObj.forEach((value, i) => { | ||
if (Array.isArray(value)) { | ||
value.forEach((v, ii) => traverse(v, path.concat(i, ii))); | ||
} | ||
else if (value !== null && typeof value === `object`) { | ||
traverse(value, path.concat(i)); | ||
} | ||
}); | ||
} | ||
else { | ||
Object.keys(currentObj).forEach((key) => { | ||
const value = currentObj[key]; | ||
if (Array.isArray(value)) { | ||
value.forEach((v, i) => traverse(v, path.concat(key, i))); | ||
} | ||
else if (value !== null && typeof value === `object`) { | ||
traverse(value, path.concat(key)); | ||
} | ||
}); | ||
} | ||
}; | ||
@@ -29,0 +41,0 @@ traverse(obj); |
export { containsDuplicates } from './functions/containsDuplicates'; | ||
export { deepClone } from './functions/deepClone'; | ||
export { deepEquals } from './functions/deepEquals'; | ||
export { deepFreeze } from './functions/deepFreeze'; | ||
@@ -13,3 +12,2 @@ export { flattenObject } from './functions/flattenObject'; | ||
export { traverseObject } from './functions/traverseObject'; | ||
export { wait } from './functions/wait'; | ||
export { ExtendedMap } from './structures/ExtendedMap'; | ||
@@ -16,0 +14,0 @@ export { Logger, LoggerEvents, LoggerFormat, LoggerLevel, LoggerMessageOptions, LoggerOptions, LoggerRawFormats } from './structures/Logger'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TypedEmitter = exports.LoggerRawFormats = exports.Logger = exports.ExtendedMap = exports.wait = exports.traverseObject = exports.to2dArray = exports.timestamp = exports.shuffleArray = exports.sanitizeTokens = exports.plural = exports.getCircular = exports.flattenObject = exports.deepFreeze = exports.deepEquals = exports.deepClone = exports.containsDuplicates = void 0; | ||
exports.TypedEmitter = exports.LoggerRawFormats = exports.Logger = exports.ExtendedMap = exports.traverseObject = exports.to2dArray = exports.timestamp = exports.shuffleArray = exports.sanitizeTokens = exports.plural = exports.getCircular = exports.flattenObject = exports.deepFreeze = exports.deepClone = exports.containsDuplicates = void 0; | ||
var containsDuplicates_1 = require("./functions/containsDuplicates"); | ||
@@ -8,4 +8,2 @@ Object.defineProperty(exports, "containsDuplicates", { enumerable: true, get: function () { return containsDuplicates_1.containsDuplicates; } }); | ||
Object.defineProperty(exports, "deepClone", { enumerable: true, get: function () { return deepClone_1.deepClone; } }); | ||
var deepEquals_1 = require("./functions/deepEquals"); | ||
Object.defineProperty(exports, "deepEquals", { enumerable: true, get: function () { return deepEquals_1.deepEquals; } }); | ||
var deepFreeze_1 = require("./functions/deepFreeze"); | ||
@@ -29,4 +27,2 @@ Object.defineProperty(exports, "deepFreeze", { enumerable: true, get: function () { return deepFreeze_1.deepFreeze; } }); | ||
Object.defineProperty(exports, "traverseObject", { enumerable: true, get: function () { return traverseObject_1.traverseObject; } }); | ||
var wait_1 = require("./functions/wait"); | ||
Object.defineProperty(exports, "wait", { enumerable: true, get: function () { return wait_1.wait; } }); | ||
var ExtendedMap_1 = require("./structures/ExtendedMap"); | ||
@@ -33,0 +29,0 @@ Object.defineProperty(exports, "ExtendedMap", { enumerable: true, get: function () { return ExtendedMap_1.ExtendedMap; } }); |
@@ -85,7 +85,2 @@ import { TypedEmitter } from './TypedEmitter'; | ||
/** | ||
* The format for the thread. | ||
* @default [`BRIGHT`, `WHITE`] | ||
*/ | ||
thread?: LoggerFormat | LoggerFormat[]; | ||
/** | ||
* The format for the system. | ||
@@ -92,0 +87,0 @@ * @default [`BRIGHT`, `WHITE`] |
@@ -104,3 +104,2 @@ "use strict"; | ||
}, | ||
thread: this._combineFormats(formats.thread ?? [`BRIGHT`, `WHITE`]), | ||
system: this._combineFormats(formats.system ?? [`BRIGHT`, `WHITE`]), | ||
@@ -107,0 +106,0 @@ message: this._combineFormats(formats.message ?? `WHITE`) |
{ | ||
"name": "@br88c/node-utils", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Simple utilities for Node.js", | ||
@@ -10,12 +10,6 @@ "main": "./dist/index.js", | ||
"build": "rm -rf ./dist && tsc && cp ./src/structures/TypedEmitter.* ./dist/structures/", | ||
"build:install": "npm i --also=dev && npm run build", | ||
"docs": "rm -rf ./docs && typedoc", | ||
"docs:install": "npm i --also=dev && npm run docs", | ||
"lint": "eslint ./src", | ||
"lint:fix": "eslint ./src --fix", | ||
"lint:install": "npm i --also=dev && npm run lint", | ||
"prepublishOnly": "npm run build:install", | ||
"test:build": "npm run build:install", | ||
"test:docs": "npm run docs:install", | ||
"test:lint": "npm run lint:install" | ||
"prepublishOnly": "npm i --also=dev && npm run build" | ||
}, | ||
@@ -36,5 +30,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"@br88c/eslint-config": "^1.4.0", | ||
"@types/node": "^16.11.34", | ||
"eslint": "^8.15.0", | ||
"@br88c/eslint-config": "^1.5.0", | ||
"@types/node": "^16.11.36", | ||
"eslint": "^8.16.0", | ||
"typedoc": "^0.22.15", | ||
@@ -41,0 +35,0 @@ "typescript": "^4.6.4" |
72224
-2.94%39
-9.3%1412
-3.29%