import isArray from '../utils/is-array';
+import isUndefined from '../utils/is-undefined';
import compareArrays from '../utils/compare-arrays';
import { Locale } from './constructor';
function loadLocale(name) {
var oldLocale = null;
// TODO: Find a better way to register and load all the locales in Node
- if (!locales[name] && typeof module !== 'undefined' &&
+ if (!locales[name] && !isUndefined(module) &&
module && module.exports) {
try {
oldLocale = globalLocale._abbr;
export function getSetGlobalLocale (key, values) {
var data;
if (key) {
- if (typeof values === 'undefined') {
+ if (isUndefined(values)) {
data = getLocale(key);
}
else {
import { isMoment } from './constructor';
import { normalizeUnits } from '../units/aliases';
import { createLocal } from '../create/local';
+import isUndefined from '../utils/is-undefined';
export function isAfter (input, units) {
var localInput = isMoment(input) ? input : createLocal(input);
if (!(this.isValid() && localInput.isValid())) {
return false;
}
- units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
+ units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
if (units === 'millisecond') {
return +this > +localInput;
} else {
if (!(this.isValid() && localInput.isValid())) {
return false;
}
- units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
+ units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
if (units === 'millisecond') {
return +this < +localInput;
} else {
import { hooks } from '../utils/hooks';
import hasOwnProp from '../utils/has-own-prop';
+import isUndefined from '../utils/is-undefined';
import getParsingFlags from '../create/parsing-flags';
// Plugins that add properties should also add the key here (null value),
export function copyConfig(to, from) {
var i, prop, val;
- if (typeof from._isAMomentObject !== 'undefined') {
+ if (!isUndefined(from._isAMomentObject)) {
to._isAMomentObject = from._isAMomentObject;
}
- if (typeof from._i !== 'undefined') {
+ if (!isUndefined(from._i)) {
to._i = from._i;
}
- if (typeof from._f !== 'undefined') {
+ if (!isUndefined(from._f)) {
to._f = from._f;
}
- if (typeof from._l !== 'undefined') {
+ if (!isUndefined(from._l)) {
to._l = from._l;
}
- if (typeof from._strict !== 'undefined') {
+ if (!isUndefined(from._strict)) {
to._strict = from._strict;
}
- if (typeof from._tzm !== 'undefined') {
+ if (!isUndefined(from._tzm)) {
to._tzm = from._tzm;
}
- if (typeof from._isUTC !== 'undefined') {
+ if (!isUndefined(from._isUTC)) {
to._isUTC = from._isUTC;
}
- if (typeof from._offset !== 'undefined') {
+ if (!isUndefined(from._offset)) {
to._offset = from._offset;
}
- if (typeof from._pf !== 'undefined') {
+ if (!isUndefined(from._pf)) {
to._pf = getParsingFlags(from);
}
- if (typeof from._locale !== 'undefined') {
+ if (!isUndefined(from._locale)) {
to._locale = from._locale;
}
for (i in momentProperties) {
prop = momentProperties[i];
val = from[prop];
- if (typeof val !== 'undefined') {
+ if (!isUndefined(val)) {
to[prop] = val;
}
}
import { createUTC } from '../create/utc';
import isDate from '../utils/is-date';
import toInt from '../utils/to-int';
+import isUndefined from '../utils/is-undefined';
import compareArrays from '../utils/compare-arrays';
import { hooks } from '../utils/hooks';
}
export function isDaylightSavingTimeShifted () {
- if (typeof this._isDSTShifted !== 'undefined') {
+ if (!isUndefined(this._isDSTShifted)) {
return this._isDSTShifted;
}
import extend from './extend';
import { hooks } from './hooks';
+import isUndefined from './is-undefined';
function warn(msg) {
- if (hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) {
+ if (hooks.suppressDeprecationWarnings === false && !isUndefined(console) && console.warn) {
console.warn('Deprecation warning: ' + msg);
}
}
}
hooks.suppressDeprecationWarnings = false;
-
--- /dev/null
+export default function isUndefined(input) {
+ return input === void 0;
+}