# immutato

> immutable and typed js data structures

Latest version **0.3.0** (published 2014-11-21) · 0 weekly downloads

## Install

```sh
npm install immutato
pnpm add immutato
yarn add immutato
bun add immutato
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2014-11-21 |
| First published | 2014-11-06 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.26 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Andrea Parodi |
| Maintainers | parroit |
| Keywords | immutable, data, structure, structures, type, assertion, js |

## Links

- npm: https://www.npmjs.com/package/immutato
- Repository: https://github.com/immutato/immutato
- Issues: https://github.com/immutato/immutato/issues
- npm.io page: https://npm.io/package/immutato

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.3.0 (latest) — 2014-11-21
- 0.1.0 — 2014-11-06

## README

# immutato 

immutable and typed js data structures

[![Build Status](https://secure.travis-ci.org/immutato/immutato.png?branch=master)](http://travis-ci.org/immutato/immutato) [![NPM version](https://badge-me.herokuapp.com/api/npm/immutato.png)](http://badges.enytc.com/for/npm/immutato) [![Code Climate](https://codeclimate.com/github/immutato/immutato.png)](https://codeclimate.com/github/immutato/immutato) [![Test Coverage](https://codeclimate.com/github/immutato/immutato/badges/coverage.svg)](https://codeclimate.com/github/immutato/immutato)

[![Sauce Test Status](https://saucelabs.com/browser-matrix/parroit.svg)](https://saucelabs.com/u/parroit)


## Getting Started
Install the module with: `npm install immutato --save`

```javascript

var i = require('immutato');

//
//  create a "shape"
//
var Person = i('Person', {
    name: '',
    surname: ''
},Person);

//
//  object creation
//
var person = Person({name:'Andrea', surname:'Parodi'});
person.name().should.be.equal('Andrea')
person.surname().should.be.equal('Parodi')

// 
// update a property
//
var renamed = person.name('Gianni');
renamed.name().should.be.equal('Gianni');
renamed.surname().should.be.equal('Parodi');

//
// previous version is still the same
//
person.name().should.be.equal('Andrea');
person.surname().should.be.equal('Parodi');

```

## Features

* Immutable data structure
* Setter methods to create a new immutable object with updated data
* Getter methods to retrieve property values
* Idempotent types (TODO - not implemented)
* Minimize object copy using WeakMap.
* Very fast

## Design 

See [DESIGN.md](DESIGN.md) (TODO - update to current implementation concepts)

## Status 

This is version 0.3 of the module. It is a complete rewrite, so maybe it contains weird things
like bugs or snakes.
Version 0.2 is [still available here](https://github.com/immutato/types). 
It is a bit more stable but [not very performant](https://github.com/immutato/benchmarks).

## Performance

It appear to be very fast. I wrote benchmarks to compare it with Immutable, Ancient Oak
and plain old JavaScript objects (using Object.freeze).
They are a bit biased (written by me) and cover really simple use cases, but it sound promises

[You can see my benchmarks here](https://github.com/immutato/benchmarks)

## Other stuff

* documentation - I will add, I promise.
* support - open an issue [here](https://github.com/immutato/immutato/issues).

## License
[MIT](http://opensource.org/licenses/MIT) © 2014, Andrea Parodi

---
_Source: https://npm.io/package/immutato · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
