Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

observ-sync-hash

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

observ-sync-hash

Synchronize an observable hash table with an array with primary keys

  • 2.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

observ-sync-hash Build Status

Synchronize an observable hash table with an array with primary keys

Install

$ npm install --save observ-sync-hash

Usage

var sync = require('observ-sync-hash')
var ObservArray = require('observ-array')
var Hash = require('observ-varhash')

var array = ObservArray([])
var hash = Hash({})

sync(array, hash)

array.push(123)
hash()
//=> {123: null}

array.splice(0, 1)
hash()
//=> {}

API

sync(array, hash, [key]) -> function

Returns an unlisten function.

array

Required
Type: function

An observable array

hash

Required
Type: function

An observable hash

options
key

Type: string

If provided, the hash keys will be derived from a property of each array item instead of the string values themselves. You can use id or even dot syntax, e.g. foo.id.

values

Type: boolean
Default: false

If true, data from the array will be added to the hash instead of null values.

License

MIT © Ben Drucker

Keywords

FAQs

Package last updated on 18 May 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