This package has been deprecated

Author message:

I wrote this module a very long time ago; you should use something else.

alists

0.0.2 • Public • Published

alists

This tiny, tiny module is for converting between lists of key-value pairs, such as

[['a', 1], ['b', 2]]

and "equivalent" objects, such as

{ 'a': 1,
  'b': 2 }

in this case.

Such key-valued pairs are being referred to, in this case, as "alists" after the lisp construct

( ('a' . 1) ('b' . 2) )

which, while obviously utilizing cons cells and linked lists, is similar enough for my purposes to be called the same thing.

One purpose for such a thing may be to build objects out of zipped key/val pairs.

Methods:

As you can see, there aren't very many:

toObj :

> alists.toObj([ ['a', 1], ['b', 2] ])
{ a: 1, b: 2 }

toList :

> alists.toList({'a': 1, 'b': 2})
[ [ 'a', 1 ],
  [ 'b', 2 ] ]

Readme

Keywords

none

Package Sidebar

Install

npm i alists

Weekly Downloads

11

Version

0.0.2

License

none

Last publish

Collaborators

  • jesusabdullah