is-forwardslash
v1.0.0
Published
Checks given value is forwardslash - support char code number, hex, unicode or string value to be given.
Downloads
9
Readme
is-forwardslash
Checks given value is forwardslash - support char code number, hex, unicode or string value to be given.
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.
[val]
{String|Number} value to check[opts]
{Object} onlyopts.strict
option, defaultfalse
returns
{Boolean}
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
- is-async-function: Check that given function is async (callback) function or not. Trying to guess that based on check if
callback
,cb
,done
ornext
exists as function argument name. - is-backslash: Checks given value is backslash - support char code number, hex, unicode or string value to be given.
- 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
oruser/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
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.