Codota Logo For Javascript
LoDashStatic.now
Code IndexAdd Codota to your IDE (free)

How to use
now
function
in
LoDashStatic

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

origin: lando/lando

// Helper to set caches
const setCaches = (options, lando) => {
 // Get the github user
 github.authenticate({type: 'token', token: options['github-auth']});
 return github.users.get({})
 .then(user => {
  // Reset this apps metacache
  const metaData = lando.cache.get(`${options.name}.meta.cache`) || {};
  lando.cache.set(`${options.name}.meta.cache`, _.merge({}, metaData, {email: user.data.email}), {persist: true});
  // Reset github tokens
  const tokens = lando.cache.get(githubTokenCache) || [];
  const cache = {token: options['github-auth'], user: user.data.login, date: _.toInteger(_.now() / 1000)};
  lando.cache.set(githubTokenCache, sortTokens(tokens, [cache]), {persist: true});
 });
}
origin: lando/lando

api.getAccountInfo().then(me => {
   // Get the project
   const project = _.find(me.projects, {name: options['platformsh-site']});
   // Or error if there is no spoon
   if (_.isEmpty(project)) throw Error(`${options['platformsh-site']} does not appear to be a platform.sh site!`);

   // This is a good token, lets update our cache
   const cache = {token: options['platformsh-auth'], email: me.mail, date: _.toInteger(_.now() / 1000)};
   // Update lando's store of platformsh machine tokens
   const tokens = lando.cache.get(platformshTokenCache) || [];
   lando.cache.set(platformshTokenCache, utils.sortTokens(tokens, [cache]), {persist: true});
   // Update app metdata
   const metaData = lando.cache.get(`${options.name}.meta.cache`);
   lando.cache.set(`${options.name}.meta.cache`, _.merge({}, metaData, cache), {persist: true});

   return {config: {
    id: _.get(project, 'id', 'lando'),
   }};
  })
origin: lando/lando

// Set the app caches, validate tokens and update token cache
  _.forEach(['pull', 'push', 'switch'], command => {
   app.events.on(`post-${command}`, (config, answers) => {
    // Only run if answer.auth is set, this allows these commands to all be
    // overriden without causing a failure here
    if (answers.auth) {
     const api = new PantheonApiClient(answers.auth, app.log);
     return api.auth().then(() => api.getUser().then(results => {
      const cache = {token: answers.auth, email: results.email, date: _.toInteger(_.now() / 1000)};
      // Reset this apps metacache
      lando.cache.set(app.metaCache, _.merge({}, app.meta, cache), {persist: true});
      // Set lando's store of pantheon machine tokens
      lando.cache.set(app.pantheonTokenCache, utils.sortTokens(app.pantheonTokens, [cache]), {persist: true});
      // Wipe out the apps tooling cache to reset with the new MT
      lando.cache.remove(`${app.name}.tooling.cache`);
     }))
     // Throw some sort of error
     // NOTE: this provides some error handling when we are completely non-interactive
     .catch(err => {
      throw (_.has(err, 'response.data')) ? new Error(err.response.data) : err;
     });
    }
   });
  });
origin: lando/lando

api.auth().then(() => Promise.all([api.getSites(), api.getUser()]))
  // Parse the dataz and set the things
  .then(results => {
   // Get our site and email
   const site = _.head(_.filter(results[0], site => site.name === options['pantheon-site']));
   const user = results[1];

   // Error if site doesn't exist
   if (_.isEmpty(site)) throw Error(`${site} does not appear to be a Pantheon site!`);

   // This is a good token, lets update our cache
   const cache = {token: options['pantheon-auth'], email: user.email, date: _.toInteger(_.now() / 1000)};

   // Update lando's store of pantheon machine tokens
   const tokens = lando.cache.get(pantheonTokenCache) || [];
   lando.cache.set(pantheonTokenCache, utils.sortTokens(tokens, [cache]), {persist: true});
   // Update app metdata
   const metaData = lando.cache.get(`${options.name}.meta.cache`);
   lando.cache.set(`${options.name}.meta.cache`, _.merge({}, metaData, cache), {persist: true});

   // Add some stuff to our landofile
   return {config: {
    framework: _.get(site, 'framework', 'drupal'),
    site: _.get(site, 'name', options.name),
    id: _.get(site, 'id', 'lando'),
   }};
  })
origin: lando/lando

/*
   * This event is intended to make sure we reset the active token and cache when it is passed in
   * via the lando pull or lando push commands
   */
  _.forEach(['pull', 'push'], command => {
   app.events.on(`post-${command}`, (config, answers) => {
    // Only run if answer.auth is set, this allows these commands to all be
    // overriden without causing a failure here
    if (answers.auth) {
     const api = new PlatformshApiClient({api_token: answers.auth});
     return api.getAccountInfo().then(me => {
      // This is a good token, lets update our cache
      const cache = {token: answers.auth, email: me.mail, date: _.toInteger(_.now() / 1000)};
      // Update lando's store of platformsh machine tokens
      const tokens = lando.cache.get(app.platformsh.tokenCache) || [];
      lando.cache.set(app.platformsh.tokenCache, utils.sortTokens(tokens, [cache]), {persist: true});
      // Update app metdata
      const metaData = lando.cache.get(`${app.name}.meta.cache`);
      lando.cache.set(`${app.name}.meta.cache`, _.merge({}, metaData, cache), {persist: true});
     });
    }
   });
  });
origin: an-sh/chat-service

userSeenUpdate (userName) {
  const timestamp = _.now()
  this.usersseen.set(userName, timestamp)
  return Promise.resolve()
 }
origin: an-sh/chat-service

processMessage (msg, setTimestamp = false) {
  delete msg.id
  delete msg.timestamp
  if (setTimestamp) {
   msg.timestamp = _.now()
  }
  msg.author = this.userName || msg.author
  return msg
 }
origin: patrixr/pocket-cms

jwt() {
    const secret = this.config.session.secret;
    const payload = _.extend({}, this.toPlainObject(), { timestamp: _.now() });
    return jwt.sign(payload, secret, {
      expiresIn: config.session.expiresIn
    });
  }
origin: an-sh/chat-service

it('should update an instance heartbeat', function (done) {
  this.timeout(4000)
  this.slow(2000)
  chatService = startService({ heartbeatRate: 500 })
  const start = _.now()
  setTimeout(() => {
   Promise.join(
    chatService.getInstanceHeartbeat(chatService.instanceUID),
    chatService.getInstanceHeartbeat(),
    (ts1, ts2) => {
     expect(ts1).within(start, start + 2000)
     expect(ts2).within(start, start + 2000)
     done()
    })
  }, 1000)
 })
origin: an-sh/chat-service

messageAdd (msg) {
  const timestamp = _.now()
  const smsg = JSON.stringify(msg)
  return this.redis.messageAdd(
   this.makeKeyName('lastMessageId'), this.makeKeyName('historyMaxSize'),
   this.makeKeyName('messagesIds'), this.makeKeyName('messagesTimestamps'),
   this.makeKeyName('messagesHistory'), smsg, timestamp)
   .spread(id => {
    msg.id = id
    msg.timestamp = timestamp
    return msg
   })
 }
origin: WilsonHo/node_examples

_.defer(function(stamp) {
  console.log(_.now() - stamp);
}, _.now());
origin: an-sh/chat-service

updateHeartbeat () {
  return this.redis.set(
   this.makeKeyName('instances', this.instanceUID, 'heartbeat'), _.now())
   .catchReturn()
 }
origin: an-sh/chat-service

lockToRoom (roomName, ttl) {
  return uid(18).then(val => {
   const start = _.now()
   return this.lock(roomName, val, ttl).then(() => {
    return Promise.resolve().disposer(() => {
     if (start + ttl < _.now()) {
      this.server.emit(
       'lockTimeExceeded', val, { userName: this.userName, roomName })
     }
     return this.unlock(roomName, val)
    })
   })
  })
 }
origin: an-sh/chat-service

updateHeartbeat () {
  this.heartbeatStamp = _.now()
  return Promise.resolve()
 }
origin: an-sh/chat-service

userSeenUpdate (userName) {
  const timestamp = _.now()
  return this.redis.hset(this.makeKeyName('usersseen'), userName, timestamp)
 }
lodash(npm)LoDashStaticnow

JSDoc

Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC).

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

  • debug
    small debugging utility
  • mime-types
    The ultimate javascript content-type utility.
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • body-parser
    Node.js body parsing middleware
  • bluebird
    Full featured Promises/A+ implementation with exceptionally good performance
  • mongodb
    The official MongoDB driver for Node.js
  • moment
    Parse, validate, manipulate, and display dates
  • rimraf
    A deep deletion module for node (like `rm -rf`)
  • crypto
  • 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