Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

strinify

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strinify

The strinify npm package provides string manipulation functions designed to enhance JavaScript's built-in string capabilities. It provides a set of intuitive functions that allow you to easily transform and manipulate strings in various ways.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15
Maintainers
1
Weekly downloads
 
Created
Source

npm version

npm downloads

NPM Package

strinify npm package

The strinify npm package provides string manipulation functions designed to enhance JavaScript's built-in string capabilities. It provides a set of intuitive functions that allow you to easily transform and manipulate strings in various ways.

Installation

To start using strinify in your JavaScript projects, you can install it via npm:

npm install strinify

Usage

Once you have installed strinify, you can import the desired functions into your JavaScript code:

const stringJS = require('strinify');

OR

const {
    capitalizeString,
    allCaps,
    capitalizeWords,
    capitalizeHeadline,
    removeExtraSpaces,
    kebobCase,
    snakeCase,
    camelCase,
    shift,
    makeHashTag,
    isEmpty
} = require('strinify');

Features

strinify offers a wide range of features that empower you to work with strings more effectively:

  • capitalize(string) Makes the first character of a given string uppercase.

  • allCaps(string) Makes all characters in the string uppercase.

  • capitalizeWords(string) Makes the first character of each word in the string uppercase.

  • capitalizeHeadline(string) Capitalizes all words in the string except certain words unless they are the first word.

  • removeExtraSpaces(string) Removes extra spaces from the beginning, end, and middle of the string.

  • kebobCase(string) Converts the string to kebob case by removing spaces and replacing them with hyphens.

  • snakeCase(string) Converts the string to snake case by removing spaces and replacing them with underscores.

  • camelCase(string) Converts the string to camel case.

  • shift(string) Shifts the first character of the string to the end.

  • makeHashTag(string) Converts the given string to a list of hash tags.

  • isEmpty(string) Returns true if the string is empty or contains only whitespace.

Functions and Examples

strinify provides the following functions for string manipulation:

capitalize(string)

Converts the first character of a string to uppercase.

Example:

const { capitalize } = require('strinify');

console.log(capitalize('hello world')); // Output: Hello world
console.log(capitalize('world')); // Output: World

allCaps(string)

Makes all characters in the string uppercase.

Example:

const { allCaps } = require('strinify');

console.log(allCaps('hello world')); // Output: HELLO WORLD

capitalizeWords(string)

Makes the first character of each word in the string uppercase.

Example:

const { capitalizeWords } = require('strinify');

console.log(capitalizeWords('hello world')); // Output: Hello World

- capitalizeHeadline(string)

Capitalizes all of the words except the words: the, in, a, an, and, but, for, at, by, from unless one of these words is the first word of the string!

Example:

const { capitalizeHeadline } = require('strinify');

console.log(capitalizeHeadline('for welcome to the world but')); // Output: For Welcome To the World but

removeExtraSpaces(string)

Removes all spaces from the beginning and end of a String along with any extra spaces in the middle. If more than one space appears in the middle of a string it is replaced by a single space.

Example:

const { removeExtraSpaces } = require('strinify');

console.log(removeExtraSpaces('hello     world')); // Output: hello world

kebobCase(string)

Converts the string to kebob case by removing spaces and replacing them with hyphens and makes all characters lowercase.

Example:

const { kebobCase } = require('strinify');

console.log(kebobCase('Hello World')); // Output: hello-world
console.log(kebobCase('Some String, Here')); // Output: some-string-here

snakeCase(string)

Converts the string to snake case by removing spaces and replacing them with underscores and makes all characters lowercase.

Example:

const { snakeCase } = require('strinify');

console.log(snakeCase('Hello World')); // Output: hello_world

camelCase(string)

Lowercases the first character of the first word. Then uppercases the first character of all other words, and removes all spaces.

Example:

const { camelCase } = require('strinify');

console.log(camelCase('Hello World')); // Output: helloWorld

shift(string)

Shifts the first character of the string to the end.

Example:

const { shift } = require('strinify');

console.log(shift('Hello World')); // Output: ello WorldH

makeHashTag(string)

This function should convert the given string to a hash tag. A hash tag begins with # and no spaces. Each word in the phrase begins with an uppercase letter. If the given string has more than three words, it picks the three longest and make the hash tag from those.

Example:

const { makeHashTag } = require('strinify');

console.log(makeHashTag('Amazing bongo drums for sale')); // Output: ['#amazing', '#bongo', '#drums']

isEmpty(string)

Returns true if the string is empty or contains only whitespace.

Example:

const { isEmpty } = require('strinify');

console.log(isEmpty('Hello World')); // Output: false
console.log(isEmpty(' ')); // Output: true

Contributing

I welcome contributions from the community to improve and expand the functionality of strinify. If you have any suggestions, bug reports, or feature requests, please don't hesitate to open an issue or submit a pull request on the GitHub repository.

  • The package is intended to be used for educational purposes only.

Keywords

FAQs

Package last updated on 23 Aug 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