dot-whitelist

Takes an array of dot-notated keys and only allows those keys to be included in the output object

Usage no npm install needed!

<script type="module">
  import dotWhitelist from 'https://cdn.skypack.dev/dot-whitelist';
</script>

README

dot-whitelist

Takes an array of dot-notated keys and only allows those keys to be included in the output object

Example Usage


var input = { 
    top: {
        safeProp: 'hi',
        unsafeProp: 'ho',
    },
};

console.log(whitelist(input, ['top.safeProp']));