JSPM

@silen/is-reg-exp

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q40451F
  • License MIT

Check if the parameter is regexp

Package Exports

  • @silen/is-reg-exp

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@silen/is-reg-exp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-reg-exp

Determine if a value is RegExp

install

npm i @silen/is-reg-exp

api

  • declare function isRegExp(val: any): boolean;

usage

const { isRegExp } = require('@silen/is-reg-exp');
// or
import { isRegExp } from '@silen/is-reg-exp';

console.log(isRegExp(new Buffer(4)));
console.log(isRegExp(Buffer.alloc(4)));
console.log(isRegExp(undefined));
console.log(isRegExp(null));
console.log(isRegExp(''));
console.log(isRegExp(true));
console.log(isRegExp(0));
console.log(isRegExp(1));
console.log(isRegExp(1.0));
console.log(isRegExp('string'));
console.log(isRegExp({}));
console.log(isRegExp(function foo() {}));
console.log(isRegExp(Symbol()));
console.log(isRegExp(new Set));
console.log(isRegExp(new Map));
console.log(isRegExp(new WeakMap));
console.log(isRegExp(new WeakSet));

// or
console.log(window.Type.isRegExp(new WeakSet));

This is a demo for testing the usage of isRegExp from @silen/is-reg-exp module. You can try the others and do likewise.

others