How to use mout - 10 common examples

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 Kitware / HPCCloud / test / redux / projects.js View on Github external
it('should update simulation step, delete the old taskflow', (done) => {
      const newStatus = 'complete';
      const newTaskflowId = 'some_id';
      const expectedSim = deepClone(simulationData[0]);
      expectedSim.steps.Simulation.status = newStatus;
      expectedSim.steps.Simulation.metadata.taskflowId = newTaskflowId;

      const expectedActions = [
        {
          type: 'DELETE_TASKFLOW',
          id: simulationData[0].steps.Simulation.metadata.taskflowId,
        },
        { type: Actions.UPDATE_SIMULATION, simulation: expectedSim },
      ];

      // we need to manually add the simulation to the state.
      store.getState().simulations.mapById[simulationData[0]._id] =
        simulationData[0];

      setSpy(client, 'updateSimulationStep', expectedSim);
github hw2-archive / upt / test / core / packageRepository.js View on Github external
beforeEach(function (next) {
        var PackageRepository;
        var config;
        var logger = new Logger();

        // Config
        config = mout.object.deepMixIn({}, defaultConfig, {
            storage: {
                packages: packagesCacheDir,
                registry: registryCacheDir
            }
        });

        // Mock the resolver factory to always return a resolver for the test package
        function resolverFactory(decEndpoint, _config, _logger, _registryClient) {
            expect(_config).to.eql(config);
            expect(_logger).to.be.an(Logger);
            expect(_registryClient).to.be.an(RegistryClient);

            decEndpoint = mout.object.deepMixIn({}, decEndpoint);
            decEndpoint.source = mockSource;

            resolver = new resolvers.GitRemote(decEndpoint, _config, _logger);
github hw2-archive / upt / src / lib / core / Manager.js View on Github external
.then(function (choice) {
                var pick;

                // Sanitize choice
                choice = choice.trim();
                save = /^!/.test(choice) || /!$/.test(choice);  // Save if prefixed or suffixed with !
                choice = Number(mout.string.trim(choice, '!'));
                pick = picks[choice - 1];

                // Save resolution
                if (save) {
                    this._storeResolution(pick);
                }

                return pick;
            }.bind(this));
};
github cam-inc / viron / src / store / getters / endpoints.js View on Github external
tagsFiltered: (state, maxSize) => {
    const version = state.application.version;
    let endpoints = ObjectAssign({}, state.endpoints[version]);
    endpoints = sortByOrder(endpoints);
    let tags = [];
    forEach(endpoints, endpoint => {
      forEach(endpoint.tags || [], tag => {
        tags.push(tag);
      });
    });
    tags = unique(tags, (a, b) => {
      return a === b;
    });
    let filterText = state.application.endpointTempFilterText;
    filterText = filterText.replace(/ /g, ' ');// eslint-disable-line no-irregular-whitespace
    filterText = filterText.replace(/,/g, ' ');
    const targetTexts = filter((filterText || '').split(' '), targetText => {
      return !!targetText;
    });
    if (!!targetTexts.length) {
      tags = filter(tags, name => {
        let isMatched = true;
github cam-inc / viron / src / components / viron-parameters / index.js View on Github external
this.handleValSubmit = (key, newVal) => {
    if (!this.opts.onsubmit) {
      return;
    }
    const ret = this.opts.val;
    ret[key] = newVal;
    // Delete the key if it's undefined.
    forOwn(ret, (val, key) => {
      if (isUndefined(val)) {
        delete ret[key];
      }
    });
    this.opts.onsubmit(ret);
  };
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 / lib / commands / uninstall.js View on Github external
.spread(function (tree, flattened) {
        var nodes = [];
        var dependantsCounter = {};

        // Grab the nodes of each specified name
        mout.object.forOwn(flattened, function (node) {
            if (names.indexOf(node.endpoint.name) !== -1) {
                nodes.push(node);
            }
        });

        // Walk the down the tree, gathering dependants of the packages
        project.walkTree(tree, function (node, nodeName) {
            if (names.indexOf(nodeName) !== -1) {
                dependantsCounter[nodeName] = dependantsCounter[nodeName] || 0;
                dependantsCounter[nodeName] += node.nrDependants;
            }
        }, true);


        // Filter out those that have no dependants
        nodes = nodes.filter(function (node) {
github ippontech / tatami / web / node_modules / bower / lib / core / Project.js View on Github external
Project.prototype._bootstrap = function (targets, resolved, incompatibles) {
    var installed = mout.object.map(this._installed, function (decEndpoint) {
        return decEndpoint.pkgMeta;
    });

    this._json.resolutions = this._json.resolutions || {};

    // Configure the manager and kick in the resolve process
    return this._manager
    .configure({
        targets: targets,
        resolved: resolved,
        incompatibles: incompatibles,
        resolutions: this._json.resolutions,
        installed: installed,
        forceLatest: this._options.forceLatest
    })
    .resolve()
github hw2-archive / upt / src / lib / core / resolvers / FsResolver.js View on Github external
this._source = path.resolve(this._config.cwd, this._source);

    // If target was specified, simply reject the promise
    if (this._target !== '*') {
        throw createError('File system sources can\'t resolve targets', 'ENORESTARGET');
    }

    // If the name was guessed
    if (this._guessedName) {
        // Remove extension
        this._name = this._name.substr(0, this._name.length - path.extname(this._name).length);
    }
}

util.inherits(FsResolver, Resolver);
mout.object.mixIn(FsResolver, Resolver);

// -----------------

FsResolver.isTargetable = function () {
    return false;
};

// TODO: Should we store latest mtimes in the resolution and compare?
//       This would be beneficial when copying big files/folders

// TODO: There's room for improvement by using streams if the source
//       is an archive file, by piping read stream to the zip extractor
//       This will likely increase the complexity of code but might worth it
FsResolver.prototype._resolve = function () {
    return this._createTempDir()
            .then(this._copy.bind(this))