blob: 0f644d746f7405817c6de247469c2faed159bbf1 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001'use strict';
2
3var $strSlice = require('call-bind/callBound')('String.prototype.slice');
4
5module.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};