0.1.0 • Published 2 years ago

dictlist-util-pmb v0.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

dictlist-util-pmb

Utilities for dealing with lists of dictionaries.

API

This module exports one function:

makeDictList(x)

Returns a dictionary list (shortened "DL" from now), i.e. an array that holds some extra methods described below.

  • If x is an array, the resulting DL will contain all elements of x that look like dictionary objects. (Currently, any truthy value qualifies.)
  • Otherwise, if x looks like a dictionary object, the resulting DL will contain just x.
  • If x is false-y (e.g. not supplied), the resulting DL will be empty.

Methods on dictionary lists

.getEachOwnProp(key)

Return an array with the values of all own key-named properties from all dictionaries that have them.

Usage

see test/usage.mjs.

Known issues

  • Needs more/better tests and docs.

 

License

ISC