PHP Classes

File: vendors/gentelella/vendors/moment/src/lib/moment/get-set.js

Recommend this page to a friend!
  Classes of Jorge Castro   Gentelella BladeOne   vendors/gentelella/vendors/moment/src/lib/moment/get-set.js   Download  
File: vendors/gentelella/vendors/moment/src/lib/moment/get-set.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Gentelella BladeOne
Render templates using Bootstrap for presentation
Author: By
Last change:
Date: 3 years ago
Size: 1,045 bytes
 

Contents

Class file image Download
import { normalizeUnits } from '../units/aliases'; import { hooks } from '../utils/hooks'; import isFunction from '../utils/is-function'; export function makeGetSet (unit, keepTime) { return function (value) { if (value != null) { set(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }; } export function get (mom, unit) { return mom.isValid() ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; } export function set (mom, unit, value) { if (mom.isValid()) { mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); } } // MOMENTS export function getSet (units, value) { var unit; if (typeof units === 'object') { for (unit in units) { this.set(unit, units[unit]); } } else { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](value); } } return this; }