Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dsl101 opened this issue May 6, 2016 · 1 comment
Closed

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

dsl101 opened this issue May 6, 2016 · 1 comment

Comments

@dsl101
Copy link

dsl101 commented May 6, 2016

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

@sindresorhus
Copy link
Member

Thanks for the suggestion, but not something we're interested in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants