parenter

1.7.26 • Public • Published

QA monorepo

JavaScript Style Guide CircleCI Maintainability Test Coverage FOSSA Statuslerna

Installation

npm install parenting

Motivation

Getting parent and children shall be as easy drinking water (yes there are people hate drinking water).

Early release

The current API will work as is but will be extended soon. Soon the parent and children tags will be redefinable, and optional.

Examples

For now the current tests will do it:

const {expect} = require('chai')
const partenting = require('../../src')

describe('Basic Test Suite', function () {
  exampleObject = {
    a:{
      b:{
        c:1,
        c1:2,
        c3:{
          deep:{
            deeper:{
              whatCouldGoWrong: 1
            }
          }
        },
        c4:4
      },
      d:{
        e:2
      }
    },
    f: 'g',
    array:[
      {a:{b:'c'}}
    ]
  }

  it('checking default results', function () {
    const parented = partenting(exampleObject)()
    expect(parented.a.b.c3.parent()).to.deep.equal(parented.a.b)
    expect(parented.a.parent()).to.deep.equal(parented)
    expect(parented.a.children()[0].parent()).to.deep.equal(parented)
  })
})

Package Sidebar

Install

npm i parenter

Weekly Downloads

1

Version

1.7.26

License

MIT

Unpacked Size

6.81 kB

Total Files

3

Last publish

Collaborators

  • 311ecode