New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cerebrusinc/fstring

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cerebrusinc/fstring

This brings Python string manipulation to js!

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

py-qol logo

fstring

This package brings some Python string formatting to Javascript! Currently you can:

  • Abbreviate a string
  • Make a string sentence case
  • Make a string title case

Installation

npm install @techtronics/fstring

or

yarn add @techtronics/fstring

It goes hand in hand with our quality of life package qol

Importing

// ES6 Module
import * as fstring from "@techtronics/fstring";

// ES6 Destructuring
import { abbreviate, toTitleCase, toSentenceCase } from "@techtronics/fstring";

// ES5 Module
const fstring = require("@techtronics/fstring");

// ES5 Destructuring
const {
	abbreviate,
	toTitleCase,
	toSentenceCase,
} = require("@techtronics/fstring");

Usage

const sentence = "heLLo wOrLD, mY NAME is lEwis; i am a Developer.";
const name = "lEwiS mOsho junior";

console.log(toSentenceCase(sentence));
// Hello world, my name is lewis; I am a developer.

console.log(toTitleCase(name));
// Lewis Mosho Junior

console.log(abbreviate(name));
// LMJ

Functions

abbreviate

Make an abbreviation of a string; Usually used for names. It returns a capital case abbreviation of the string.

Params
ParameterDefault SettingRequired?Definition
txtnullYesThe string you wish to abbreviate
delimiter" "NoThe character or string that seperates words in the string
reversefalseNoAn option to enable you to request a reversed return string

toTitleCase

Make any string title cased. it returns a string in which every first letter of a word is upper cased with the rest being lower cased.

Params
ParameterDefault SettingRequired?Definition
txtnullYesThe string you wish to change to title case
delimiter" "NoThe character or string that seperates words in the string

toSentenceCase

Make any string sentence cased; The current sentence delimiters are:

  • .
  • ;
  • :
  • !
  • ?

It returns a string in which every first letter of the first word of a sentence is capitalised, with the reaminder of the senter being lower cased.

Params
ParameterDefault SettingRequired?Definition
txtnullYesThe string you wish to change to sentence case
delimiter" "NoThe character or string that seperates words in the string

Changelog

v0.1.x

v0.1.5
v0.1.4
  • Added colon support to toSentenceCase
  • Full parity with our python quality of life qolpy package
v0.1.3
  • Fixed missing build and type annotations
v0.1.2
  • Added the option to have the abbreviation reverse or not before return
v0.1.1
  • Type hint updates
  • README restructuring
  • toSentenceCase now supports custom delimiters 😎
v0.1.0
  • Initial release
  • Sentence casing, title casing, and abrreviations added and typed

Keywords

FAQs

Package last updated on 16 Oct 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc