4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

String-Manager: NPM Dependency to manipulate strings

string manager on NPM

Component

String-Manager is NPM dependencies to manipulate strings. there are several submodules that can be found here that deal with string manipulation.

Benefits

There are many examples of string manipulation among developers, whether it's for styling purposes or for generating arguments that other functions will be used. String-Manager has wrapped all the above needs into a set of dependencies that are easy to use and develop.

Installation

npm install string-manager

And then please import the module you want to use as needed. for the module available, please check the list below.

Become Contributor

I am very happy if anyone wants to join this project. you can join as a developer or to present bug-issue issues, feature requests.

If you find a bug or request a new feature, please create an issue via the following link string manager issues.

If you want to join as developer, please fork repo that is linked below, You can act as developer, user or tester. To make it easy to manage, be sure to make an issue first before working on the feature, and be sure to mention the issue when pulling the request.

If you want to work on the issue, please provide comments in advance, so as not done by other developers, thus avoiding conflict codes.

Available Modules

toCamelCase
  • toCamelCase(str), generate camel case style for any string

    example :

    import {toCamelCase} from 'string-manager'
    
    console.log(toCamelCase('my name is yusuf'))
    

    will be : 'My Name Is Yusuf'

objToQuery
  • objToQuery(obj), convert object to http query

    example :

    import {objToQuery} from 'string-manager'
    
    let data = {
        is_active: false,
        count: 2,
        page: 1
    }
    console.log(objToQuery(data))
    
    

    will be : 'is_active=false&count=2&page=1'

queryToObj
  • queryToObj(str), convert http query to object

    example :

    import {queryToObj} from 'string-manager'
    
    let query = is_active=false&count=2&page=1
    console.log(queryToObj(query))
    

    will be :

    {
        is_active: false,
        count: 2,
        page: 1
    }
    
stripTags
  • stripTags(str), remove html tags
    example :
    import {stripTags} from 'string-manager'
    let str = stripTags('<p>masak sepatu</p>')
    
    will be 'makan sepatu'
toSingleSpace
  • toSingleSpace(str), replace multiple spaces to single space
    example :
    import {toSingleSpace} from 'string-manager'
    let str = toSingleSpace(' perubahan   kaki   panas ')
    
    
    will be 'perubahan kaki panas'
truncate
  • truncate(str, int, str), smart truncate string without losing meaning, with extra suffix.
    example :

    import {truncate} from 'string-manager'
    const str = truncate('memasak mi ayam hujan-hujan seperti ini memang enak, apalagi ada tambahan segelas teh hangat, makin ok', 25, '...')
    

    will be 'memasak mi ayam hujan-hujan...'

    standart js substring, will be 'memasak mi ayam hujan-huj'

toSlug
  • toSLug(str), slug generator, replace space to single dash and remove unsupport characters for url.
    import {toSlug} from 'string-manager'
    const slug = 'iam ready (for everything) to start'
    
    will be 'iam-ready-for-everything-to-start'
Currency
  • currencyFormat(int, str), set dot after three digit for currency nominal.
    import { currencyFormat } from 'string-manager
    const price = currencyFormat(245000, 'Rp')
    
    will be 'Rp 245.000'

Links



Posted on Utopian.io - Rewarding Open Source Contributors

45 upvotes $0.01

Replies (3)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: