src/datetime.js
function normalizeUnit(unit) {
  const normalized = {
    year: "year",
    years: "year",
    month: "month",
    months: "month",
    day: "day",
    days: "day",
    hour: "hour",
    hours: "hour",
    minute: "minute",
    minutes: "minute",
    second: "second",
    seconds: "second",
    millisecond: "millisecond",
    milliseconds: "millisecond",
    weekday: "weekday",
    weekdays: "weekday",
    weeknumber: "weekNumber",
    weeksnumber: "weekNumber",
    weeknumbers: "weekNumber",
    weekyear: "weekYear",
    weekyears: "weekYear",
    ordinal: "ordinal"
  }[unit.toLowerCase()];

  if (!normalized) throw new InvalidUnitError(unit);

  return normalized;
}
function normalizeUnit(unit) {
  const normalized = {
    year: "year",
    years: "year",
    month: "month",
    months: "month",
    day: "day",
    days: "day",
    hour: "hour",
    hours: "hour",
    minute: "minute",
    minutes: "minute",
    second: "second",
    seconds: "second",
    millisecond: "millisecond",
    milliseconds: "millisecond",
    weekday: "weekday",
    weekdays: "weekday",
    weeknumber: "weekNumber",
    weeksnumber: "weekNumber",
    weeknumbers: "weekNumber",
    weekyear: "weekYear",
    weekyears: "weekYear",
    ordinal: "ordinal"
  }[unit.toLowerCase()];

  if (!normalized) throw new InvalidUnitError(unit);

  return normalized;
}
function normalizeUnit ( unit ) { const normalized = { year : "year" , years : "year" , month : "month" , months : "month" , day : "day" , days : "day" , hour : "hour" , hours : "hour" , minute : "minute" , minutes : "minute" , second : "second" , seconds : "second" , millisecond : "millisecond" , milliseconds : "millisecond" , weekday : "weekday" , weekdays : "weekday" , weeknumber : "weekNumber" , weeksnumber : "weekNumber" , weeknumbers : "weekNumber" , weekyear : "weekYear" , weekyears : "weekYear" , ordinal : "ordinal" } [ unit . toLowerCase ( ) ] ; if ( ! normalized ) throw new InvalidUnitError ( unit ) ; return normalized ; }
standardize case and plurality in units
standardize case and plurality in units