npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

strinify

v1.0.2

Published

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.

Downloads

69

Readme

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.