A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/jonschlinkert/is-equal-regex below:

jonschlinkert/is-equal-regex: Returns true if regular expression A is equal to regex B. Compares the expression and flags.

is-equal-regex

Returns true if regular expression A is equal to regex B. Compares the expression and flags.

Install with npm

$ npm i is-equal-regex --save
var isEqualRegex = require('is-equal-regex');

isEqualRegex(/foo/, /foo/);
//=> true
isEqualRegex(/foo/g, /foo/g);
//=> true

isEqualRegex(/foo/, /bar/);
//=> false
isEqualRegex(/foo/g, /foo/);
//=> false

True

All of the following return true:

isEqualRegex(/foo/, /foo/);
isEqualRegex(/^bar/, /^bar/);
isEqualRegex(/foo/g, /foo/g);
isEqualRegex(/^bar$/, new RegExp('^bar$'));
isEqualRegex(/^bar$/gmi, new RegExp('^bar$', 'gmi'));
isEqualRegex(new RegExp('^bar$'), /^bar$/);
isEqualRegex(new RegExp('^bar$', 'gmi'), /^bar$/gmi);

False

All of the following return false:

isEqualRegex(/^bar$/gmi, new RegExp('^bar$'));
isEqualRegex(new RegExp('^bar$'), /^bar$/gmi);
isEqualRegex('a');
isEqualRegex('a', /foo/);
isEqualRegex();
isEqualRegex(/foo/);
isEqualRegex(/foo/, /bar/);
isEqualRegex(/foo/, /foo/gm);
isEqualRegex(/foo/, 'a');
isEqualRegex(/foo/, /^foo/);
isEqualRegex(/foo/, /bar/);
isEqualRegex(/foo/, []);
isEqualRegex(/foo/, new Date());
isEqualRegex(/foo/, null);
isEqualRegex(/foo/, undefined);
isEqualRegex(/foo/, {});
isEqualRegex(/foo/g, /foo/);
isEqualRegex([]);
isEqualRegex(new Date(), /foo/);
isEqualRegex(null);
isEqualRegex(undefined);
isEqualRegex({});

Install dev dependencies:

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Jon Schlinkert

Copyright © 2015 Jon Schlinkert Released under the MIT license.

This file was generated by verb-cli on July 27, 2015.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4