2.0.9 • Published 2 months ago

@zerodep/case-sentence v2.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@zerodep/case-sentence

version language types license

CodeFactor Known Vulnerabilities

A utility to convert a string to sentence case that also strips out non-alphanumeric characters and any leading numeric characters. Non-string values will cause a ZeroDepError to be thrown.

Full documentation is available at the zerodep.app page.

Examples

All @zerodep packages support both ESM and CJS.

import { caseSentence } from '@zerodep/case-sentence';
// or
const { caseSentence } = require('@zerodep/case-sentence');

Use Cases

caseSentence('From sentence case'); // "from sentence case"
caseSentence('fromCamelCase'); // "from camel case"
caseSentence('from.dot.case'); // "from dot case"
caseSentence('from_snake_case'); // "from snake case"
caseSentence('FromPascalCase'); // "from pascal case"
caseSentence(''); // ""

// with non-alphanumeric characters
caseSentence('A string with some !@#$%^& characters'); // "a string with some characters"
caseSentence('A #22 character long string'); // "a 22 character long string"
caseSentence("I'm a sp3c!al $741ng"); // "i m a sp3c al 741ng"

// with accented characters
caseSentence('àëîóüý Žøñç'); // "aeiouy zonc"

// with leading special characters and numbers
caseSentence('__with    many --- spaces'); // "with many spaces"
caseCamel('12 monkeys see 6 bananas'); // "monkeys see 6 bananas"

// non-string values
caseSentence({ not: 'a string' }); // throws ZeroDepError: Value is not a string
2.0.9

2 months ago

2.0.8

2 months ago

2.0.7

2 months ago

2.0.6

7 months ago

2.0.5

7 months ago

2.0.3

10 months ago

2.0.2

10 months ago

2.0.1

10 months ago