Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

datalist-interface

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datalist-interface

Simple interface for a list functioning as a database

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
3
-40%
Maintainers
1
Weekly downloads
 
Created
Source

datalist-interface Build Status Coverage Status

A simple interface for a list.

Installation

npm:

npm install datalist-interface

Usage

var DatalistInterface = require('datalist-interface');

var mammals = new DatalistInterface([
    'common vampire bat',
    'virginia opossum',
    'eastern grey kangaroo',
    'tasmanian devil',
    'human',
    'northern elephant seal',
    'fox squirrel',
    'tree pangolin',
    'african elephant',
    'platypus',
    'colugo',
    'reindeer',
    'humpback whale',
    'star-nosed mole',
    'giant panda',
    'giant armadillo',
    'plains zebra',
    'black and rufous elephant shrew'
]);

mammals.is('human'); // true
mammals.is('unicorn'); // false

mammals.add('unicorn').is('unicorn'); // true

mammals.remove('unicorn').is('unicorn'); // false

API

DatalistInterface([value...])

Create a new instance. Values are passed to #add().

Example
var DatalistInterface = require('datalist-interface');

var fish = new DatalistInterface(['shark', 'tuna']);

DatalistInterface#is(value)

DatalistInterface#has(value)

Check if value is in the list.

Example
fish.is('shark'); // true
fish.is('human'); // false

DatalistInterface#add([value...])

Add each value to list.

Example
fish.add('giant grouper', 'red lionfish');

DatalistInterface#remove([value...])

Remove each value from list.

Example
fish.remove('giant grouper', 'reindeer');

DatalistInterface#all()

DatalistInterface#valueOf()

DatalistInterface#toJSON()

Return the list as an Array.

Example
fish.all(); // ['shark', 'tuna', 'red lionfish']

DatalistInterface#toString()

Return the list as a string.

Example
fish.toString(); // 'shark,tuna,red lionfish'

License

MIT © Titus Wormer

Keywords

data

FAQs

Package last updated on 13 Aug 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