mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ctor single arg: allow plain object, reject null/undefined
Thank you @kub1x
This commit is contained in:
@@ -16,6 +16,14 @@ const object = function (val) {
|
||||
return typeof val === 'object';
|
||||
};
|
||||
|
||||
/**
|
||||
* Is this value a plain object?
|
||||
* @private
|
||||
*/
|
||||
const plainObject = function (val) {
|
||||
return object(val) && Object.prototype.toString.call(val) === '[object Object]';
|
||||
};
|
||||
|
||||
/**
|
||||
* Is this value a function?
|
||||
* @private
|
||||
@@ -98,6 +106,7 @@ const invalidParameterError = function (name, expected, actual) {
|
||||
module.exports = {
|
||||
defined: defined,
|
||||
object: object,
|
||||
plainObject: plainObject,
|
||||
fn: fn,
|
||||
bool: bool,
|
||||
buffer: buffer,
|
||||
|
||||
Reference in New Issue
Block a user