How to use the isPrimitive function from util

Find comprehensive JavaScript util.isPrimitive code examples handpicked from public code repositorys.

205
206
207
208
209
210
211
212
213
214
  // true
```


<div id="isPrimitive" class="anchor"></div>
## util.isPrimitive(object)

> 稳定度:0 - 已废弃

如果给定的 'object' 是一个基本类型,返回 `true`。否则,返回 `false`。
fork icon21
star icon99
watch icon2

1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259


function objEquiv(a, b, strict, actualVisitedObjects) {
  if (a === null || a === undefined || b === null || b === undefined)
    return false;
  // if one is a primitive, the other must be same
  if (util.isPrimitive(a) || util.isPrimitive(b))
    return a === b;
  if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
    return false;
  var aIsArgs = isArguments(a);
fork icon0
star icon0
watch icon1

+ 2 other calls in file