export function sortText ( a , b ) { return a . toString ( ) . localeCompare ( b . toString ( ) ) ; } export function numericVersion ( v ) { const n = v . replace ( /^v/ , '' ) . split ( '.' ) . map ( ( a ) => parseInt ( a . replace ( /\D+/ , '' ) , 10 ) ) ; if ( n . length >= 3 ) return n [ 0 ] * 10000 + n [ 1 ] * 100 + n [ 2 ] ; if ( n . length === 2 ) return n [ 0 ] * 10000 + n [ 1 ] * 100 ; return n [ 0 ] * 10000 ; } export function replacer ( source , toReplace ) { return Object . keys ( toReplace ) . reduce ( ( destination , replaceParam ) => { return destination . replace ( new RegExp ( `:${ replaceParam }` , 'g' ) , toReplace [ replaceParam ] ) ; } , source ) ; }