Tabnine Logo For Javascript
LoDashStatic.times
Code IndexAdd Tabnine to your IDE (free)

How to use
times
function
in
LoDashStatic

Best JavaScript code snippets using lodash.LoDashStatic.times(Showing top 15 results out of 315)

origin: FormidableLabs/nodejs-dashboard

_.each(values, (value, seriesName) => {
  if (!this.series[seriesName]) {
   return;
  }
  if (this._isHighwater(seriesName)) {
   this.series[seriesName].y = _.times(this.limit, _.constant(value));
  } else {
   this.series[seriesName].y.shift();
   this.series[seriesName].y.push(value);
  }
 });
origin: FormidableLabs/nodejs-dashboard

const slowFunc = function (count) {
 const begin = Date.now();

 // Deliberately unused variable.
 // eslint-disable-next-line no-unused-vars
 let values = _.times(count, () => _.random(0, count));
 values = _.sortBy(values);

 return Date.now() - begin;
}
origin: moleculerjs/moleculer

it("should direct call action on the specified node", () => {
      return master.waitForServices("math")
        .delay(500)
        .then(() => Promise.all(_.times(6, () => master.call("math.add", { a: 20, b: 30 }, { nodeID: "slaveB" }))))
        .catch(protectReject)
        .then(res => {
          //console.log(res);
          expect(res).toHaveLength(6);
          expect(res.filter(o => o.result == 50)).toHaveLength(6);
          expect(res.filter(o => o.node == "slaveA")).toHaveLength(0);
          expect(res.filter(o => o.node == "slaveB")).toHaveLength(6);
        });
    });
origin: moleculerjs/moleculer

broker.start()
  .then(() => broker.repl())
  .then(() => {
    return broker.Promise.all(_.times(10, id => {
      return broker.call("test.second", { id });
      //return broker.emit("user.created", { id });
    }));
  })
  /*.then(() => {
    setInterval(() => broker.call("test.second", { id: id++ }), 200);
  })*/
  .then(res => broker.logger.info("Done!"))
  .catch(err => broker.logger.error(err.message));
origin: FormidableLabs/nodejs-dashboard

describe("constructor", () => {
  beforeEach(() => {
   sandbox.stub(BaseLineGraph.prototype, "_createGraph");
  });

  it("should use limit from layoutConfig", () => {
   const limit = 7;
   options.layoutConfig.view.limit = limit;
   const baseGraph = new BaseLineGraph(options);
   expect(baseGraph).to.have.property("limit", limit);
   expect(baseGraph).to.have.nested.property("series.a.y")
    .that.deep.equals(_.times(limit, _.constant(0)));
  });

  it("should create graph and set up event listener", () => {
   const baseGraph = new BaseLineGraph(options);
   expect(baseGraph).to.be.an.instanceof(BaseView);
   expect(baseGraph._createGraph).to.have.been.calledOnce;
   expect(testContainer.screen.on).to.have.been.calledWithExactly("metrics", sinon.match.func);
  });
 });
origin: moleculerjs/moleculer

scale(num, opts) {
      if (num > this.nodes.length) {
        // Start new nodes
        this.logger.info(`Starting ${num - this.nodes.length} new nodes...`);
        return _.times(num - this.nodes.length, () => this.startNewNode(this.getNextNodeID()));

      } else if (num < this.nodes.length && num >= 0) {
        // Stop random nodes
        this.logger.info(`Stopping ${this.nodes.length - num} nodes...`);
        const tmp = Array.from(this.nodes);
        return _.times(this.nodes.length - num, () => {
          const idx = _.random(tmp.length - 1);
          const node = tmp.splice(idx, 1)[0];
          if (opts.kill)
            return this.killNode(node);
          else
            return this.stopNode(node);
        });
      }
    }
origin: FormidableLabs/nodejs-dashboard

y: _.times(this.layoutConfig.limit, _.constant(0)),
style: {
 line: seriesConfig.color
origin: moleculerjs/moleculer

const ctxs = _.times(10, i => Context.create(broker, endpoint, { id: i + 1 }));
const p = broker.Promise.all(ctxs.map(ctx => newHandler.call(broker, ctx).catch(err => FLOW.push(err.name + "-" + ctx.params.id))));
origin: moleculerjs/moleculer

return master.waitForServices("aes")
  .delay(500)
  .then(() => Promise.all(_.times(1, () => {
    const s1 = fs.createReadStream(filename);
    return master.call("aes.encrypt", s1)
origin: moleculerjs/moleculer

const ctxs = _.times(10, i => Context.create(broker, endpoint, { id: i + 1, crash: i == 1 || i == 7 }));
const p = broker.Promise.all(ctxs.map(ctx => newHandler.call(broker, ctx).catch(err => FLOW.push(err.name + "-" + ctx.params.id))));
origin: FormidableLabs/nodejs-dashboard

_.each(data[0], (value, seriesName) => {
  if (!this.series[seriesName]) {
   return;
  }
  if (this._isHighwater(seriesName)) {
   this.series[seriesName].y = _.times(this.limit, _.constant(value));
  } else {
   this.series[seriesName].y = _.times(this.limit, _.constant(0));
  }
  this.series[seriesName].x = xAxis;
 });
origin: moleculerjs/moleculer

it("should call actions with balancing between 3 nodes", () => {
      return master.waitForServices("math")
        .delay(500)
        .then(() => Promise.all(_.times(6, () => master.call("math.add", { a: 20, b: 30 }))))
        .catch(protectReject)
        .then(res => {
          //console.log(res);
          expect(res).toHaveLength(6);
          expect(res.filter(o => o.result == 50)).toHaveLength(6);
          expect(res.filter(o => o.node == "slaveA")).toHaveLength(2);
          expect(res.filter(o => o.node == "slaveB")).toHaveLength(2);
          expect(res.filter(o => o.node == "slaveC")).toHaveLength(2);
        });
    });
origin: moleculerjs/moleculer

const ctxs = _.times(10, i => Context.create(broker, endpoint, { id: i + 1 }));
const p = broker.Promise.all(ctxs.map(ctx => newHandler.call(broker, ctx).catch(err => FLOW.push(err.name + "-" + ctx.params.id))));
origin: moleculerjs/moleculer

it("should call actions with balancing between 2 nodes", () => {
      return master.waitForServices("math")
        .delay(500)
        .then(() => Promise.all(_.times(6, () => master.call("math.add", { a: 50, b: 13 }))))
        .catch(protectReject)
        .then(res => {
          //console.log(res);
          expect(res).toHaveLength(6);
          expect(res.filter(o => o.result == 63)).toHaveLength(6);
          expect(res.filter(o => o.node == "slaveA")).toHaveLength(3);
          expect(res.filter(o => o.node == "slaveB")).toHaveLength(3);
        });
    });
origin: moleculerjs/moleculer

it("should call actions without slaveC node", () => {
      return master.waitForServices("math")
        .delay(500)
        .then(() => Promise.all(_.times(6, () => master.call("math.add", { a: 20, b: 30 }))))
        .catch(protectReject)
        .then(res => {
          //console.log(res);
          expect(res).toHaveLength(6);
          expect(res.filter(o => o.result == 50)).toHaveLength(6);
          expect(res.filter(o => o.node == "slaveA")).toHaveLength(3);
          expect(res.filter(o => o.node == "slaveB")).toHaveLength(3);
          expect(res.filter(o => o.node == "slaveC")).toHaveLength(0);
        });
    });
lodash(npm)LoDashStatictimes

JSDoc

Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee
is invoked with one argument; (index).

Most used lodash functions

  • LoDashStatic.map
    Creates an array of values by running each element in collection through iteratee. The iteratee is
  • LoDashStatic.isEmpty
    Checks if value is empty. A value is considered empty unless it’s an arguments object, array, string
  • LoDashStatic.forEach
    Iterates over elements of collection invoking iteratee for each element. The iteratee is invoked wit
  • LoDashStatic.find
    Iterates over elements of collection, returning the first element predicate returns truthy for.
  • LoDashStatic.pick
    Creates an object composed of the picked `object` properties.
  • LoDashStatic.get,
  • LoDashStatic.isArray,
  • LoDashStatic.filter,
  • LoDashStatic.merge,
  • LoDashStatic.isString,
  • LoDashStatic.isFunction,
  • LoDashStatic.assign,
  • LoDashStatic.extend,
  • LoDashStatic.includes,
  • LoDashStatic.keys,
  • LoDashStatic.cloneDeep,
  • LoDashStatic.uniq,
  • LoDashStatic.isObject,
  • LoDashStatic.omit

Popular in JavaScript

  • glob
    a little globber
  • semver
    The semantic version parser used by npm.
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • js-yaml
    YAML 1.2 parser and serializer
  • axios
    Promise based HTTP client for the browser and node.js
  • express
    Fast, unopinionated, minimalist web framework
  • minimatch
    a glob matcher in javascript
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now