Socket
Socket
Sign inDemoInstall

parenter

Package Overview
Dependencies
84
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    parenter

Recurse parents and children for your embedded objects.


Version published
Maintainers
1
Install size
1.92 MB
Created

Readme

Source

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)
  })
})

Keywords

FAQs

Last updated on 27 May 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc