@marxlnfcs/dotize
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -40,2 +40,6 @@ export type IDotizeDotifyArrayMode = 'dotify' | 'dotify-bracket' | 'dotify-curly-bracket' | 'keep'; | ||
maxDepth: number; | ||
/** | ||
* With the filter you can control if the object should be dotified or not | ||
*/ | ||
filter: (object: any) => boolean; | ||
} | ||
@@ -42,0 +46,0 @@ export type IDotified = { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.dotify = void 0; | ||
exports.dotify = dotify; | ||
const utils_1 = require("../utils/utils"); | ||
@@ -17,5 +17,5 @@ function dotify(object, options) { | ||
maxDepth: (options === null || options === void 0 ? void 0 : options.maxDepth) || 0, | ||
filter: (options === null || options === void 0 ? void 0 : options.filter) || null, | ||
}, 0); | ||
} | ||
exports.dotify = dotify; | ||
function _dotify(object, prefix, options, depth) { | ||
@@ -34,3 +34,4 @@ // create base dotified object | ||
// return primitive types, functions or array if options.arrayMode is 'keep' | ||
if ((0, utils_1.isNil)(object) || | ||
if ((options.filter && !options.filter(object)) || | ||
(0, utils_1.isNil)(object) || | ||
(0, utils_1.isPrimitive)(object) || | ||
@@ -40,2 +41,4 @@ //(isArray(object) && options.arrayMode === 'keep') || | ||
(0, utils_1.isFunction)(object) || | ||
(0, utils_1.isBuffer)(object) || | ||
(0, utils_1.isDate)(object) || | ||
(options.maxDepth > 0 && depth >= options.maxDepth)) { | ||
@@ -42,0 +45,0 @@ return createDotifiedObject(); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parse = void 0; | ||
exports.parse = parse; | ||
const utils_1 = require("../utils/utils"); | ||
@@ -13,3 +13,2 @@ function parse(object, options) { | ||
} | ||
exports.parse = parse; | ||
function _parse(object, options) { | ||
@@ -16,0 +15,0 @@ // return original value if not object |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isString = exports.isBoolean = exports.isNumber = exports.isPrimitive = exports.isFunction = exports.isArray = exports.isObject = exports.isNil = void 0; | ||
exports.isNil = isNil; | ||
exports.isObject = isObject; | ||
exports.isArray = isArray; | ||
exports.isFunction = isFunction; | ||
exports.isPrimitive = isPrimitive; | ||
exports.isNumber = isNumber; | ||
exports.isBoolean = isBoolean; | ||
exports.isString = isString; | ||
exports.isDate = isDate; | ||
exports.isBuffer = isBuffer; | ||
/** @internal */ | ||
@@ -8,3 +17,2 @@ function isNil(n) { | ||
} | ||
exports.isNil = isNil; | ||
/** @internal */ | ||
@@ -14,3 +22,2 @@ function isObject(n) { | ||
} | ||
exports.isObject = isObject; | ||
/** @internal */ | ||
@@ -20,3 +27,2 @@ function isArray(n) { | ||
} | ||
exports.isArray = isArray; | ||
/** @internal */ | ||
@@ -26,3 +32,2 @@ function isFunction(n) { | ||
} | ||
exports.isFunction = isFunction; | ||
/** @internal */ | ||
@@ -32,3 +37,2 @@ function isPrimitive(n) { | ||
} | ||
exports.isPrimitive = isPrimitive; | ||
/** @internal */ | ||
@@ -38,3 +42,2 @@ function isNumber(n) { | ||
} | ||
exports.isNumber = isNumber; | ||
/** @internal */ | ||
@@ -44,3 +47,2 @@ function isBoolean(n) { | ||
} | ||
exports.isBoolean = isBoolean; | ||
/** @internal */ | ||
@@ -50,3 +52,10 @@ function isString(n) { | ||
} | ||
exports.isString = isString; | ||
/** @internal */ | ||
function isDate(n) { | ||
return n instanceof Date; | ||
} | ||
/** @internal */ | ||
function isBuffer(n) { | ||
return Buffer.isBuffer(n); | ||
} | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@marxlnfcs/dotize", | ||
"private": false, | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "A Typescript library to convert complex objects/arrays to dotized key-value object", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -0,0 +0,0 @@ <p align="center" style="font-size: 40px;">Dotize</p> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
381
51502