@vendure/common
Advanced tools
Comparing version 0.5.0 to 0.5.1
export declare function notNullOrUndefined<T>(val: T | undefined | null): val is T; | ||
export declare function assertNever(value: never): never; | ||
export declare function isObject(item: any): item is object; | ||
export declare function isClassInstance(item: any): boolean; | ||
export declare function generateAllCombinations<T>(optionGroups: T[][], combination?: T[], k?: number, output?: T[][]): T[][]; |
@@ -11,2 +11,10 @@ "use strict"; | ||
exports.assertNever = assertNever; | ||
function isObject(item) { | ||
return item && typeof item === 'object' && !Array.isArray(item); | ||
} | ||
exports.isObject = isObject; | ||
function isClassInstance(item) { | ||
return isObject(item) && item.constructor.name !== 'Object'; | ||
} | ||
exports.isClassInstance = isClassInstance; | ||
function generateAllCombinations(optionGroups, combination = [], k = 0, output = []) { | ||
@@ -13,0 +21,0 @@ if (k === 0) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const shared_utils_1 = require("./shared-utils"); | ||
function simpleDeepClone(input) { | ||
@@ -17,5 +18,8 @@ if (typeof input !== 'object' || input === null) { | ||
} | ||
if (shared_utils_1.isClassInstance(input)) { | ||
return input; | ||
} | ||
output = {}; | ||
for (i in input) { | ||
if ((input).hasOwnProperty(i)) { | ||
if (input.hasOwnProperty(i)) { | ||
output[i] = simpleDeepClone(input[i]); | ||
@@ -22,0 +26,0 @@ } |
{ | ||
"name": "@vendure/common", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"main": "index.js", | ||
@@ -8,3 +8,5 @@ "license": "MIT", | ||
"watch": "tsc -p ./tsconfig.build.json -w", | ||
"build": "rimraf dist && tsc -p ./tsconfig.build.json" | ||
"build": "rimraf dist && tsc -p ./tsconfig.build.json", | ||
"lint": "tslint --fix --project ./", | ||
"test": "jest --config ./jest.config.js" | ||
}, | ||
@@ -18,7 +20,7 @@ "publishConfig": { | ||
"devDependencies": { | ||
"@types/jest": "^24.0.11", | ||
"rimraf": "^2.6.3", | ||
"@types/jest": "^24.0.21", | ||
"rimraf": "^3.0.0", | ||
"typescript": "~3.5.3" | ||
}, | ||
"gitHead": "0f7c6153af26257de5de146b128a3d779e1aea45" | ||
"gitHead": "c6df5302897f0f9351d1c6f2a3ca7d2690be9b1a" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
187816
39
5309