data-object

An object wrapper for easy data manipulation


Keywords
data, object, get, set, helpers, json
License
GPL-3.0
Install
npm install data-object@0.0.2

Documentation

It's a fork from lzrski/config-object.

The goal is to put all reusable data manipulation logic here and use it internally in config-object.

Install

npm install data-object

Usage

Here's what you can do now:

Data = require 'data-object'
data = new Data
  a:
    b: 1
    c:
      d: 2
      e: 'Elf'
    f: 'Ferret'

data.get 'a/c/e'  # Elf
data.get 'a/c'    # d: 2, e: Elf
data.bonus = 200
data.get 'bonus'  # 200
data.get number: 'a/c/d', animal: 'a/f' # number: 2, animal: 'Ferret'

ATM only most basic get works. More functionality is to come, including:

  • No dependencies (esp. lodash)
  • Drop-in replacement for most of config-object code

I will successively move config-object's features here. See pending test cases for more todo items.