How to use gurmukhi-utils - 10 common examples

To help you get started, we’ve selected a few gurmukhi-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ShabadOS / desktop / app / frontend / src / Controller / Search.js View on Github external
Result = ( { gurmukhi, id: lineId, shabadId, ref, focused } ) => {
    const { searchedValue, anchor } = this.state

    // Get first letters in line and find where the match is
    const query = !anchor ? firstLetters( gurmukhi ) : gurmukhi

    // Split on each word if using first letter because letters correspond to whole words
    const splitChar = !anchor ? ' ' : ''

    // Remember to account for wildcard characters
    const pos = query.search( searchedValue.slice().replace( new RegExp( SEARCH_CHARS.wildcard, 'g' ), '.' ) )

    const words = stripPauses( gurmukhi ).split( splitChar )

    // Separate the line into words before the match, the match, and after the match
    const beforeMatch = words.slice( 0, pos ).join( splitChar ) + splitChar
    const match = words.slice( pos, pos + searchedValue.length ).join( splitChar ) + splitChar
    const afterMatch = words.slice( pos + searchedValue.length ).join( splitChar ) + splitChar

    // Send the shabad id and line id to the server on click
    const onClick = () => controller.shabad( { shabadId, lineId } )
github ShabadOS / desktop / app / frontend / src / Controller / Search.js View on Github external
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 }
  }
github ShabadOS / gurmukhi-utils / example.js View on Github external
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( 'ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥' ))
github ShabadOS / gurmukhi-utils / example.js View on Github external
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( 'ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥' ))
github ShabadOS / gurmukhi-utils / example.js View on Github external
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( 'ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥' ))
github ShabadOS / gurmukhi-utils / example.js View on Github external
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( 'ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥' ))
github ShabadOS / gurmukhi-utils / example.js View on Github external
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( 'ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥' ))
github ShabadOS / gurmukhi-utils / example.js View on Github external
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( 'ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥' ))
github ShabadOS / gurmukhi-utils / example.js View on Github external
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( 'ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥' ))
github ShabadOS / desktop / app / frontend / src / lib / controller.js View on Github external
  search = ( query, type ) => this.sendJSON( `search:${type}`, toAscii( query ) )

gurmukhi-utils

General functions for working with lines of Gurmukhi.

MIT
Latest version published 2 years ago

Package Health Score

52 / 100
Full package analysis