Skip to content

Latest commit

 

History

History
35 lines (29 loc) · 615 Bytes

util_isprimitive_object.md

File metadata and controls

35 lines (29 loc) · 615 Bytes

Stability: 0 - Deprecated

  • object {any}

Returns true if the given object is a primitive type. Otherwise, returns false.

const util = require('util');

util.isPrimitive(5);
// Returns: true
util.isPrimitive('foo');
// Returns: true
util.isPrimitive(false);
// Returns: true
util.isPrimitive(null);
// Returns: true
util.isPrimitive(undefined);
// Returns: true
util.isPrimitive({});
// Returns: false
util.isPrimitive(function() {});
// Returns: false
util.isPrimitive(/^$/);
// Returns: false
util.isPrimitive(new Date());
// Returns: false