How to use is-regexp - 2 common examples

To help you get started, we’ve selected a few is-regexp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rpominov / react-demo / src / stringify.js View on Github external
function handlePrimitive(x) {
  const t = typeof x
  if (x === null || x === undefined || t === 'number' || t === 'boolean' || isRegexp(x)) {
    return String(x)
  }
  return null
}
github radiovisual / birdwatch / lib / index.js View on Github external
self.feed().map(feed => {
					const options = objectAssign({}, self.options, feed.options);

					if (!feed.screenname) {
						throw new Error('Screenname required');
					}

					if (options.filterTags) {
						if (Array.isArray(options.filterTags)) {
							options.filterTags = hashRegex(options.filterTags);
						} else if (!isRegexp(options.filterTags)) {
							throw new TypeError(
								`Invalid regex: ${options.filterTags} for ${feed.screenname}`
							);
						}
					}
					self.feeds.push({
						screenname: feed.screenname,
						options
					});
					return Promise.resolve();
				})
			);

is-regexp

Check if a value is a regular expression

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis

Popular is-regexp functions