How to use the mout/object.forOwn function in mout

To help you get started, we’ve selected a few mout examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bower / bower / packages / bower-config / lib / util / rc.js View on Github external
function env(prefix) {
    var obj = {};
    var prefixLength = prefix.length;

    prefix = prefix.toLowerCase();

    object.forOwn(process.env, function(value, key) {
        key = key.toLowerCase();

        if (string.startsWith(key, prefix)) {
            var parsedKey = key
                .substr(prefixLength)
                .replace(/__/g, '.') // __ is used for nesting
                .replace(/_/g, '-'); // _ is used as a - separator

            //use a convention patern to accept array from process.env
            //e.g. export bower_registry__search='["http://abc.com","http://def.com"]'
            var match = /\[([^\]]*)\]/g.exec(value);
            var targetValue;
            if (!match || match.length === 0) {
                targetValue = value;
            } else {
                targetValue = match[1].split(',').map(function(m) {
github irods-contrib / irods-cloud-browser / irods-cloud-frontend / node_modules / bower / node_modules / bower-config / lib / util / rc.js View on Github external
function env(prefix) {
    var obj = {};
    var prefixLength = prefix.length;

    prefix = prefix.toLowerCase();

    object.forOwn(process.env, function (value, key) {
        key = key.toLowerCase();

        if (string.startsWith(key, prefix)) {
            var parsedKey = key
                           .substr(prefixLength)
                           .replace(/__/g, '.')   // __ is used for nesting
                           .replace(/_/g, '-');   // _ is used as a - separator

            //use a convention patern to accept array from process.env
            //e.g. export bower_registry__search='["http://abc.com","http://def.com"]'
            var match = /\[([^\]]*)\]/g.exec(value);
            var targetValue;
            if (!match || match.length === 0) {
                targetValue = value;
            } else {
                targetValue = match[1].split(',')
github ippontech / tatami / web / node_modules / bower / node_modules / bower-config / lib / util / expand.js View on Github external
function camelCase(config) {
    var camelCased = {};

    // Camel case
    object.forOwn(config, function (value, key) {
        // Ignore null values
        if (value == null) {
            return;
        }

        key = string.camelCase(key.replace(/_/g, '-'));
        camelCased[key] = lang.isPlainObject(value) ? camelCase(value) : value;
    });

    return camelCased;
}
github bower / bower / packages / bower-config / lib / util / expand.js View on Github external
function camelCase(config) {
    var camelCased = {};

    // Camel case
    object.forOwn(config, function(value, key) {
        // Ignore null values
        if (value == null) {
            return;
        }

        key = string.camelCase(key.replace(/_/g, '-'));
        camelCased[key] = lang.isPlainObject(value) ? camelCase(value) : value;
    });

    return camelCased;
}
github nicolaspanel / node-svm / lib / commands / train.js View on Github external
function askConfirmation(logger, config){
    var cleanConfig = _o.merge({}, config);
    // Cleanup empty props (null values, empty strings, objects and arrays)
    _o.forOwn(cleanConfig, function (value, key) {
        if (key === 'svmType'){
            cleanConfig.svmType = svmTypesString[value];
        }
        else if (key === 'kernelType'){
            cleanConfig.kernelType = kernelTypesString[value];
        }
        else if (key === 'cwd' ||
            key === 'argv' ||
            key === 'interactive' ||
            key === 'color'){
            delete cleanConfig[key];
        }
        else if (value === null ||
            _l.isEmpty(value) &&
            !_l.isNumber(value) &&
            !_l.isBoolean(value)) {
github nicolaspanel / node-svm / lib / core / config.js View on Github external
function camelCase(config) {
    var camelCased = {};

    // Camel case
    _o.forOwn(config, function (value, key) {
        // Ignore null values
        if (value == null) {
            return;
        }

        key = _s.camelCase(key.replace(/_/g, '-'));
        camelCased[key] = _l.isPlainObject(value) ? camelCase(value) : value;
    });

    return camelCased;
}
github bower / bower / test / helpers.js View on Github external
TempDir.prototype.create = function(files, defaults) {
        var that = this;

        defaults = defaults || this.defaults || {};
        files = object.merge(files || {}, defaults);

        this.meta = function(tag) {
            if (tag) {
                return files[tag]['bower.json'];
            } else {
                return files['bower.json'];
            }
        };

        if (files) {
            object.forOwn(files, function(contents, filepath) {
                if (typeof contents === 'object') {
                    contents = JSON.stringify(contents, null, ' ') + '\n';
                }

                var fullPath = path.join(that.path, filepath);
                mkdirp.sync(path.dirname(fullPath));
                fs.writeFileSync(fullPath, contents);
            });
        }

        return this;
    };
github nicolaspanel / node-svm / lib / core / svm.js View on Github external
SVM.prototype._restore = function (model) {
    var self = this;
    this._baseSvm = BaseSVM.restore(model);
    _o.forOwn(model.params, function(val, key){
        self._config[key] = val;
    });
};