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
2.1.1
Version published
Weekly downloads
4
-82.61%
Maintainers
1
Weekly downloads
 
Created
Source

datalist-interface

Build Coverage Downloads Size

A basic interface for a list.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install datalist-interface

Use

import {DatalistInterface} from '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

This package exports the following identifiers: DatalistInterface. There is no default export.

DatalistInterface([value...])

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

Example
import {DatalistInterface} from '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'
  • datamap-interface — Simple interface for a map

License

MIT © Titus Wormer

Keywords

data

FAQs

Package last updated on 09 Mar 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