@equinor/echo-base
Advanced tools
Comparing version 0.6.11 to 0.6.12
@@ -131,6 +131,8 @@ import { __extends } from "tslib"; | ||
var value = object[name]; | ||
var valueType = typeof value; | ||
if (valueType === 'function' || isPropertyIgnored(name, args)) { | ||
if (typeof value === 'function' || isPropertyIgnored(name, args)) { | ||
//ignore | ||
} | ||
else if (Array.isArray(value)) { | ||
rec[name] = value; | ||
} | ||
else if (!!value && typeof value === 'object') { | ||
@@ -137,0 +139,0 @@ rec[name] = getAllProperties(value, args); |
@@ -135,6 +135,8 @@ "use strict"; | ||
var value = object[name]; | ||
var valueType = typeof value; | ||
if (valueType === 'function' || isPropertyIgnored(name, args)) { | ||
if (typeof value === 'function' || isPropertyIgnored(name, args)) { | ||
//ignore | ||
} | ||
else if (Array.isArray(value)) { | ||
rec[name] = value; | ||
} | ||
else if (!!value && typeof value === 'object') { | ||
@@ -141,0 +143,0 @@ rec[name] = getAllProperties(value, args); |
{ | ||
"name": "@equinor/echo-base", | ||
"version": "0.6.11", | ||
"version": "0.6.12", | ||
"module": "esm/index.js", | ||
@@ -34,5 +34,5 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@types/node": "^17.0.42", | ||
"typedoc": "^0.22.17", | ||
"typescript": "^4.7.3" | ||
"@types/node": "^18.0.3", | ||
"typedoc": "^0.23.5", | ||
"typescript": "^4.7.4" | ||
}, | ||
@@ -39,0 +39,0 @@ "files": [ |
@@ -180,2 +180,21 @@ import { BaseError, findPropertyByName, getAllProperties } from './BaseError'; | ||
}); | ||
it('should find and return properties of different types: string, number, array ', () => { | ||
const record = { | ||
aString: 'name', | ||
aNumber: 0, | ||
anEmptyString: '', | ||
nested: { anArray: ['a', 'b'] }, | ||
aNullValue: null, | ||
anUndefined: undefined | ||
}; | ||
expect(findPropertyByName(record, 'aString')).toBe('name'); | ||
expect(findPropertyByName(record, 'aNumber')).toBe(0); | ||
expect(findPropertyByName(record, 'anEmptyString')).toBe(''); | ||
expect(findPropertyByName(record, 'nested')).toStrictEqual({ anArray: ['a', 'b'] }); | ||
expect(findPropertyByName(record, 'anArray')).toStrictEqual(['a', 'b']); | ||
expect(findPropertyByName(record, 'aNullValue')).toBe(null); | ||
expect(findPropertyByName(record, 'anUndefined')).toBe(undefined); | ||
}); | ||
}); | ||
@@ -182,0 +201,0 @@ |
@@ -151,5 +151,6 @@ import { BaseErrorArgs } from '../types/error'; | ||
const value = object[name]; | ||
const valueType = typeof value; | ||
if (valueType === 'function' || isPropertyIgnored(name, args)) { | ||
if (typeof value === 'function' || isPropertyIgnored(name, args)) { | ||
//ignore | ||
} else if (Array.isArray(value)) { | ||
rec[name] = value; | ||
} else if (!!value && typeof value === 'object') { | ||
@@ -156,0 +157,0 @@ rec[name] = getAllProperties(value, args); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
297299
5898