All Projects → zenika-open-source → Immutadot

zenika-open-source / Immutadot

Licence: mit
immutadot is a JavaScript library to deal with nested immutable structures.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Immutadot

Immutableassign
Lightweight immutable helper that allows you to continue working with POJO (Plain Old JavaScript Object)
Stars: ✭ 161 (-6.94%)
Mutual labels:  immutable, lodash
Alimer
Cross-platform game engine.
Stars: ✭ 172 (-0.58%)
Mutual labels:  open-source
Atutor
NO LONGER USER LEVEL SUPPORTED. CONTRIBUTING DEVELOPERS INTERESTED IN MAINTAINING ATUTOR, SHOULD REQUEST COLLABORATOR ACCESS. : ATutor is an Open Source Web-based Learning Management System (LMS) used to develop and deliver online courses. Administrators can install or update ATutor in minutes, develop custom themes to give ATutor a new look, and easily extend its functionality with feature modules. Educators can quickly assemble, package, and redistribute standardized Web-based instructional content, easily import prepackaged content, and conduct their courses online. Students learn in an accessible, adaptive, social learning environment.
Stars: ✭ 166 (-4.05%)
Mutual labels:  open-source
Airbyte
Airbyte is an open-source EL(T) platform that helps you replicate your data in your warehouses, lakes and databases.
Stars: ✭ 4,919 (+2743.35%)
Mutual labels:  open-source
Android Demos
Examples of Android applications
Stars: ✭ 1,963 (+1034.68%)
Mutual labels:  open-source
Smartthingspublic
SmartThings open-source DeviceTypeHandlers and SmartApps code
Stars: ✭ 2,201 (+1172.25%)
Mutual labels:  open-source
Fundamental Ngx
Angular components implementation of Fundamental Library Styles guidelines. The library is aiming to provide an Angular implementation of the components designed in Fundamental Library Styles.
Stars: ✭ 166 (-4.05%)
Mutual labels:  open-source
Beefun Pro
Github client for iOS in Swift.
Stars: ✭ 172 (-0.58%)
Mutual labels:  open-source
Open Source Tweaks
Tweaks I've left open, maybe someone can learn from/correct them.
Stars: ✭ 170 (-1.73%)
Mutual labels:  open-source
Fundamental Vue
Vue.js components implementation of Fundamental Library Styles guidelines. The library is aiming to provide a Vue.js implementation of the components designed in Fundamental Library Styles.
Stars: ✭ 169 (-2.31%)
Mutual labels:  open-source
Copyright Header
© Copyright Header is a utility to manipulate software licenses on source code.
Stars: ✭ 168 (-2.89%)
Mutual labels:  open-source
Deep Bci
An open software package to develop BCI based brain and cognitive computing technology for recognizing user's intention using deep learning
Stars: ✭ 168 (-2.89%)
Mutual labels:  open-source
Wiki
Wiki.js | A modern and powerful wiki app built on Node.js
Stars: ✭ 14,985 (+8561.85%)
Mutual labels:  open-source
Openpokemonred
WIP: An open-source re-implementation of Pokémon Red
Stars: ✭ 168 (-2.89%)
Mutual labels:  open-source
Books Collection
To the programmer's open source and free books collection 给程序员的开源、免费书籍收集,图书集合。
Stars: ✭ 2,188 (+1164.74%)
Mutual labels:  open-source
Startbootstrap Thumbnail Gallery
A Bootstrap thumbnail gallery template created by Start Bootstrap
Stars: ✭ 166 (-4.05%)
Mutual labels:  open-source
Im android
GoBelieveIO IM android sdk
Stars: ✭ 167 (-3.47%)
Mutual labels:  open-source
Swifthub
GitHub iOS client in RxSwift and MVVM-C clean architecture
Stars: ✭ 2,330 (+1246.82%)
Mutual labels:  open-source
Extcore
An extended core library for F#.
Stars: ✭ 172 (-0.58%)
Mutual labels:  immutable
React Native Dribbble App
Dribbble app built with React Native
Stars: ✭ 2,019 (+1067.05%)
Mutual labels:  open-source

immutadot logo

A JavaScript library to deal with nested immutable structures.

set({ english: { greeting: 'Hi' } }, 'english.greeting', 'Hello')
// → { english: { greeting: 'Hello' } }

push({ i18n: { languages: ['English', 'French'] } }, 'i18n.languages', 'German', 'Spanish')
// → { i18n: { languages: ['English', 'French', 'German', 'Spanish'] } }

immutadot gives you a short and meaningful syntax to apply operations on immutable structures.

npm version Try on RunKit Documentation

CircleCI codecov gitmoji-changelog

🚧 I'm currently rewriting immutadot

Hi 👋, I'm currently rewriting entirely immutadot, and hopefully I will publish a v3 very soon (v2 never reached a satisfying state).

Here is a pick at the new API which uses tagged template literals:

import { set } from 'immutadot'

const animals = {
  weasels: {
    lutraLutra: {
      commonNames: ['eurasian otter'],
    },
  },
}

const newAnimals = set`${animals}.weasels.lutraLutra.name'('Lutrinae')

Check out the v3 branch if you're interested.

Installation

immutadot is available on npm repository.

using yarn:

$ yarn add immutadot

using npm:

$ npm install immutadot

Usage

ES modules:

import { set } from 'immutadot'

CommonJS:

const { set } = require('immutadot')

Example

Quickly set nested properties using set()

import { set } from 'immutadot'

const animals = {
  weasels: {
    lutraLutra: {
      commonNames: ['eurasian otter'],
    },
  },
}

const newAnimals = set(animals, 'weasels.lutraLutra.name', 'Lutrinae')

Learn more about what immutadot can do in the Getting started.

Feel free to try immutadot on runkit.

Documentation

Getting started

A fast overview of immutadot's features is available in the Getting started guide.

API

The detailed API documentations of the different packages are available here:

Looking for older versions API documentation? Links are available here.

Performances

A simple benchmark (freely inspired from one made by mweststrate for immer) reveals that immutadot shows good results compared to other libraries.

⚠️ The following results should be taken with caution, they may vary depending on the hardware, the JavaScript engine, and the kind of operations performed. This particular test updates 10% out of a list of todos items, and was ran with Node 9.8.0 on an Intel® Core™ i7-6560U CPU @ 2.20GHz.

Update small todos list (1000 items):
  ES2015 destructuring: ~17775ops/s (0.06ms/op) on 50000ops
  immutable 3.8.2 (w/o conversion to plain JS objects): ~6737ops/s (0.15ms/op) on 50000ops
  immutable 3.8.2 (w/ conversion to plain JS objects): ~109ops/s (9.17ms/op) on 3274ops
  immer 1.2.0 (proxy implementation w/o autofreeze): ~1132ops/s (0.88ms/op) on 34025ops
  immer 1.2.0 (ES5 implementation w/o autofreeze): ~521ops/s (1.92ms/op) on 15680ops
  qim 0.0.52: ~12042ops/s (0.08ms/op) on 50000ops
  immutadot 1.0.0: ~2351ops/s (0.43ms/op) on 50000ops
Update medium todos list (10000 items):
  ES2015 destructuring: ~1801ops/s (0.56ms/op) on 5000ops
  immutable 3.8.2 (w/o conversion to plain JS objects): ~630ops/s (1.59ms/op) on 5000ops
  immutable 3.8.2 (w/ conversion to plain JS objects): ~10ops/s (95.70ms/op) on 314ops
  immer 1.2.0 (proxy implementation w/o autofreeze): ~111ops/s (9.04ms/op) on 3319ops
  immer 1.2.0 (ES5 implementation w/o autofreeze): ~51ops/s (19.76ms/op) on 1519ops
  qim 0.0.52: ~1257ops/s (0.80ms/op) on 5000ops
  immutadot 1.0.0: ~234ops/s (4.28ms/op) on 5000ops
Update large todos list (100000 items):
  ES2015 destructuring: ~120ops/s (8.34ms/op) on 500ops
  immutable 3.8.2 (w/o conversion to plain JS objects): ~58ops/s (17.28ms/op) on 500ops
  immutable 3.8.2 (w/ conversion to plain JS objects): ~1ops/s (998.81ms/op) on 31ops
  immer 1.2.0 (proxy implementation w/o autofreeze): ~21ops/s (48.68ms/op) on 500ops
  immer 1.2.0 (ES5 implementation w/o autofreeze): ~4ops/s (264.16ms/op) on 114ops
  qim 0.0.52: ~91ops/s (11.01ms/op) on 500ops
  immutadot 1.0.0: ~21ops/s (48.22ms/op) on 500ops

Immutability

In the last few years one of our biggest challenge has been to find an efficient way to detect changes in our data to determine when to re-render our interfaces.

An immutable object is an object that cannot be changed once created. It brings several benefits1:

  • Data changes detection made simple (Shallow comparison)
  • Memoization
  • Improve rendering performances
  • Explicit data changes
  • Avoid side effects

Our approach

Concise

ES2015+ new features are great to deal with arrays and objects. As data structures expand, the code you write to make data immutable gets bigger and less readable. immutadot uses the dot notation to address this issue.

Interoperability

immutadot uses plain JavaScript objects so you can access your data using standard ways. Moreover, it lets you freely enjoy your favorite libraries.

Exhaustive and yet extensible

immutadot comes with a large set of built-in utilities, mostly based on ES2015+. You can also find a package called immutadot-lodash with some of lodash's utilities. You haven't found what you're looking for? Do it yourself with the convert feature.

Learning curve

If you are already familiar with ES2015+ and lodash then you should be able to use immutadot quickly.

Contributing

We want contributing to immutadot to be fun, enjoyable, and educational for anyone, and everyone.

Code of Conduct

In the interest of fostering an open and welcoming environment, we have adopted a Code of Conduct that we expect project participants to commit to. Please read the full text so that you can understand what behavior will and will not be tolerated.

Contributing guide

If you are interested in contributing to immutadot, please read our contributing guide to learn more about how to suggest bugfixes and improvements.

License

immutadot is MIT licensed.

Notes

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].