String-Manager is NPM dependencies to manipulate strings. there are several submodules that can be found here that deal with string manipulation.
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.
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.
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.
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(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(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(str), remove html tagsimport {stripTags} from 'string-manager'
let str = stripTags('masak sepatu
')
will be 'makan sepatu'toSingleSpace(str), replace multiple spaces to single spaceimport {toSingleSpace} from 'string-manager'
let str = toSingleSpace(' perubahan kaki panas ')
will be 'perubahan kaki panas'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(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'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'