Skip to content

Inclusion of setPlain() and getPlain() for non-dotProp keys #39

Description

@dsl101

I'm using CIDRs as config keys, and it makes less sense to use dotProp to set / get. I toyed with adding an option to specify whether to use dotProp or not, but in the end it was easier to add 2 new methods and use those to store plain strings with dots in the keys:

Configstore.prototype.setPlain = function (key, val) {
    var config = this.all;
    if (arguments.length === 1) {
        Object.keys(key).forEach(function (k) {
            config[k] = key[k];
        });
    } else {
        config[key] = val;
    }
    this.all = config;
};

and its counterpart:

Configstore.prototype.getPlain = function (key) {
    return this.all[key];
};

Might be useful to someone. I'm newish to github - should I fork the project, make the change and then create a pull request? Seems a lot of admin for 2 simple additions, but let me know..

Tx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions