PHP Classes

File: upload/themes/bb_simple/assets/moment/src/lib/units/aliases.js

Recommend this page to a friend!
  Classes of James Brows   PHP Bulletin Board   upload/themes/bb_simple/assets/moment/src/lib/units/aliases.js   Download  
File: upload/themes/bb_simple/assets/moment/src/lib/units/aliases.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Bulletin Board
Manage and post messages in multi-user forums
Author: By
Last change:
Date: 2 years ago
Size: 795 bytes
 

Contents

Class file image Download
import hasOwnProp from '../utils/has-own-prop'; var aliases = {}; export function addUnitAlias (unit, shorthand) { var lowerCase = unit.toLowerCase(); aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; } export function normalizeUnits(units) { return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; } export function normalizeObjectUnits(inputObject) { var normalizedInput = {}, normalizedProp, prop; for (prop in inputObject) { if (hasOwnProp(inputObject, prop)) { normalizedProp = normalizeUnits(prop); if (normalizedProp) { normalizedInput[normalizedProp] = inputObject[prop]; } } } return normalizedInput; }