soft-set

1.0.0 • Public • Published

soft-set Build Status

Set an observable, only when the value is different

Install

$ npm install --save soft-set

Usage

var Observable = require('observ')
var softSet = require('soft-set')
 
var observable = Observable(1)
 
softSet(observable, 1)
//=> noop
 
softSet(observable, 2)
observable()
//=> 2

API

softSet(observable, value) -> undefined

observable

Required
Type: function

An observable value (e.g. observ) that:

  • can be called to get its current value
  • has a set method that changes the value
value

Required

The new value to soft set.

License

MIT © Ben Drucker

Package Sidebar

Install

npm i soft-set

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bendrucker