You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

isPrefixOf.js 306B

12345678910111213
  1. 'use strict';
  2. var $strSlice = require('../helpers/callBound')('String.prototype.slice');
  3. module.exports = function isPrefixOf(prefix, string) {
  4. if (prefix === string) {
  5. return true;
  6. }
  7. if (prefix.length > string.length) {
  8. return false;
  9. }
  10. return $strSlice(string, 0, prefix.length) === prefix;
  11. };