ts-immutable-helper
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

ts-immutable-helper

An implementation of ImmutableHelper using TypeScript (TS 2 compatible).

Description

The helper implements basic functionality such as "clone" object and "freeze" object.

Dependencies

Installation

First you need to install the npm module:

npm install ts-immutable-helper --save

Use

import {ImmutableHelper} from 'ts-immutable-helper/index';
 
ImmutableHelper.toClone<IDefinition>({
    a: 1,
    b: ['s1', 's2', {
        b: 1
    }]
});
import {ImmutableHelper} from 'ts-immutable-helper/index';
 
ImmutableHelper.toImmutable<IDefinition>({
    a: 1,
    b: ['s1', 's2', {
        b: 1
    }]
});
import {ImmutableHelper} from 'ts-immutable-helper/index';
 
class Person {
    constructor(private name: string, private id: number) {
    }
 
    getName(): string {
        return this.name;
    }
}
 
ImmutableHelper.toImmutable(new Person("Tomas", 123));

Publish

npm deploy

License

Licensed under MIT.

Readme

Keywords

none

Package Sidebar

Install

npm i ts-immutable-helper

Weekly Downloads

1

Version

0.0.9

License

MIT

Last publish

Collaborators

  • apoterenko