JAVASCRIPT   70

is calendar spec

Guest on 1st May 2022 04:43:44 PM

  1. import isObjectEmpty from './is-object-empty';
  2. import hasOwnProp from './has-own-prop';
  3. import isObject from './is-object';
  4.  
  5. export default function isCalendarSpec(input) {
  6.     var objectTest = isObject(input) && !isObjectEmpty(input),
  7.         propertyTest = false,
  8.         properties = [
  9.             'sameDay',
  10.             'nextDay',
  11.             'lastDay',
  12.             'nextWeek',
  13.             'lastWeek',
  14.             'sameElse',
  15.         ],
  16.         i,
  17.         property;
  18.  
  19.     for (i = 0; i < properties.length; i += 1) {
  20.         property = properties[i];
  21.         propertyTest = propertyTest || hasOwnProp(input, property);
  22.     }
  23.  
  24.     return objectTest && propertyTest;
  25. }

Raw Paste


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