服务器

Array

Collection

Date

Function

Lang

Math

Number

Object

Seq

String

Util

Properties

Methods

_.has(object, path)

检查是否path是否含有object

版本

0.1.0

参数
  1. object (Object):要查询的对象。
  2. path (数组|字符串):要检查的路径。
返回

(boolean):返回true是否path存在,否则false

var object = { 'a': { 'b': 2 } };

var other = _.create({ 'a': _.create({ 'b': 2 }) });
 
_.has(object, 'a');
// => true
 
_.has(object, 'a.b');
// => true
 
_.has(object, ['a', 'b']);
// => true
 
_.has(other, 'a');
// => false