nuǝɯ pǝɥsᴉꞁod mǝu

    prop-factory

    1.0.0 • Public • Published

    prop-factory

    Getter-setter factory utility.

    npm Version Build Status Test Coverage Dependency Status

    Installation

    Install using npm:

    $ npm install prop-factory
    

    Usage

    Borrowed from Mithril's m.prop, prop-factory is a simple factory that returns a function for storing and retrieving a value.

    var prop = require('prop-factory');
     
    // Define a setter-getter with an initial value of "John" (without a given
    // value, the initial value will be undefined)
    var name = prop('John');
     
    // Read the value
    var a = name();  // a === 'John'
     
    // Set the value to "Mary"
    name('Mary');
     
    // Read the new value
    var b = name();  // b === 'Mary'

    License

    MIT

    Install

    npm i prop-factory

    DownloadsWeekly Downloads

    195

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • jimf