Carbo
Super fast and simple immutable object helpers
Carbo is a super fast and simple set of helpers for immutable data. It runs in the browser, or on the server using node.js.
Setup
yarn add carbo
or
npm install --save carbo
Usage
Before you start import the library
Basic usage
// We have an objectconst obj = name: 'John Doe' age: 25 work: company: 'ACME' title: 'CEO' // Has // true // false // Get // John Doe // CEO // Setconst obj1 = // { ...obj, name: 'Jane Doe' }const obj2 = // { ...obj, work: { ...obj.work, title: CTO }} // Unsetconst obj3 = // { name: 'John Doe', work: obj.work }const obj4 = // { name: 'John Doe', age: 25, work: { company: 'ACME' } } // Updateconst obj5 = // { ...obj, age: 26 }const obj6 = // { ...obj, work: { ...obj.work, title: 'Best CEO' } }