PHP Classes

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

Recommend this page to a friend!
  Classes of James Brows   Coffee CMS   CoffeeCMS/contents/themes/cfnews/assets/moment/src/lib/units/aliases.js   Download  
File: CoffeeCMS/contents/themes/cfnews/assets/moment/src/lib/units/aliases.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: 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; }