Codota Logo For Javascript
LoDashStatic.times
Code IndexAdd Codota 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(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: 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: 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: 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: 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

  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • superagent
    elegant & feature rich browser / node HTTP with a fluent API
  • handlebars
    Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
  • mkdirp
    Recursively mkdir, like `mkdir -p`
  • bluebird
    Full featured Promises/A+ implementation with exceptionally good performance
  • debug
    small debugging utility
  • mime-types
    The ultimate javascript content-type utility.
  • commander
    the complete solution for node.js command-line programs
  • redis
    Redis client library
  • Top plugins for WebStorm
    The challenge is finding the best plugins for JavaScript development on Intellij IDEs. Who wants to sit there and go over hundreds of plugins to pick the best?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJavascript Code Index
Get Codota for your IDE now