tunnckoCore/starts-with

View on GitHub
benchmark/code/while.js

Summary

Maintainability
A
1 hr
Test Coverage
/* jshint asi:true */

'use strict'

module.exports = function startsWithWhile (foo, bar) {
  foo = String(foo)
  bar = String(bar)

  var i = bar.length
  while (i--) {
    if (foo[i] !== bar[i]) {
      return false
    }
  }

  return true
}