Tabnine Logo For Javascript
ms
Code IndexAdd Tabnine to your IDE (free)

How to use ms

Best JavaScript code snippets using ms(Showing top 15 results out of 315)

origin: eggjs/egg

/**
  * @class
  * @param {Object} options - see {@link EggApplication}
  */
 constructor(options = {}) {
  options.type = 'agent';
  super(options);

  this.loader.load();

  // dump config after loaded, ensure all the dynamic modifications will be recorded
  const dumpStartTime = Date.now();
  this.dumpConfig();
  this.coreLogger.info('[egg:core] dump config after load, %s', ms(Date.now() - dumpStartTime));

  // keep agent alive even it doesn't have any io tasks
  setInterval(() => {}, 24 * 60 * 60 * 1000);

  this._uncaughtExceptionHandler = this._uncaughtExceptionHandler.bind(this);
  process.on('uncaughtException', this._uncaughtExceptionHandler);
 }
origin: eggjs/egg

/**
  * @class
  * @param {Object} options - see {@link EggApplication}
  */
 constructor(options = {}) {
  options.type = 'application';
  super(options);

  // will auto set after 'server' event emit
  this.server = null;

  try {
   this.loader.load();
  } catch (e) {
   // close gracefully
   this[CLUSTER_CLIENTS].forEach(cluster.close);
   throw e;
  }

  // dump config after loaded, ensure all the dynamic modifications will be recorded
  const dumpStartTime = Date.now();
  this.dumpConfig();
  this.coreLogger.info('[egg:core] dump config after load, %s', ms(Date.now() - dumpStartTime));

  this[WARN_CONFUSED_CONFIG]();
  this[BIND_EVENTS]();
 }
origin: eggjs/egg

 this.dumpConfig();
 this.dumpTiming();
 this.coreLogger.info('[egg:core] dump config after ready, %s', ms(Date.now() - dumpStartTime));
}));
this._setupTimeoutTimer();
origin: dead-horse/maintainable-nodejs

setInterval(function () {
  self.shoot().catch(self.onerror); // 捕获 error 时间
 }, ms('1s'));
origin: vweevers/lento

function msOption (name, value) {
 const n = typeof value === 'number' ? value : parseMs(value)

 if (!Number.isInteger(n)) {
  throw new Error('The "' + name + '" option must be an integer, optionally with a unit (e.g. "50ms")')
 }

 if (n <= 0) throw new Error('The "' + name + '" option must be > 0 milliseconds')

 return n
}
origin: exposebox/node-thrift2-hbase

constructor(fetchfunction, options) {
    super((options && options.limit ) || 500000);

    this.fetch = fetchfunction;
    this.ttl = (options && options.ttl) || ms('5m');
    this.materialize = function (getObj) {
      debug('materializing', getObj);
      return fetchfunction(getObj.table, getObj);
    };

    this.generateKey = function(keyObj) {
      return [keyObj.table,
        keyObj.row,
        keyObj.maxVersions,
        keyObj.timeRange,
        keyObj.columns.map(cell => cell.family + ":" + cell.qualifier).sort().join(","),
        Object.entries(keyObj.columnTypes).map(keyValue => keyValue.join(":")).sort().join(",")].join(".");
    }
  }
origin: kzwang/node-git-lfs

static _getJWTExpireTime() {
    return new Date(new Date().getTime() + ms(JWT_CONFIG.expiresIn)).toISOString();
  }
origin: forwardemail/nodemailer-base64-to-s3

test('writes to a fallback directory if AWS upload failed (e.g. no bucket param)', async t => {
 const customTransport = nodemailer.createTransport({ jsonTransport: true });
 customTransport.use(
  'compile',
  base64ToS3({
   maxAge: ms('1d')
  })
 );
 const res = await customTransport.sendMail({
  html: html.png,
  subject: 'subject',
  to: 'niftylettuce@gmail.com',
  from: 'niftylettuce@gmail.com'
 });

 const message = JSON.parse(res.message);
 const $ = cheerio.load(message.html);
 t.true(
  validator.isURL($('img').attr('src'), {
   protocols: ['file'],
   require_host: false
  })
 );
});
origin: roccomuso/no-ip

setInterval(function () {
  self.update()
 }, interval ? ms(interval) : DEFAULT_REFRESH_INTERVAL)
origin: TeanBlog/TeanBlog

let cookieMxAge = ms('1d');
let jwtMxAge = Math.floor(Date.now() / 1000) + (60 * 60 * 24);
 cookieMxAge = ms('30d');
 jwtMxAge = Math.floor(Date.now() / 1000) + (60 * 60 * 30 * 24);
origin: ONLYOFFICE/server

 headers[cfgTokenOutboxHeader] = cfgTokenOutboxPrefix + opt_Authorization;
let connectionAndInactivity = optTimeout && optTimeout.connectionAndInactivity && ms(optTimeout.connectionAndInactivity);
var options = {uri: urlParsed, body: postData, encoding: 'utf8', headers: headers, timeout: connectionAndInactivity};
 setTimeout(function() {
  raiseError(ro, 'ETIMEDOUT', 'Error whole request cycle timeout');
 }, ms(optTimeout.wholeCycle));
origin: DS-Development/delet

    .setTitle("🔒 Channel locked down")
    .setColor(16753762)
    .setDescription(`\`\`\`ruby\nChannel: #${message.channel.name} (${message.channel.id})\nDuration: ${ms(ms(time), { long: true })}\nIssued by: ${message.author.tag}\`\`\``)
    .setFooter(texts.moderation.poweredBy, this.client.user.displayAvatarURL)
    .setTimestamp();
        .then(message.channel.send("Lockdown lifted."));
        delete this.client.lockit[message.channel.id];
      }, ms(time));
  });
});
origin: kzwang/node-git-lfs

static _getExpireTime() {
    return new Date(new Date().getTime() + ms(AWS_EXPIRE_TIME)).toISOString();
  }
origin: dead-horse/maintainable-nodejs

setInterval(function () {
  self.shoot().catch(self.onerror); // 捕获 error 时间
 }, ms('1s'));
origin: ONLYOFFICE/server

 headers[cfgTokenOutboxHeader] = cfgTokenOutboxPrefix + opt_Authorization;
let connectionAndInactivity = optTimeout && optTimeout.connectionAndInactivity && ms(optTimeout.connectionAndInactivity);
var options = {uri: urlParsed, body: postData, encoding: 'utf8', headers: headers, timeout: connectionAndInactivity};
 setTimeout(function() {
  raiseError(ro, 'ETIMEDOUT', 'Error whole request cycle timeout');
 }, ms(optTimeout.wholeCycle));
ms(npm)

JSDoc

Tiny millisecond conversion utility

Most used ms functions

  • ms
    Short/Long format for `value`.
  • ms
  • parseMs

Popular in JavaScript

  • mime-types
    The ultimate javascript content-type utility.
  • fs
  • async
    Higher-order functions and common patterns for asynchronous code
  • qs
    A querystring parser that supports nesting and arrays, with a depth limit
  • js-yaml
    YAML 1.2 parser and serializer
  • moment
    Parse, validate, manipulate, and display dates
  • redis
    Redis client library
  • commander
    the complete solution for node.js command-line programs
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • Top plugins for Android Studio
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