1.0.0 • Published 11 months ago

transverse-nested v1.0.0

Weekly downloads
Last release
11 months ago

Transverse Nested

License: MIT

Get nested properties from your objects

Transverse nested properties of your object. Can return an individual property (leaf), or a section of the object (node).


Run npm i transverse-nested or yarn add transverse-nested


The transverse-nested module exports a single default function, that takes the object to be transversed, and a string of properties to transverse (the path to be transversed by the function).


const transverse = require("transverse-nested") 
// Or 'import transverse from "transverse-nested"' if es6+

const obj = {
  data: {
    user: {
      details: {
        name: John Doe",
        email: "john.doe@mail.com"

const name = transverse(obj, "data.user.details.name")

//You can even use destructuring

const { name: otherName, email } = transverse(obj, "data.user.details")


  • ES6/ESNext - Write ES6 code and Babel will transpile it to ES5 for backwards compatibility
  • Test - Mocha with Istanbul coverage
  • Lint - Preconfigured ESlint with Airbnb config
  • CI - TravisCI configuration setup
  • Minify - Built code will be minified for performance

Development Commands

  • npm run clean - Remove lib/ directory
  • npm test - Run tests with linting and coverage results.
  • npm test:only - Run tests without linting or coverage.
  • npm test:watch - You can even re-run tests on file changes!
  • npm test:prod - Run tests with minified code.
  • npm run test:examples - Test written examples on pure JS for better understanding module usage.
  • npm run lint - Run ESlint with airbnb-config
  • npm run cover - Get coverage report for your code.
  • npm run build - Babel will transpile ES6 => ES5 and minify the code.
  • npm run prepublish - Hook for npm. Do all the checks before publishing your module.


MIT © Nelson Mbau


11 months ago