PHP Classes

File: CoffeeCMS/contents/themes/cfnews/assets/moment/src/lib/units/millisecond.js

Recommend this page to a friend!
  Classes of James Brows   Coffee CMS   CoffeeCMS/contents/themes/cfnews/assets/moment/src/lib/units/millisecond.js   Download  
File: CoffeeCMS/contents/themes/cfnews/assets/moment/src/lib/units/millisecond.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Coffee CMS
Content management system using MVC based themes
Author: By
Last change:
Date: 3 years ago
Size: 1,824 bytes
 

Contents

Class file image Download
import { makeGetSet } from '../moment/get-set'; import { addFormatToken } from '../format/format'; import { addUnitAlias } from './aliases'; import { addUnitPriority } from './priorities'; import { addRegexToken, match1, match2, match3, match1to3, matchUnsigned } from '../parse/regex'; import { addParseToken } from '../parse/token'; import { MILLISECOND } from './constants'; import toInt from '../utils/to-int'; // FORMATTING addFormatToken('S', 0, 0, function () { return ~~(this.millisecond() / 100); }); addFormatToken(0, ['SS', 2], 0, function () { return ~~(this.millisecond() / 10); }); addFormatToken(0, ['SSS', 3], 0, 'millisecond'); addFormatToken(0, ['SSSS', 4], 0, function () { return this.millisecond() * 10; }); addFormatToken(0, ['SSSSS', 5], 0, function () { return this.millisecond() * 100; }); addFormatToken(0, ['SSSSSS', 6], 0, function () { return this.millisecond() * 1000; }); addFormatToken(0, ['SSSSSSS', 7], 0, function () { return this.millisecond() * 10000; }); addFormatToken(0, ['SSSSSSSS', 8], 0, function () { return this.millisecond() * 100000; }); addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { return this.millisecond() * 1000000; }); // ALIASES addUnitAlias('millisecond', 'ms'); // PRIORITY addUnitPriority('millisecond', 16); // PARSING addRegexToken('S', match1to3, match1); addRegexToken('SS', match1to3, match2); addRegexToken('SSS', match1to3, match3); var token; for (token = 'SSSS'; token.length <= 9; token += 'S') { addRegexToken(token, matchUnsigned); } function parseMs(input, array) { array[MILLISECOND] = toInt(('0.' + input) * 1000); } for (token = 'S'; token.length <= 9; token += 'S') { addParseToken(token, parseMs); } // MOMENTS export var getSetMillisecond = makeGetSet('Milliseconds', false);