import _ from 'lodash' ; /**
 * RegExp used to identify the start of a word.
 */ const WordStartRegExp = /[\w]+$/ ; /**
 * RegExp used to identify the end of a word.
 */ const WordEndRegExp = /^\w+/ ; /**
 * RegExp used to identify a whitespace at the beginning of a string.
 */ const WhiteSpaceStartRegExp = /^\s/ ; /**
 * RegExp used to identify a whitespace at the end of a string.
 */ const WhiteSpaceEndRegExp = /\s$/ ; param str param position return export function getWordAtPosition ( str , position ) { const start = WordStartRegExp . exec ( str . substr ( 0 , position ) ) ; const wordStart = _ . isNil ( start ) ? position : start . index ; const end = WordEndRegExp . exec ( str . substr ( position ) ) ; const wordEnd = position + ( _ . isNil ( end ) ? 0 : end [ 0 ] . length ) ; return { word : str . substring ( wordStart , wordEnd ) , start : wordStart , end : wordEnd } ; } param str return export function startWithWhiteSpace ( str ) { return WhiteSpaceStartRegExp . test ( str ) ; } param str return export function endWithWhiteSpace ( str ) { return WhiteSpaceEndRegExp . test ( str ) ; } see https param base64 return export function toBase64Url ( base64 ) { return base64 . replace ( /=/g , '' ) . replace ( /\+/g , '-' ) . replace ( /\//g , '_' ) ; }