New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

status-lookup

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

status-lookup

simple status-int conversion, save memory and disk space

latest
Source
npmnpm
Version
2.2.0
Version published
Maintainers
1
Created
Source

Status-lookup

Scenario: Compressing boolean status in disk storage / database

Status-lookup can convert your boolean status into bigint, and convert it back

example :

const StatusLookup = require("status-lookup");
let converter = new StatusLookup(["switch:on", "switch:off", "red", "green", "purple", "sweet", "sour", "bitter"]);

converter.compress("red", "sour"); // Integer { value: 68n }
converter.compress("red", "sour") == 68n; // true
converter.lookup(68n); // { red: true, sour: true }

api:

compress(...keys):

compress a list of status into a integer, skip when keys does not exist in the map;

lookup(bigint):

return a true status map

notice:

if you want to expand the dictionary, you need to initialize a new class and append new item to the end of the original lookup dictionary

2.0.0 :

dictionary size can now exceed 53

Keywords

status

FAQs

Package last updated on 01 Feb 2021

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