New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

is-backslash

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-backslash

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

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

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.

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

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
  • 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.

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

Keywords

alike

FAQs

Package last updated on 29 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts