summaryrefslogtreecommitdiff
path: root/src/node_modules/es-abstract/helpers/isPrefixOf.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/node_modules/es-abstract/helpers/isPrefixOf.js')
-rw-r--r--src/node_modules/es-abstract/helpers/isPrefixOf.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/node_modules/es-abstract/helpers/isPrefixOf.js b/src/node_modules/es-abstract/helpers/isPrefixOf.js
new file mode 100644
index 0000000..b67d640
--- /dev/null
+++ b/src/node_modules/es-abstract/helpers/isPrefixOf.js
@@ -0,0 +1,13 @@
+'use strict';
+
+var $strSlice = require('../helpers/callBound')('String.prototype.slice');
+
+module.exports = function isPrefixOf(prefix, string) {
+ if (prefix === string) {
+ return true;
+ }
+ if (prefix.length > string.length) {
+ return false;
+ }
+ return $strSlice(string, 0, prefix.length) === prefix;
+};