constructor-utils
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -24,2 +24,4 @@ "use strict"; | ||
var _this = this; | ||
if (!(json instanceof Array)) | ||
throw new Error("Cannot convert given data to array of constructors. Given object is not an array."); | ||
return json.map(function (item) { return _this.plainToConstructor(cls, item, options); }); | ||
@@ -26,0 +28,0 @@ }; |
{ | ||
"name": "constructor-utils", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "Constructor utilities to simplify work with classes and constructors. Provides plain javascript objects to classes transformation utilities.", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -8,2 +8,6 @@ # constructor-utils | ||
**0.0.16** | ||
* renamed `constructor-utils` to `constructor-utils` package namespace. | ||
**0.0.15** | ||
@@ -21,3 +25,3 @@ | ||
* Library has changed its name from `serializer.ts` to `constructor-utils`. | ||
* Added `constructor-utils/constructor-utils` namespace. | ||
* Added `constructor-utils` namespace. | ||
@@ -30,3 +34,16 @@ ## Installation | ||
`npm install constructor-utils --save` | ||
2. If you are using system.js you may want to add this into `map` and `package` config: | ||
```json | ||
{ | ||
"map": { | ||
"constructor-utils": "node_modules/constructor-utils" | ||
}, | ||
"packages": { | ||
"constructor-utils": { "main": "index.js", "defaultExtension": "js" } | ||
} | ||
} | ||
``` | ||
2. Use [typings](https://github.com/typings/typings) to install all required definition dependencies. | ||
@@ -114,3 +131,3 @@ | ||
```javascript | ||
import {plainToConstructor, plainToConstructorArray} from "constructor-utils/constructor-utils"; | ||
import {plainToConstructor, plainToConstructorArray} from "constructor-utils"; | ||
@@ -127,3 +144,3 @@ let users = plainToConstructor(User, userJson); // to convert user plain object a single user | ||
```javascript | ||
import {constructorToPlain} from "constructor-utils/constructor-utils"; | ||
import {constructorToPlain} from "constructor-utils"; | ||
let photo = constructorToPlain(photo); | ||
@@ -144,3 +161,3 @@ ``` | ||
```javascript | ||
import {Type, plainToConstructor} from "constructor-utils/constructor-utils"; | ||
import {Type, plainToConstructor} from "constructor-utils"; | ||
@@ -172,3 +189,3 @@ export class Album { | ||
```javascript | ||
import {Skip} from "constructor-utils/constructor-utils"; | ||
import {Skip} from "constructor-utils"; | ||
@@ -196,3 +213,3 @@ export class User { | ||
```javascript | ||
import {Skip, Type} from "constructor-utils/constructor-utils"; | ||
import {Skip, Type} from "constructor-utils"; | ||
@@ -223,3 +240,3 @@ export class User { | ||
```javascript | ||
import {ArrayType} from "constructor-utils/constructor-utils"; | ||
import {ArrayType} from "constructor-utils"; | ||
@@ -248,3 +265,3 @@ export class AlbumCollection extends Array<Album> { | ||
```javascript | ||
import {plainToConstructorArray} from "constructor-utils/constructor-utils"; | ||
import {plainToConstructorArray} from "constructor-utils"; | ||
@@ -251,0 +268,0 @@ this.http |
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
28251
442
274