Home

Awesome

is-forwardslash npmjs.com The MIT License

Checks given value is forwardslash - 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-forwardslash --save

Usage

For more use-cases see the tests

const isForwardslash = require('is-forwardslash')

isForwardslash

Check value is strictly forwardslash or forwardslash-like.

Example

const isForwardslash = require('is-forwardslash')

// returns true (default mode, opts.strict !== true)
console.log(isForwardslash(47, {strict: 123})) // => true
console.log(isForwardslash(47))                // => true
console.log(isForwardslash('47'))              // => true
console.log(isForwardslash('/'))              // => true
console.log(isForwardslash('\u002F'))          // => true
console.log(isForwardslash('\u002f'))          // => true
console.log(isForwardslash('\x2f'))            // => true
console.log(isForwardslash('/'))           // => true

// strict mode - need explicitly define `opts.strict: true`
console.log(isForwardslash(47, {strict: true}))        // => false
console.log(isForwardslash('47', {strict: true}))      // => false
console.log(isForwardslash('/', {strict: true}))      // => true
console.log(isForwardslash('\u002F', {strict: true}))  // => true
console.log(isForwardslash('\u002f', {strict: true}))  // => true
console.log(isForwardslash('\x2f', {strict: true}))    // => true

console.log(isForwardslash('/', {strict: 123}))    // => true
console.log(isForwardslash('/', {strict: true}))   // => false
console.log(isForwardslash(['foo', 'bar']))            // => false
console.log(isForwardslash({a: 'b'}))                  // => false
console.log(isForwardslash())                          // => 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