This commit is contained in:
21
node_modules/scule/LICENSE
generated
vendored
Normal file
21
node_modules/scule/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
149
node_modules/scule/README.md
generated
vendored
Normal file
149
node_modules/scule/README.md
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
# 🧵 Scule
|
||||
|
||||
[![npm version][npm-version-src]][npm-version-href]
|
||||
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
||||
[![bundle][bundle-src]][bundle-href]
|
||||
[![Codecov][codecov-src]][codecov-href]
|
||||
|
||||
<!--  -->
|
||||
|
||||
## Install
|
||||
|
||||
Install using npm or yarn:
|
||||
|
||||
```bash
|
||||
npm i scule
|
||||
```
|
||||
|
||||
Import:
|
||||
|
||||
```js
|
||||
// CommonJS
|
||||
const { pascalCase } = require("scule");
|
||||
|
||||
// ESM
|
||||
import { pascalCase } from "scule";
|
||||
```
|
||||
|
||||
**Notice:** You may need to transpile package for legacy environments.
|
||||
|
||||
## Utils
|
||||
|
||||
### `pascalCase(str, opts?: { normalize })`
|
||||
|
||||
Splits string and joins by PascalCase convention:
|
||||
|
||||
```ts
|
||||
pascalCase("foo-bar_baz");
|
||||
// FooBarBaz
|
||||
```
|
||||
|
||||
**Notice:** If an uppercase letter is followed by other uppercase letters (like `FooBAR`), they are preserved. You can use `{ normalize: true }` for strictly following pascalCase convention.
|
||||
|
||||
### `camelCase(str, opts?: { normalize })`
|
||||
|
||||
Splits string and joins by camelCase convention:
|
||||
|
||||
```ts
|
||||
camelCase("foo-bar_baz");
|
||||
// fooBarBaz
|
||||
```
|
||||
|
||||
### `kebabCase(str)`
|
||||
|
||||
Splits string and joins by kebab-case convention:
|
||||
|
||||
```ts
|
||||
kebabCase("fooBar_Baz");
|
||||
// foo-bar-baz
|
||||
```
|
||||
|
||||
**Notice:** It does **not** preserve case.
|
||||
|
||||
### `snakeCase`
|
||||
|
||||
Splits string and joins by snake_case convention:
|
||||
|
||||
```ts
|
||||
snakeCase("foo-barBaz");
|
||||
// foo_bar_baz
|
||||
```
|
||||
|
||||
### `flatCase`
|
||||
|
||||
Splits string and joins by flatcase convention:
|
||||
|
||||
```ts
|
||||
flatCase("foo-barBaz");
|
||||
// foobarbaz
|
||||
```
|
||||
|
||||
### `trainCase(str, opts?: { normalize })`
|
||||
|
||||
Split string and joins by Train-Case (a.k.a. HTTP-Header-Case) convention:
|
||||
|
||||
```ts
|
||||
trainCase("FooBARb");
|
||||
// Foo-Ba-Rb
|
||||
```
|
||||
|
||||
**Notice:** If an uppercase letter is followed by other uppercase letters (like `WWWAuthenticate`), they are preserved (=> `WWW-Authenticate`). You can use `{ normalize: true }` for strictly only having the first letter uppercased.
|
||||
|
||||
### `titleCase(str, opts?: { normalize })`
|
||||
|
||||
With Title Case all words are capitalized, except for minor words.
|
||||
A compact regex of common minor words (such as `a`, `for`, `to`) is used to automatically keep them lower case.
|
||||
|
||||
```ts
|
||||
titleCase("this-IS-aTitle");
|
||||
// This is a Title
|
||||
```
|
||||
|
||||
### `upperFirst(str)`
|
||||
|
||||
Converts first character to upper case:
|
||||
|
||||
```ts
|
||||
upperFirst("hello world!");
|
||||
// Hello world!
|
||||
```
|
||||
|
||||
### `lowerFirst(str)`
|
||||
|
||||
Converts first character to lower case:
|
||||
|
||||
```ts
|
||||
lowerFirst("Hello world!");
|
||||
// hello world!
|
||||
```
|
||||
|
||||
### `splitByCase(str, splitters?)`
|
||||
|
||||
- Splits string by the splitters provided (default: `['-', '_', '/', '.']`)
|
||||
- Splits when case changes from lower to upper or upper to lower
|
||||
- Ignores numbers for case changes
|
||||
- Case is preserved in returned value
|
||||
- Is an irreversible function since splitters are omitted
|
||||
|
||||
## Development
|
||||
|
||||
- Clone this repository
|
||||
- Install latest LTS version of [Node.js](https://nodejs.org/en/)
|
||||
- Enable [Corepack](https://github.com/nodejs/corepack) using corepack enable
|
||||
- Install dependencies using pnpm install
|
||||
- Run interactive tests using pnpm dev
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE)
|
||||
|
||||
<!-- Badges -->
|
||||
|
||||
[npm-version-src]: https://img.shields.io/npm/v/scule?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[npm-version-href]: https://npmjs.com/package/scule
|
||||
[npm-downloads-src]: https://img.shields.io/npm/dm/scule?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[npm-downloads-href]: https://npmjs.com/package/scule
|
||||
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/scule/main?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[codecov-href]: https://codecov.io/gh/unjs/scule
|
||||
[bundle-src]: https://img.shields.io/bundlephobia/minzip/scule?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[bundle-href]: https://bundlephobia.com/result?p=scule
|
||||
43
node_modules/scule/package.json
generated
vendored
Normal file
43
node_modules/scule/package.json
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "scule",
|
||||
"version": "1.3.0",
|
||||
"description": "String case utils",
|
||||
"repository": "unjs/scule",
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"require": "./dist/index.cjs",
|
||||
"import": "./dist/index.mjs"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "vitest dev --typecheck",
|
||||
"lint": "eslint --cache --ext .ts,.js,.mjs,.cjs . && prettier -c src test",
|
||||
"lint:fix": "eslint --cache --ext .ts,.js,.mjs,.cjs . --fix && prettier -c src test -w",
|
||||
"prepack": "pnpm run build",
|
||||
"release": "pnpm test && changelogen --release --push && npm publish",
|
||||
"test": "pnpm lint && vitest run --typecheck --coverage"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.3",
|
||||
"@vitest/coverage-v8": "^1.2.0",
|
||||
"changelogen": "^0.5.5",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-unjs": "^0.2.1",
|
||||
"prettier": "^3.2.2",
|
||||
"typescript": "^5.3.3",
|
||||
"unbuild": "^2.0.0",
|
||||
"vitest": "^1.2.0"
|
||||
},
|
||||
"packageManager": "pnpm@8.14.1"
|
||||
}
|
||||
Reference in New Issue
Block a user