Skip to content

Commit

Permalink
Replace all instanceof Object checks (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
rricard authored and icambron committed Jul 19, 2018
1 parent b937d0c commit 25b3230
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/datetime.js
Expand Up @@ -1865,7 +1865,7 @@ export function friendlyDateTime(dateTimeish) {
return dateTimeish;
} else if (dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {
return DateTime.fromJSDate(dateTimeish);
} else if (dateTimeish instanceof Object) {
} else if (typeof dateTimeish === 'object') {
return DateTime.fromObject(dateTimeish);
} else {
throw new InvalidArgumentError('Unknown datetime argument');
Expand Down
4 changes: 2 additions & 2 deletions src/duration.js
Expand Up @@ -157,7 +157,7 @@ export function friendlyDuration(duration) {
return Duration.fromMillis(duration);
} else if (duration instanceof Duration) {
return duration;
} else if (duration instanceof Object) {
} else if (typeof duration === 'object') {
return Duration.fromObject(duration);
} else {
throw new InvalidArgumentError('Unknown duration argument');
Expand Down Expand Up @@ -219,7 +219,7 @@ export default class Duration {
}

/**
* Create a Duration from a Javascript object with keys like 'years' and 'hours.
* Create a Duration from a Javascript object with keys like 'years' and 'hours.
* If this object is empty then zero milliseconds duration is returned.
* @param {Object} obj - the object to create the DateTime from
* @param {number} obj.years
Expand Down

0 comments on commit 25b3230

Please sign in to comment.