@profiscience/knockout-contrib-utils-modify
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

utils.modify

Version Dependency Status Peer Dependency Status Dev Dependency Status Downloads

This package is intended for consumption via the [@profiscience/knockout-contrib] metapackage

Modifies an observable using a transform function. Returns the new value.

Useful for wrapping general purpose utilities functions for Knockout observables.

Usage

import { modify } from '@profiscience/knockout-contrib'

const foobar = ko.observable('foobar')

function reverseString(str) {
  return str
    .split('')
    .reverse()
    .join('')
}

const ret = modify(foobar, reverseString)
;(foobar() === ret) === 'raboof'

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @profiscience/knockout-contrib-utils-modify

    Weekly Downloads

    7

    Version

    2.0.1

    License

    WTFPL

    Unpacked Size

    7.51 kB

    Total Files

    12

    Last publish

    Collaborators

    • dorgeron
    • barsh