/**
 * Determines if haystack ends with needle.
 */ export function endsWith ( haystack , needle ) { let diff = haystack . length - needle . length ; if ( diff > 0 ) { return haystack . lastIndexOf ( needle ) === diff ; } else if ( diff === 0 ) { return haystack === needle ; } else { return false ; } } export function convertSimple2RegExpPattern ( pattern ) { return pattern . replace ( /[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g , '\\$&' ) . replace ( /[\*]/g , '.*' ) ; }