json2typescript
Advanced tools
Comparing version 0.9.3 to 0.9.4
{ | ||
"name": "json2typescript", | ||
"version": "0.9.3", | ||
"version": "0.9.4", | ||
"description": "Provides TypeScript methods to map a JSON string to a JavaScript object on runtime", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -26,2 +26,3 @@ # json2typescript | ||
* v0.9.4: Class properties are now not overridden to `undefined` if there is no decorator and no matching json value. | ||
* v0.9.3: It is now possible to map an JSON object to an TypeScript array, then the object keys become the array keys. Also, class properties can be set to optional. See below in the chapter "decorators" for more information. | ||
@@ -28,0 +29,0 @@ * v0.9.2: Added method `serializeString()`, changed `property` names and behaviour |
/** | ||
* Offers a simple API for mapping json objects to TypeScript/JavaScript classes and vice versa. | ||
* @author Andreas Aeschlimann, DHlab, University of Basel, Switzerland | ||
* @version 0.9.3 | ||
* @version 0.9.4 | ||
* @licence MIT | ||
@@ -158,4 +158,9 @@ * @see https://www.npmjs.com/package/json2typescript full documentation | ||
if (JsonConvert.deserializeObject_propertyHasDecorator(mapping, propertyKey) === false) { | ||
classInstance[propertyKey] = json[propertyKey]; | ||
// Make sure values are not overridden by undefined json values | ||
if (typeof(json[propertyKey]) !== "undefined") | ||
classInstance[propertyKey] = json[propertyKey]; | ||
return; | ||
} | ||
@@ -162,0 +167,0 @@ |
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
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
34263
386
2
411