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

lookup-hash

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

lookup-hash

Lookup table with default functionality

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Usage

const lookup = require('lookup');

const hash = {
  option1: (arg1, arg2) => {
    console.log('arg1', arg1);
    console.log('arg2', arg2);
    console.log('option 1');
  },
  option2: () => console.log('option 2'),
  option3: () => console.log('strings work too!'),
  default: () => 'Default value'
};

const action = lookup(hash);

action('option1', ['arg1 text', 'arg2 text']);
action('option2');
action('option3');

const defaultResults = action();

console.log(defaultResults);

Use Case

Error handling messaging

Create a translations table which map to your KNOWN error messages. If an unknown error message is found, use a default error message.

Keywords

FAQs

Package last updated on 26 Jan 2018

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