Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getSearchParams = searchQuery => {
// Extract anchors and search query
const [ , anchor, query ] = searchQuery.match( this.searchRegex )
const inputValue = toAscii( query )
// Get search type from anchor char, if any
const type = SEARCH_ANCHORS[ anchor ] || SEARCH_TYPES.firstLetter
const value = type === SEARCH_TYPES.firstLetter
? inputValue.slice().replace( new RegExp( SEARCH_CHARS.wildcard, 'g' ), '_' )
: inputValue
return { anchor, value, type }
}
const { toHindi, toShahmukhi, toAscii, toUnicode, firstLetters, transliterate } = require( 'gurmukhi-utils' )
console.log(toUnicode( 'Koj' ))
console.log(toAscii('ਖੋਜ'))
console.log(firstLetters( 'hir hir hir gun gwvhu ]' ))
console.log(firstLetters( 'ਹਰਿ ਹਰਿ ਹਰਿ ਗੁਨੀ' ))
console.log(transliterate( 'ਹੁਕਮੀ ਹੁਕਮੁ ਚਲਾਏ ਰਾਹੁ ॥' ))
console.log(toShahmukhi( 'ਹਰਿ ਹਰਿ ਹਰਿ ਗੁਨੀ' ))
console.log(toHindi( 'ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥' ))
search = ( query, type ) => this.sendJSON( `search:${type}`, toAscii( query ) )