1.0.0 • Public • Published

is-backslash The MIT License

Checks given value is backslash - support char code number, hex, unicode or string value to be given.

code climate standard code style travis build status coverage status dependency status


npm i is-backslash --save


For more use-cases see the tests

const isBackslash = require('is-backslash')


Check value is strictly backslash or backslash-like.

  • [val] {String|Number} value to check
  • [opts] {Object} only opts.strict option, default false
  • returns {Boolean}


const isBackslash = require('is-backslash')
// returns true (default mode, opts.strict !== true)
console.log(isBackslash(92, {strict: 123})) // => true
console.log(isBackslash(92))                // => true
console.log(isBackslash('92'))              // => true
console.log(isBackslash('\\'))              // => true
console.log(isBackslash('\u005C'))          // => true
console.log(isBackslash('\u005c'))          // => true
console.log(isBackslash('\x5c'))            // => true
console.log(isBackslash('\'))           // => true
// strict mode - need explicitly define `opts.strict: true`
console.log(isBackslash(92, {strict: true}))        // => false
console.log(isBackslash('92', {strict: true}))      // => false
console.log(isBackslash('\\', {strict: true}))      // => true
console.log(isBackslash('\u005C', {strict: true}))  // => true
console.log(isBackslash('\u005c', {strict: true}))  // => true
console.log(isBackslash('\x5c', {strict: true}))    // => true
console.log(isBackslash('\', {strict: 123}))    // => true
console.log(isBackslash('\', {strict: true}))   // => false
console.log(isBackslash(['foo', 'bar']))            // => false
console.log(isBackslash({a: 'b'}))                  // => false
console.log(isBackslash())                          // => false


  • is-async-function: Check that given function is async (callback) function or not. Trying to guess that based on check if callback, cb, done or next exists as function argument name.
  • is-child-process: Checks whether a value is child process result, which in case is more specific Node.js EventEmitter.
  • is-emitter: Check that given value is EventEmitter, not so strict as is-node-emitter.
  • is-empty-function: Check that given string, function or arrow function have empty body, using parse-function.
  • is-hexcolor: Check that given value is valid hex color, using hex-color-regex - the best regex for matching hex color values
  • is-installed: Checks that given package is installed on the system - globally or locally.
  • is-kindof: Check type of given javascript value. Support promises, generators, streams, and native types.
  • is-missing: Check that given name or user/repo exists in npm registry or in github as user repository.
  • is-node-emitter: Strictly checks that given value is nodejs EventEmitter. It's easy, because his API is in frozen state.
  • is-node-stream: Strictly and correctly checks if value is a nodejs stream.
  • is-real-object: Returns true if a value is any type of object, but not an array. Browserify-ready.
  • is-request-stream: Check that given value is request stream
  • is-singular: Return true if given word is in singular form like apple, car, test and false otherwise, never throws.
  • is-sync-function: Opposite of is-async-function. Check that given function is synchronous.
  • is-typeof-error: Check that given value is any type of error and instanceof Error
  • is-forwardslash: Checks given value is forwardslash - support char code number, hex, unicode or string value to be given.


Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the guidelines.

Charlike Make Reagent new message to charlike freenode #charlike keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github

Package Sidebar


npm i is-backslash

Weekly Downloads






Last publish


  • vanchoy
  • tunnckocore