All files / libs/lang isObject.js

100% Statements 3/3
100% Branches 3/3
100% Functions 1/1
100% Lines 3/3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25                                        1x 180x 180x    
/**
 * @module      libs/lang/isObject
 * @createdAt   2016-07-01
 *
 * @copyright   Copyright (c) 2016 Zhonglei Qiu
 * @license     Licensed under the MIT license.
 */
 
/**
 * 判断 any 是不是一个 JS Object
 *
 * 除了 null, 及字面量,其它一般都是 Object,包括 函数
 *
 * @param   {*}      any   任何的 JS 类型
 * @return  Boolean
 *
 * @see     [is-obj@1.0.1]{@link https://github.com/sindresorhus/is-obj/tree/v1.0.1}
 * @author  Zhonglei Qiu
 * @since   2.0.0
 */
module.exports = function(any) {
  var type = typeof any
  return any !== null && (type === 'object' || type === 'function')
}