array_typer

1.0.0 • Public • Published

array_typer

A Node.js module that create an array or dictionnary of generic type object from an array of Object

Installation

npm install ts_parser --save

Usage

Javascript

var arrayTyper = require('array_typer');

var MyObject = /** @class */ (function () {
  function MyObject(json) {
      this.key = json.key;
  }
  return MyObject;
}());

var json = [{"key": 1},{"key": 2}]

var typedArray = index.typeArray(MyObject, json);

TypeScript

import { typeArray } from 'array_typer';

var json = [{"key": 1},{"key": 2}]

class MyObject
{
  key : number = -1;

  constructor(json: any)
  {
    this.key = json.key
  }
}

var typedArray: MyObject[] = typeArray(MyObject, json));

Test

npm run test

Readme

Keywords

none

Package Sidebar

Install

npm i array_typer

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

11.4 kB

Total Files

7

Last publish

Collaborators

  • franzstrudel