X7ROOT File Manager
Current Path:
/usr/lib/node_modules/npm/node_modules/is-regex
usr
/
lib
/
node_modules
/
npm
/
node_modules
/
is-regex
/
ðŸ“
..
📄
.jscs.json
(4.04 KB)
📄
.npmignore
(97 B)
📄
.travis.yml
(4.66 KB)
📄
CHANGELOG.md
(1.08 KB)
📄
LICENSE
(1.06 KB)
📄
Makefile
(3.74 KB)
📄
README.md
(1.59 KB)
📄
index.js
(918 B)
📄
package.json
(1.79 KB)
📄
test.js
(1.76 KB)
Editing: index.js
'use strict'; var has = require('has'); var regexExec = RegExp.prototype.exec; var gOPD = Object.getOwnPropertyDescriptor; var tryRegexExecCall = function tryRegexExec(value) { try { var lastIndex = value.lastIndex; value.lastIndex = 0; regexExec.call(value); return true; } catch (e) { return false; } finally { value.lastIndex = lastIndex; } }; var toStr = Object.prototype.toString; var regexClass = '[object RegExp]'; var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; module.exports = function isRegex(value) { if (!value || typeof value !== 'object') { return false; } if (!hasToStringTag) { return toStr.call(value) === regexClass; } var descriptor = gOPD(value, 'lastIndex'); var hasLastIndexDataProperty = descriptor && has(descriptor, 'value'); if (!hasLastIndexDataProperty) { return false; } return tryRegexExecCall(value); };
Upload File
Create Folder