Get Started

Quick Start with Collect

Add Collect via:

yarn add @wonderalandlabs/collect

Wrap values with

import {create} from '@wonderalandlabs/collect`;
const myPoint = create({x: 2, y: 4});
console.log('x = ', myPoint.get('x'));
// 2
myPoint.map((item => item * 10);
console.log('x = ', myPoint.get('x'));
// 20
myPoint.set('z', 6);
console.log('store = ', myPoint.value);
// {x: 20, y: 40, z: 6}
const point2 = myPoint.clone().map((item => item ** 2);
console.log('myPoint store = ', myPoint.value);
// {x: 20, y: 40, z: 6}
console.log('point2 store = ', myPoint.value);
// {x: 400, y: 800, z: 36}