diff options
Diffstat (limited to 'node_modules/es-abstract/helpers/isPrefixOf.js')
-rw-r--r-- | node_modules/es-abstract/helpers/isPrefixOf.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/node_modules/es-abstract/helpers/isPrefixOf.js b/node_modules/es-abstract/helpers/isPrefixOf.js new file mode 100644 index 000000000..b67d64056 --- /dev/null +++ b/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; +}; |