@profiscience/knockout-contrib-utils-increment
v2.0.1
Published
[![Version][npm-version-shield]][npm] [![Dependency Status][david-dm-shield]][david-dm] [![Peer Dependency Status][david-dm-peer-shield]][david-dm-peer] [![Dev Dependency Status][david-dm-dev-shield]][david-dm-dev] [![Downloads][npm-stats-shield]][npm-sta
Downloads
55
Readme
utils.increment / utils.decrement
This package is intended for consumption via the [@profiscience/knockout-contrib] metapackage.
Increments/decrements a numeric observable. Returns the new value.
Usage
import { increment, decrement } from '@profiscience/knockout-contrib'
const foo = ko.observable(0)
increment(foo) // 1
increment(foo, 3) // 4
decrement(foo) // 3
decrement(foo, 2) // 1