interface String { startsWith ( str ) : boolean ; endsWith ( str ) : boolean ; compare ( target , ignoreCase ? ) : number ; contains ( str , ignoreCase ? ) : boolean ; } interface Array < T > { includes ( obj ) : boolean ; remove ( from , to ) : Array < T > ; getUnique ( getValue ) : Array < T > ; indexOfDelegate ( predicate , fromIndex ? ) : number ; last ( ) : T ; find ( predicate ) : T ; some ( predicate ) : boolean ; } if ( ! String . prototype . compare ) { String . prototype . compare = function ( target , ignoreCase ? ) { var selfValue = this ; var targetValue = target || "" ; if ( ignoreCase ) { selfValue = selfValue . toLowerCase ( ) ; targetValue = targetValue . toLowerCase ( ) ; } if ( selfValue > targetValue ) { return 1 ; } else if ( selfValue < targetValue ) { return - 1 ; } else { return 0 ; } } ; } if ( ! String . prototype . startsWith ) { String . prototype . startsWith = function ( str ) { return this . slice ( 0 , str . length ) === str ; } ; } if ( ! String . prototype . endsWith ) { String . prototype . endsWith = function ( str ) { return this . indexOf ( str , this . length - str . length ) !== - 1 ; } ; } if ( ! String . prototype . contains ) { String . prototype . contains = function ( str , ignoreCase ? ) { var selfValue = this ; var searchValue = str || "" ; if ( ignoreCase ) { selfValue = selfValue . toLowerCase ( ) ; searchValue = searchValue . toLowerCase ( ) ; } return selfValue . indexOf ( searchValue ) !== - 1 ; } ; } if ( ! Array . prototype . includes ) { Array . prototype . includes = function ( searchElement ) { if ( this === undefined || this === null ) { throw new TypeError ( 'Cannot convert this value to object' ) ; } var O = Object ( this ) ; var len = parseInt ( O . length ) || 0 ; if ( len === 0 ) { return false ; } var k = 0 ; while ( k < len ) { var currentElement = O [ k ] ; if ( searchElement === currentElement || ( searchElement !== searchElement && currentElement !== currentElement ) ) { return true ; } k ++ ; } return false ; } ; } Array . prototype . remove = function ( from , to ) { var rest = this . slice ( ( to || from ) + 1 || this . length ) ; this . length = from < 0 ? this . length + from : from ; return this . push . apply ( this , rest ) ; } ; Array . prototype . getUnique = function ( getValue ) { var u = { } , a = [ ] ; for ( var i = 0 , l = this . length ; i < l ; ++ i ) { var value = getValue ( this [ i ] ) ; if ( u . hasOwnProperty ( value ) ) { continue ; } a . push ( this [ i ] ) ; u [ value ] = 1 ; } return a ; } ; Array . prototype . indexOfDelegate = function ( predicate , fromIndex ) { var k ; if ( this == null ) { throw new TypeError ( '"this" is null or not defined' ) ; } var O = Object ( this ) ; var len = O . length >>> 0 ; if ( len === 0 ) { return - 1 ; } var n = + fromIndex || 0 ; if ( Math . abs ( n ) === Infinity ) { n = 0 ; } if ( n >= len ) { return - 1 ; } k = Math . max ( n >= 0 ? n : len - Math . abs ( n ) , 0 ) ; while ( k < len ) { var kValue ; if ( k in O && predicate ( O [ k ] ) ) { return k ; } k ++ ; } return - 1 ; } ; if ( ! Array . prototype . some ) { Array . prototype . some = function ( fun ) { 'use strict' ; if ( this == null ) { throw new TypeError ( 'Array.prototype.some called on null or undefined' ) ; } if ( typeof fun !== 'function' ) { throw new TypeError ( ) ; } var t = Object ( this ) ; var len = t . length >>> 0 ; var thisArg = arguments . length >= 2 ? arguments [ 1 ] : void 0 ; for ( var i = 0 ; i < len ; i ++ ) { if ( i in t && fun . call ( thisArg , t [ i ] , i , t ) ) { return true ; } } return false ; } ; } if ( ! Array . prototype . last ) { Array . prototype . last = function ( ) { return this [ this . length - 1 ] ; } ; } ; if ( ! Array . prototype . find ) { Array . prototype . find = function ( predicate ) { if ( this == null ) { throw new TypeError ( 'Array.prototype.find called on null or undefined' ) ; } if ( typeof predicate !== 'function' ) { throw new TypeError ( 'predicate must be a function' ) ; } var list = Object ( this ) ; var length = list . length >>> 0 ; var thisArg = arguments [ 1 ] ; var value ; for ( var i = 0 ; i < length ; i ++ ) { value = list [ i ] ; if ( predicate . call ( thisArg , value , i , list ) ) { return value ; } } return undefined ; } ; }