MCPcopy
hub / github.com/amark/gun / isRegExp

Function isRegExp

test/expect.js:774–790  ·  view source on GitHub ↗
(re)

Source from the content-addressed store, hash-verified

772 }
773
774 function isRegExp(re) {
775 var s;
776 try {
777 s = '' + re;
778 } catch (e) {
779 return false;
780 }
781
782 return re instanceof RegExp || // easy case
783 // duck-type for context-switching evalcx case
784 typeof(re) === 'function' &&
785 re.constructor.name === 'RegExp' &&
786 re.compile &&
787 re.test &&
788 re.exec &&
789 s.match(/^\/.*\/[gim]{0,3}$/);
790 }
791
792 function isDate(d) {
793 return d instanceof Date;

Callers 2

expect.jsFile · 0.70
formatFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected