@zerodep/case-dot
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

@zerodep/case-dot

version language types license

CodeFactor Known Vulnerabilities

A utility to convert a string to dot.case that also strips out non-alphanumeric characters and any leading numeric characters.

Full documentation is available at the zerodep.app page.

Examples

All @zerodep packages support both ESM and CJS.

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

Use Cases

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

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

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

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

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

Readme

Keywords

Package Sidebar

Install

npm i @zerodep/case-dot

Homepage

zerodep.app

Weekly Downloads

1

Version

2.0.3

License

MIT

Unpacked Size

10.8 kB

Total Files

7

Last publish

Collaborators

  • cdepage