Repositorio del curso CCOM4030 el semestre B91 del proyecto kilometro0

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. };