Nominal Package Missing

    @util.js/privates

    0.41.1 • Public • Published

    @util.js/privates

    JavaScript utility class for private member variables

    NPM Status Travis CI Build Status

    @util.js/privates is part of Util.js.

    Privates

    Kind: global class
    Access: public

    new Privates()

    JavaScript utility class for private member variables.

    This class decreases some of the boilerplate of the WeakMap pattern as described by "Private Variables in JavaScript with ES6 WeakMaps" and "Privates In ES2015 Javascript Classes". This utility handles shallow copying at construction.

    Private fields may become a part of the ECMA standard. The following is a StackOverflow answer to the question "Private properties in JavaScript ES6 classes": "Private fields are being implemented in the ECMA standard. You can start using them today with babel 7 and stage 3 preset." Wouldn't private fields make this class obsolete? Not necessarily. If each of your privates is a function (e.g., you want to lazy load all member variables), this class has convenience methods for that.

    privates.call()

    Calls this.get(thiz, property)().

    Kind: instance method of Privates
    Access: public

    Install

    npm i @util.js/privates

    DownloadsWeekly Downloads

    2

    Version

    0.41.1

    License

    MIT

    Unpacked Size

    25.9 kB

    Total Files

    7

    Last publish

    Collaborators

    • creemama