New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

base-storage

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base-storage

Provide easy way to get / set and check keys existing at objects

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Base storage

Provide easy way to get / set and check keys existing at objects

How to use

import BaseStorage from 'base-storage';


const storage = new BaseStorage({
  a: {
    b: {
      c: {
        d: 1,
        e: 2
      }
    }
  },
  f: 2
});

// has method
expect(storage.has('a')).to.be.equal(true);
expect(storage.has('A')).to.be.equal(false);

// get method
expect(storage.get('f')).to.be.equal(2);
expect(storage.get('a.b.c.d')).to.be.equal(1);
expect(storage.get('a.b.c')).to.be.equal({
    d: 1,
    e: 2
});

// set method

storage.set('x.y.z', 100500);
expect(storage.get('x')).to.be.equal({
  y: {
    z: 100500
  }
});

Extends

import BaseStorage from 'base-storage';

class CustomStorage extends BaseStorage {
  constructor(config) {
    super(config);
  }
  
  set() {
    throw new Error('"set" method is denied')
  }
}

Community

You are always welcome for ideas and pull requests :)

FAQs

Package last updated on 26 Jan 2016

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