lib/vendor/sugar.js
function(reg, pos, c) {
      var str = this, source;
      if(isDefined(pos)) str = str.slice(0, pos);
      if(isUndefined(c)) c = true;
      source = isRegExp(reg) ? reg.source.replace('$', '') : escapeRegExp(reg);
      return regexp(source + '$', c ? '' : 'i').test(str);
    }
function(reg, pos, c) {
      var str = this, source;
      if(isDefined(pos)) str = str.slice(0, pos);
      if(isUndefined(c)) c = true;
      source = isRegExp(reg) ? reg.source.replace('$', '') : escapeRegExp(reg);
      return regexp(source + '$', c ? '' : 'i').test(str);
    }
function ( reg , pos , c ) { var str = this , source ; if ( isDefined ( pos ) ) str = str . slice ( 0 , pos ) ; if ( isUndefined ( c ) ) c = true ; source = isRegExp ( reg ) ? reg . source . replace ( '$' , '' ) : escapeRegExp ( reg ) ; return regexp ( source + '$' , c ? '' : 'i' ) . test ( str ) ; }
*
@method endsWith(<find>, [pos] = length, [case] = true)
@returns Boolean
@short Returns true if the string ends with <find>.
@extra <find> may be either a string or regex. Search ends at [pos], which defaults to the entire string. Case sensitive if [case] is true.
@example

'jumpy'.endsWith('py')            -> true
'jumpy'.endsWith(/[q-z]/)         -> true
'jumpy'.endsWith('MPY')           -> false
'jumpy'.endsWith('mp', 4)         -> false
'jumpy'.endsWith('MPY', 5, false) -> true

*
* @method endsWith ( <find > [ pos ] = length [ case ] = true ) @returns Boolean @short Returns true if the string ends with <find > . @extra <find > may be either a string or regex . Search ends at [ pos ] which defaults to the entire string . Case sensitive if [ case ] is true . @example