Get started with mori CDN

EPL licensed

Mori: library for scalable data processing with functional features.

Tags:
  • amd
  • browser
  • client
  • immutable
  • functional
  • datastructures

Stable version

Copied!

How to start using mori CDN


// Include Mori library from the CDN
const Mori = require('mori/dist/mori.min.js');

// Create a new Mori data structure - a map with key-value pairs
const data = Mori.map([], x => Mori.assoc('key', x, Mori.map([1, 2, 3], y => y * 2)));

// Access values using Mori functions
console.log(Mori.get(Mori.head(data), 'key')); // Output: 2
console.log(Mori.get(Mori.nth(data, 1), 'key')); // Output: 4

// Update values using Mori functions
const updatedData = Mori.map(data, x => Mori.assoc('key', Mori.inc(Mori.get(x, 'key')), x));

// Print updated data structure
console.log(Mori.toJS(updatedData));
// Output: [{key: 3, 0: 4, 1: 6, 2: 8}]
Copied!
Copied!

All versions