Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

proto-list-deep

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proto-list-deep

Extends proto-list with a 'deepSnapshot'

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

proto-list-deep

An extension of isaacs' proto-list that exposes a deepSnapshot. This returns a different result than snapshot. Whereas snapshot is implicitly merging all keys at the top level due to the prototype chain, deepSnapshot first flattens each 'level' of the proto-list, grabs all the values, then unflattens the result back to its original depth.

Proto-list-deep does not disturb any of proto-list's functionality (and passes all of proto-list's tests), so you can use it in place of proto-list if you wish.

Important Caveat

Proto-list-deep flattens the objects by concatenating keys together with a delimeter. By default it uses :. So, your object keys CANNOT contain this delimeter, else the unflattening will fail. You can change this delimeter in the ProtoListDeep() constructor.

Example

var ProtoListDeep = require('proto-list-deep');
var p = new ProtoListDeep();

p.push({
  fruit: { green: 'apple' }
});
p.push({
  fruit: { green: 'lime', yellow: 'lemon' }
});

console.log(p.snapshot);
// { fruit: { green: 'apple' } }

console.log(p.deepSnapshot);
// { fruit: { green: 'apple', yellow: 'lemon' } }

FAQs

Package last updated on 22 Aug 2012

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc