1.0.2 • Published 10 years ago

ettr v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

Build Status Coverage Status

install

npm install ettr

usage

Assume obj is

{
  a: {
    b: {
      c: 1,
      d: 2,
    }
  }
}

.get(obj, attr)

ettr.get(obj, 'a.b.c')
  .should.equal(1);

ettr.get(obj, 'a[b]["c"]')
  .should.equal(1);

.set(obj, attr, value)

ettr.set(obj, 'a.b.c', 5);
obj.a.b.c.should.equal(5);

.incr(obj, attr, value, defaultValue)

ettr.incr(obj, 'a.b.z', 1, 100);
ettr.incr(obj, 'a.b.z', 1, 100);
obj.a.b.z.should.equal(102);

license

MIT

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago