aswi2020vldc-gitlab/templetes/node_modules/es-abstract/helpers/isPrefixOf.js @ 56f6c6df
1 | 3a515b92 | cagy | 'use strict'; |
---|---|---|---|
2 | |||
3 | var $strSlice = require('../helpers/callBound')('String.prototype.slice'); |
||
4 | |||
5 | module.exports = function isPrefixOf(prefix, string) { |
||
6 | if (prefix === string) { |
||
7 | return true; |
||
8 | }
|
||
9 | if (prefix.length > string.length) { |
||
10 | return false; |
||
11 | }
|
||
12 | return $strSlice(string, 0, prefix.length) === prefix; |
||
13 | };
|