Socket
Socket
Sign inDemoInstall

@basekits/kit-string

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @basekits/kit-string

String manipulation and helper functions kit for basekits.


Version published
Maintainers
1
Created

Readme

Source

@basekits/kit-string

String manipulation and helper functions kit for basekits.

Install

npm i @basekits/kit-type @basekits/kit-object @basekits/kit-string

Usage

const kit = require('@basekits/core')
const type = require('@basekits/kit-type')
const object = require('@basekits/kit-object')
const string = require('@basekits/kit-string')
kit.addKit(type)
kit.addKit(object)
kit.addKit(string)

Available Items

The following methods will be available after adding this kit:

.sprintf(str, args)

Replaces %s expressions in the str string with given args in order.

kit.sprintf('Hey %s', 'Murat')
// returns "Hey Murat"

kit.sprintf('Hey %s, you have %s items in your cart.', ['Murat', 4])
// returns "Hey Murat, you have 4 items in your cart."

.template(str, props = {})

Replaces {{name}} expressions in a string with given props[name]

kit.template('Hey {{name}}!', {name: 'Murat'})
// returns "Hey Murat!"

.uppercase(str, locale = undefined)

Capitalize the str. Specify locale (en-US, tr-TR etc.) for locale aware case converting. Uses toLocaleUpperCase native function.


.lowercase(str, locale = undefined)

Lowercase the str. Specify locale (en-US, tr-TR etc.) for locale aware case converting. Uses toLocaleLowerCase native function.


.sentencecase(str, locale = undefined, nouns = [])

Capitalize only the first letter of the first word in given str. Specify locale for locale aware converting. nouns are the list of words that will be excluded while converting.


.titlecase(str, locale = undefined, nouns = [])

Capitalize only the first letter of the words in given str. Specify locale for locale aware converting. nouns are the list of words that will be excluded while converting.


Keywords

FAQs

Last updated on 20 Jan 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc