cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

is-calendar-spec.js (670B)


      1import isObjectEmpty from './is-object-empty';
      2import hasOwnProp from './has-own-prop';
      3import isObject from './is-object';
      4
      5export 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}