mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-19 06:20:38 -07:00
Add isPlainObject to 'util/underscore.js'
This commit is contained in:
@@ -94,6 +94,15 @@ function isObject (value) {
|
||||
return value !== null && typeof value === 'object'
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if value's prototype is Object or undefined.
|
||||
* @param {any} value The value to check.
|
||||
* @return {Boolean} Returns true if value is a plain object, else false.
|
||||
*/
|
||||
function isPlainObject(value) {
|
||||
return value && !value.constructor || value.constructor === Object
|
||||
}
|
||||
|
||||
/*
|
||||
* A function to create flexibly-numbered lists of integers,
|
||||
* handy for each and map loops. start, if omitted, defaults to 0; step defaults to 1.
|
||||
@@ -119,6 +128,7 @@ function range (start, stop, step) {
|
||||
exports.isString = isString
|
||||
exports.isArray = isArray
|
||||
exports.isObject = isObject
|
||||
exports.isPlainObject = isPlainObject
|
||||
exports.isError = isError
|
||||
|
||||
exports.range = range
|
||||
|
||||
Reference in New Issue
Block a user