JAVASCRIPT   60

from-object.js

Guest on 22nd July 2021 02:19:45 AM

  1. import { normalizeObjectUnits } from '../units/aliases';
  2. import { configFromArray } from './from-array';
  3. import map from '../utils/map';
  4.  
  5. export function configFromObject(config) {
  6.     if (config._d) {
  7.         return;
  8.     }
  9.  
  10.     var i = normalizeObjectUnits(config._i),
  11.         dayOrDate = i.day === undefined ? i.date : i.day;
  12.     config._a = map(
  13.         [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
  14.         function (obj) {
  15.             return obj && parseInt(obj, 10);
  16.         }
  17.     );
  18.  
  19.     configFromArray(config);
  20. }

Raw Paste


Login or Register to edit or fork this paste. It's free.