@nyinyithann/dict.js

1.0.0 • Public • Published

Dict.js

Dict.js is a JavaScript library for nodeJS and browser. Dict.js extends JavaScript Map. The library is heavily inspired and influenced by F# Map module.

Documentation

Please go to Dict APIs to read more.

Installation

npm install @nyinyithann/dict.js

Getting started

Dict extends Map. All built-in methods of Map can be used with Dict. And Dict.js provides additional methods.

const diatonicMajorInC = new Dict(
  [
    [1, ['C', 'do']],
    [2, ['D', 're']],
    [3, ['E', 'mi']],
    [4, ['F', 'fa']],
    [5, ['G', 'so']],
    [6, ['A', 'la']],
    [7, ['B', 'ti']]
  ]
);
const twinkelLittleStarNotes = new Vec(1, 1, 5, 5, 6, 6, 5);
const solfeges = diatonicMajorInC.fold((s, k, [_, solfege]) => twinkelLittleStarNotes.includes(k) ? `${s}${solfege} ` : s, '');
console.log(solfeges)
// => do so la

Dict has the following methods.

Static Methods

of
empty

Instance Methods

change
exists
filter
findKey
fold
foldRight
every
map
partition
isEmpty
toArray
toSet

Author

Nyi Nyi Than - @nyinyithann

Credit

License

MIT

Package Sidebar

Install

npm i @nyinyithann/dict.js

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

32.9 kB

Total Files

5

Last publish

Collaborators

  • nyinyithann