Home

Awesome

is-backslash npmjs.com 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

Install

npm i is-backslash --save

Usage

For more use-cases see the tests

const isBackslash = require('is-backslash')

isBackslash

Check value is strictly backslash or backslash-like.

Example

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

Related

Contributing

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

Charlike Make Reagent new message to charlike freenode #charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github