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

kasi

v1.1.0

Published

A collection of functions for working with different casings.

Downloads

70,863

Readme

Kasi

A collection of functions for working with different casings.

Install

npm install --save kasi

Functions

| Check | Convert | Extra | | --------------------------------- | --------------------------------- | ----------------- | | isCamelCase | toCamelCase | apply | | isConstantCase | toConstantCase | copy | | isDotCase | toDotCase | detect | | isKebabCase | toKebabCase | | | isLowerCase | toLowerCase | | | isPascalCase | toPascalCase | | | isPathCase | toPathCase | | | isSnakeCase | toSnakeCase | | | isTitleCase | toTitleCase | | | isUpperCase | toUpperCase | |

Check

These functions allow you to check if a string is using a specific casing.

isCamelCase

import {isCamelCase} from 'kasi';

isCamelCase ( 'fooBar' ); // => true
isCamelCase ( 'foo-bar' ); // => false

isConstantCase

import {isConstantCase} from 'kasi';

isConstantCase ( 'FOO_BAR' ); // => true
isConstantCase ( 'fooBar' ); // => false

isDotCase

import {isDotCase} from 'kasi';

isDotCase ( 'foo.bar' ); // => true
isDotCase ( 'fooBar' ); // => false

isKebabCase

import {isKebabCase} from 'kasi';

isKebabCase ( 'foo-bar' ); // => true
isKebabCase ( 'fooBar' ); // => false

isLowerCase

import {isLowerCase} from 'kasi';

isLowerCase ( 'foo' ); // => true
isLowerCase ( 'Foo' ); // => false

isPascalCase

import {isPascalCase} from 'kasi';

isPascalCase ( 'FooBar' ); // => true
isPascalCase ( 'fooBar' ); // => false

isPathCase

import {isPathCase} from 'kasi';

isPathCase ( 'foo/bar' ); // => true
isPathCase ( 'fooBar' ); // => false

isSnakeCase

import {isSnakeCase} from 'kasi';

isSnakeCase ( 'foo_bar' ); // => true
isSnakeCase ( 'fooBar' ); // => false

isTitleCase

import {isTitleCase} from 'kasi';

isTitleCase ( 'Foo Bar' ); // => true
isTitleCase ( 'fooBar' ); // => false

isUpperCase

import {isUpperCase} from 'kasi';

isUpperCase ( 'FOO' ); // => true
isUpperCase ( 'foo' ); // => false

Convert

These functions allow you to convert a string to a specific casing.

toCamelCase

import {toCamelCase} from 'kasi';

toCamelCase ( 'foo-bar' ); // => 'fooBar'
toCamelCase ( 'foo_bar' ); // => 'fooBar'

toConstantCase

import {toConstantCase} from 'kasi';

toConstantCase ( 'fooBar' ); // => 'FOO_BAR'
toConstantCase ( 'foo-bar' ); // => 'FOO_BAR'

toDotCase

import {toDotCase} from 'kasi';

toDotCase ( 'fooBar' ); // => 'foo.bar'
toDotCase ( 'foo-bar' ); // => 'foo.bar'

toKebabCase

import {toKebabCase} from 'kasi';

toKebabCase ( 'fooBar' ); // => 'foo-bar'
toKebabCase ( 'foo_bar' ); // => 'foo-bar'

toLowerCase

import {toLowerCase} from 'kasi';

toLowerCase ( 'FooBar' ); // => 'foobar'
toLowerCase ( 'foo-bar' ); // => 'foo-bar'

toPascalCase

import {toPascalCase} from 'kasi';

toPascalCase ( 'foo-bar' ); // => 'FooBar'
toPascalCase ( 'foo_bar' ); // => 'FooBar'

toPathCase

import {toPathCase} from 'kasi';

toPathCase ( 'fooBar' ); // => 'foo/bar'
toPathCase ( 'foo-bar' ); // => 'foo/bar'

toSnakeCase

import {toSnakeCase} from 'kasi';

toSnakeCase ( 'fooBar' ); // => 'foo_bar'
toSnakeCase ( 'foo-bar' ); // => 'foo_bar'

toTitleCase

import {toTitleCase} from 'kasi';

toTitleCase ( 'fooBar' ); // => 'Foo Bar'
toTitleCase ( 'foo-bar' ); // => 'Foo Bar'

toUpperCase

import {toUpperCase} from 'kasi';

toUpperCase ( 'fooBar' ); // => 'FOOBAR'
toUpperCase ( 'foo-bar' ); // => 'FOO-BAR'

Extra

These extra functions perform other operations related to casings.

apply

Transform a string to the given casing. Useful in combination with detect.

import {apply} from 'kasi';

apply ( 'foo-bar', 'camel' ); // => 'fooBar'
apply ( 'foo-bar', 'constant' ); // => 'FOO_BAR'

copy

This function copies the casing of a string to another string, character by character. The two strings must have the same length.

import {copy} from 'kasi';

copy ( 'sIlLy', 'lions' ); // => 'lIoNs'
copy ( 'SiLlY', 'lions' ); // => 'LiOnS'

detect

This function detects the casing of a string. Useful in combination with apply.

import {detect} from 'kasi';

detect ( 'fooBar' ); // => 'camel'
detect ( 'FOO_BAR' ); // => 'constant'
detect ( ' foo BAR ' ); // => 'unknown'

License

MIT © Fabio Spampinato