@beenhere4hours/valid-chain

Deep check if property exists

Usage no npm install needed!

<script type="module">
  import beenhere4hoursValidChain from 'https://cdn.skypack.dev/@beenhere4hours/valid-chain';
</script>

README

Build Status

valid-chain

Verify deep nested property exists

Installation

npm i @beenhere4hours/valid-chain

Usage

const validChain = require("../index").validChain;

// first param is the object to search
// second param is a string dot notated list of params to be verified
validChain({level1: {level2: {level3: {level4: true}}}}, 'level1.level2.level3.level4');
// expect true

validChain({level1: {level2: {level3: {level4: true}}}}, 'level1.level2.level3.level4.level5');
// expect false

Tests

npm test