@angular-builders/timestamp
Advanced tools
Comparing version 10.0.1-beta.2 to 10.0.1-beta.3
@@ -6,2 +6,10 @@ # Change Log | ||
## <small>10.0.1-beta.3 (2020-08-11)</small> | ||
* chore(deps-dev): bump karma-jasmine from 3.3.1 to 4.0.0 ([03cc6c7](https://github.com/just-jeb/angular-builders/tree/master/packages/timestamp/commit/03cc6c7)) | ||
## <small>10.0.1-beta.2 (2020-08-01)</small> | ||
@@ -8,0 +16,0 @@ |
@@ -23,3 +23,6 @@ "use strict"; | ||
exports.Convert = Convert; | ||
function invalidValue(typ, val) { | ||
function invalidValue(typ, val, key = '') { | ||
if (key) { | ||
throw Error(`Invalid value for key "${key}". Expected type ${JSON.stringify(typ)} but got ${JSON.stringify(val)}`); | ||
} | ||
throw Error(`Invalid value ${JSON.stringify(val)} for type ${JSON.stringify(typ)}`); | ||
@@ -43,7 +46,7 @@ } | ||
} | ||
function transform(val, typ, getProps) { | ||
function transform(val, typ, getProps, key = '') { | ||
function transformPrimitive(typ, val) { | ||
if (typeof typ === typeof val) | ||
return val; | ||
return invalidValue(typ, val); | ||
return invalidValue(typ, val, key); | ||
} | ||
@@ -91,7 +94,7 @@ function transformUnion(typs, val) { | ||
const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; | ||
result[prop.key] = transform(v, prop.typ, getProps); | ||
result[prop.key] = transform(v, prop.typ, getProps, prop.key); | ||
}); | ||
Object.getOwnPropertyNames(val).forEach(key => { | ||
if (!Object.prototype.hasOwnProperty.call(props, key)) { | ||
result[key] = transform(val[key], additional, getProps); | ||
result[key] = transform(val[key], additional, getProps, key); | ||
} | ||
@@ -98,0 +101,0 @@ }); |
{ | ||
"name": "@angular-builders/timestamp", | ||
"version": "10.0.1-beta.2", | ||
"version": "10.0.1-beta.3", | ||
"repository": { | ||
@@ -35,3 +35,3 @@ "type": "git", | ||
}, | ||
"gitHead": "2ea9b2c1b9634760fab3594692e3fa2692641d92" | ||
"gitHead": "18559d3c60c7f5a0ecb11e8fd131b826f580de02" | ||
} |
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
27905
218