Skip to content

Function triggers error if argument is not a primitive type

License

Notifications You must be signed in to change notification settings

writetome51/error-if-not-primitive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

errorIfNotPrimitive(arg): void

Triggers error if arg is not a primitive type.
The only types considered primitive here are number, string, and boolean.

Example

errorIfNotPrimitive([]);
// Error: "Input must be either a number, string, or boolean"

Installation

npm i error-if-not-primitive

Loading

// if using TypeScript:
import { errorIfNotPrimitive } from 'error-if-not-primitive';
// if using ES5 JavaScript:
var errorIfNotPrimitive = require('error-if-not-primitive').errorIfNotPrimitive;

About

Function triggers error if argument is not a primitive type

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published