change-case-all
Advanced tools
Comparing version 1.0.15 to 2.0.0
@@ -1,32 +0,57 @@ | ||
import * as changeCase from 'change-case'; | ||
import * as lowerCase1 from 'lower-case'; | ||
import * as lowerCaseFirst1 from 'lower-case-first'; | ||
import * as changeCase1 from 'change-case'; | ||
import * as spongeCase1 from 'sponge-case'; | ||
import * as swapCase1 from 'swap-case'; | ||
import * as titleCase1 from 'title-case'; | ||
import * as upperCase1 from 'upper-case'; | ||
import * as upperCaseFirst1 from 'upper-case-first'; | ||
import * as isUpperCase1 from 'is-upper-case'; | ||
import * as isLowerCase1 from 'is-lower-case'; | ||
export declare const camelCase: typeof changeCase.camelCase; | ||
export declare const capitalCase: typeof changeCase.capitalCase; | ||
export declare const constantCase: typeof changeCase.constantCase; | ||
export declare const dotCase: typeof changeCase.dotCase; | ||
export declare const headerCase: typeof changeCase.headerCase; | ||
export declare const noCase: typeof changeCase.noCase; | ||
export declare const paramCase: typeof changeCase.paramCase; | ||
export declare const pascalCase: typeof changeCase.pascalCase; | ||
export declare const pathCase: typeof changeCase.pathCase; | ||
export declare const sentenceCase: typeof changeCase.sentenceCase; | ||
export declare const snakeCase: typeof changeCase.snakeCase; | ||
export declare const lowerCase: typeof lowerCase1.lowerCase; | ||
export declare const localeLowerCase: typeof lowerCase1.localeLowerCase; | ||
export declare const lowerCaseFirst: typeof lowerCaseFirst1.lowerCaseFirst; | ||
export declare const camelCase: typeof changeCase1.camelCase; | ||
export declare const capitalCase: typeof changeCase1.capitalCase; | ||
export declare const constantCase: typeof changeCase1.constantCase; | ||
export declare const dotCase: typeof changeCase1.dotCase; | ||
export declare const noCase: typeof changeCase1.noCase; | ||
export declare const pascalCase: typeof changeCase1.pascalCase; | ||
export declare const pathCase: typeof changeCase1.pathCase; | ||
export declare const sentenceCase: typeof changeCase1.sentenceCase; | ||
export declare const snakeCase: typeof changeCase1.snakeCase; | ||
/** @deprecated Use trainCase instead */ | ||
export declare const headerCase: typeof changeCase1.trainCase; | ||
export declare const trainCase: typeof changeCase1.trainCase; | ||
/** @deprecated Use kebabCase instead */ | ||
export declare const paramCase: typeof changeCase1.kebabCase; | ||
export declare const kebabCase: typeof changeCase1.kebabCase; | ||
export declare const spongeCase: typeof spongeCase1.spongeCase; | ||
export declare const swapCase: typeof swapCase1.swapCase; | ||
export declare const titleCase: typeof titleCase1.titleCase; | ||
export declare const upperCase: typeof upperCase1.upperCase; | ||
export declare const localeUpperCase: typeof upperCase1.localeUpperCase; | ||
export declare const upperCaseFirst: typeof upperCaseFirst1.upperCaseFirst; | ||
export declare const isUpperCase: typeof isUpperCase1.isUpperCase; | ||
export declare const isLowerCase: typeof isLowerCase1.isLowerCase; | ||
export declare const upperCase: (str: string) => string; | ||
export declare const localeUpperCase: (str: string, locales?: string | string[]) => string; | ||
export declare const lowerCase: (str: string) => string; | ||
export declare const localeLowerCase: (str: string, locales?: string | string[]) => string; | ||
export declare const lowerCaseFirst: (str: string) => string; | ||
export declare const upperCaseFirst: (str: string) => string; | ||
export declare const isUpperCase: (str: string) => boolean; | ||
export declare const isLowerCase: (str: string) => boolean; | ||
/** | ||
* Class with static methods for string manipulation. | ||
*/ | ||
export declare class Case { | ||
static camel: typeof changeCase1.camelCase; | ||
static capital: typeof changeCase1.capitalCase; | ||
static constant: typeof changeCase1.constantCase; | ||
static dot: typeof changeCase1.dotCase; | ||
static kebab: typeof changeCase1.kebabCase; | ||
static lower: (str: string) => string; | ||
static lowerFirst: (str: string) => string; | ||
static localeLower: (str: string, locales?: string | string[]) => string; | ||
static localeUpper: (str: string, locales?: string | string[]) => string; | ||
static no: typeof changeCase1.noCase; | ||
static pascal: typeof changeCase1.pascalCase; | ||
static path: typeof changeCase1.pathCase; | ||
static sentence: typeof changeCase1.sentenceCase; | ||
static snake: typeof changeCase1.snakeCase; | ||
static sponge: typeof spongeCase1.spongeCase; | ||
static swap: typeof swapCase1.swapCase; | ||
static title: typeof titleCase1.titleCase; | ||
static train: typeof changeCase1.trainCase; | ||
static upper: (str: string) => string; | ||
static upperFirst: (str: string) => string; | ||
static isUpper: (str: string) => boolean; | ||
static isLower: (str: string) => boolean; | ||
} |
@@ -1,37 +0,80 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isLowerCase = exports.isUpperCase = exports.upperCaseFirst = exports.localeUpperCase = exports.upperCase = exports.titleCase = exports.swapCase = exports.spongeCase = exports.lowerCaseFirst = exports.localeLowerCase = exports.lowerCase = exports.snakeCase = exports.sentenceCase = exports.pathCase = exports.pascalCase = exports.paramCase = exports.noCase = exports.headerCase = exports.dotCase = exports.constantCase = exports.capitalCase = exports.camelCase = void 0; | ||
var changeCase = require("change-case"); | ||
var lowerCase1 = require("lower-case"); | ||
var lowerCaseFirst1 = require("lower-case-first"); | ||
var spongeCase1 = require("sponge-case"); | ||
var swapCase1 = require("swap-case"); | ||
var titleCase1 = require("title-case"); | ||
var upperCase1 = require("upper-case"); | ||
var upperCaseFirst1 = require("upper-case-first"); | ||
var isUpperCase1 = require("is-upper-case"); | ||
var isLowerCase1 = require("is-lower-case"); | ||
// Core | ||
exports.camelCase = changeCase.camelCase; | ||
exports.capitalCase = changeCase.capitalCase; | ||
exports.constantCase = changeCase.constantCase; | ||
exports.dotCase = changeCase.dotCase; | ||
exports.headerCase = changeCase.headerCase; | ||
exports.noCase = changeCase.noCase; | ||
exports.paramCase = changeCase.paramCase; | ||
exports.pascalCase = changeCase.pascalCase; | ||
exports.pathCase = changeCase.pathCase; | ||
exports.sentenceCase = changeCase.sentenceCase; | ||
exports.snakeCase = changeCase.snakeCase; | ||
// Extended | ||
exports.lowerCase = lowerCase1.lowerCase; | ||
exports.localeLowerCase = lowerCase1.localeLowerCase; | ||
exports.lowerCaseFirst = lowerCaseFirst1.lowerCaseFirst; | ||
exports.spongeCase = spongeCase1.spongeCase; | ||
exports.swapCase = swapCase1.swapCase; | ||
exports.titleCase = titleCase1.titleCase; | ||
exports.upperCase = upperCase1.upperCase; | ||
exports.localeUpperCase = upperCase1.localeUpperCase; | ||
exports.upperCaseFirst = upperCaseFirst1.upperCaseFirst; | ||
exports.isUpperCase = isUpperCase1.isUpperCase; | ||
exports.isLowerCase = isLowerCase1.isLowerCase; | ||
import * as changeCase1 from "change-case"; | ||
import * as spongeCase1 from "sponge-case"; | ||
import * as swapCase1 from "swap-case"; | ||
import * as titleCase1 from "title-case"; | ||
const camelCase = changeCase1.camelCase; | ||
const capitalCase = changeCase1.capitalCase; | ||
const constantCase = changeCase1.constantCase; | ||
const dotCase = changeCase1.dotCase; | ||
const noCase = changeCase1.noCase; | ||
const pascalCase = changeCase1.pascalCase; | ||
const pathCase = changeCase1.pathCase; | ||
const sentenceCase = changeCase1.sentenceCase; | ||
const snakeCase = changeCase1.snakeCase; | ||
const headerCase = changeCase1.trainCase; | ||
const trainCase = changeCase1.trainCase; | ||
const paramCase = changeCase1.kebabCase; | ||
const kebabCase = changeCase1.kebabCase; | ||
const spongeCase = spongeCase1.spongeCase; | ||
const swapCase = swapCase1.swapCase; | ||
const titleCase = titleCase1.titleCase; | ||
const upperCase = (str) => str.toUpperCase(); | ||
const localeUpperCase = (str, locales) => str.toLocaleUpperCase(locales); | ||
const lowerCase = (str) => str.toLowerCase(); | ||
const localeLowerCase = (str, locales) => str.toLocaleLowerCase(locales); | ||
const lowerCaseFirst = (str) => str.charAt(0).toLowerCase() + str.slice(1); | ||
const upperCaseFirst = (str) => str.charAt(0).toUpperCase() + str.slice(1); | ||
const isUpperCase = (str) => str === str.toUpperCase(); | ||
const isLowerCase = (str) => str === str.toLowerCase(); | ||
const _Case = class _Case { | ||
}; | ||
_Case.camel = camelCase; | ||
_Case.capital = capitalCase; | ||
_Case.constant = constantCase; | ||
_Case.dot = dotCase; | ||
_Case.kebab = kebabCase; | ||
_Case.lower = lowerCase; | ||
_Case.lowerFirst = lowerCaseFirst; | ||
_Case.localeLower = localeLowerCase; | ||
_Case.localeUpper = localeUpperCase; | ||
_Case.no = noCase; | ||
_Case.pascal = pascalCase; | ||
_Case.path = pathCase; | ||
_Case.sentence = sentenceCase; | ||
_Case.snake = snakeCase; | ||
_Case.sponge = spongeCase; | ||
_Case.swap = swapCase; | ||
_Case.title = titleCase; | ||
_Case.train = trainCase; | ||
_Case.upper = upperCase; | ||
_Case.upperFirst = upperCaseFirst; | ||
_Case.isUpper = isUpperCase; | ||
_Case.isLower = isLowerCase; | ||
let Case = _Case; | ||
export { | ||
Case, | ||
camelCase, | ||
capitalCase, | ||
constantCase, | ||
dotCase, | ||
headerCase, | ||
isLowerCase, | ||
isUpperCase, | ||
kebabCase, | ||
localeLowerCase, | ||
localeUpperCase, | ||
lowerCase, | ||
lowerCaseFirst, | ||
noCase, | ||
paramCase, | ||
pascalCase, | ||
pathCase, | ||
sentenceCase, | ||
snakeCase, | ||
spongeCase, | ||
swapCase, | ||
titleCase, | ||
trainCase, | ||
upperCase, | ||
upperCaseFirst | ||
}; |
{ | ||
"name": "change-case-all", | ||
"version": "1.0.15", | ||
"version": "2.0.0", | ||
"description": "All change-case methods bundled in a single module", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"main": "./dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"type": "module", | ||
"module": "./dist/index.js", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.umd.cjs" | ||
} | ||
}, | ||
"author": { | ||
@@ -17,6 +25,5 @@ "name": "Jonas Gnioui", | ||
"scripts": { | ||
"tsc": "tsc", | ||
"compile": "npm run tsc", | ||
"test": "ts-node node_modules/jasmine/bin/jasmine --config=jasmine.json --color", | ||
"coverage": "nyc -r text -e .ts -x \"tests/*.test.ts\" npm run test" | ||
"build": "vite build", | ||
"test": "vitest run", | ||
"publish": "npm run build && npm run test && npm publish" | ||
}, | ||
@@ -38,23 +45,14 @@ "files": [ | ||
"dependencies": { | ||
"change-case": "^4.1.2", | ||
"is-lower-case": "^2.0.2", | ||
"is-upper-case": "^2.0.2", | ||
"lower-case": "^2.0.2", | ||
"lower-case-first": "^2.0.2", | ||
"sponge-case": "^1.0.1", | ||
"swap-case": "^2.0.2", | ||
"title-case": "^3.0.3", | ||
"upper-case": "^2.0.2", | ||
"upper-case-first": "^2.0.2" | ||
"change-case": "^5.2.0", | ||
"sponge-case": "^2.0.2", | ||
"swap-case": "^3.0.2", | ||
"title-case": "^3.0.3" | ||
}, | ||
"devDependencies": { | ||
"@types/jasmine": "^3.10.2", | ||
"jasmine": "^3.10.0", | ||
"jasmine-spec-reporter": "^7.0.0", | ||
"npm": "^8.0.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.4.1", | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.4.4" | ||
"prettier": "^3.1.0", | ||
"typescript": "^5.3.2", | ||
"vite": "^5.0.2", | ||
"vite-plugin-dts": "^3.6.3", | ||
"vitest": "^0.34.6" | ||
} | ||
} |
106
README.md
# change-case-all | ||
![CI](https://github.com/btxtiger/change-case-all/actions/workflows/ci.yml/badge.svg) | ||
[![npm](https://img.shields.io/npm/v/change-case-all.svg)](https://www.npmjs.com/package/change-case-all) | ||
@@ -13,8 +14,25 @@ [![npm](https://img.shields.io/npm/dm/change-case-all.svg)](https://www.npmjs.com/package/change-case-all) | ||
``` | ||
```ts | ||
import { Case } from 'change-case-all'; | ||
const camel = Case.camel('test string'); // testString | ||
const upper = Case.upper('test string'); // TEST STRING | ||
``` | ||
```ts | ||
import { camelCase, upperCase, ... } from 'change-case-all'; | ||
const camel = camelCase('test string'); // testString | ||
const upper = upperCase('test string'); // TEST STRING | ||
``` | ||
## Documentation | ||
https://github.com/blakeembrey/change-case | ||
## Changelog | ||
### 2.0.0 | ||
- Updated dependencies to `change-case@5.2.0` | ||
- ParamCase → now KebabCase | ||
- HeaderCase → now TrainCase | ||
- Create mjs and cjs bundles | ||
- Introduce `Case` helper class: e.g. `Case.camel('test string'); // testString` | ||
- `TitleCase@4.1.0` failing in tests, thus kept at `3.0.3` | ||
@@ -26,26 +44,62 @@ ## Links | ||
## Methods | ||
**Core** | ||
- camelCase | ||
- capitalCase | ||
- constantCase | ||
- dotCase | ||
- headerCase | ||
- noCase | ||
- paramCase | ||
- pascalCase | ||
- pathCase | ||
- sentenceCase | ||
- snakeCase | ||
### Class based usage | ||
```ts | ||
import { Case } from 'change-case-all'; | ||
**Extended** | ||
- lowerCase | ||
- localeLowerCase | ||
- lowerCaseFirst | ||
- spongeCase | ||
- swapCase | ||
- titleCase | ||
- upperCase | ||
- localeUpperCase | ||
- upperCaseFirst | ||
- isUpperCase | ||
- isLowerCase | ||
const str = 'test string'; | ||
camel = Case.camel(str); // testString | ||
capital = Case.capital(str); // Test String | ||
constant = Case.constant(str); // TEST_STRING | ||
dot = Case.dot(str); // test.string | ||
no = Case.no(str); // test string | ||
pascal = Case.pascal(str); // TestString | ||
path = Case.path(str); // test/string | ||
sentence = Case.sentence(str); // Test string | ||
snake = Case.snake(str); // test_string | ||
train = Case.train(str); // Test-String | ||
kebap = Case.kebap(str); // test-string | ||
sponge = Case.sponge(str); // TeSt StRiNg | ||
swapCase = Case.swap(str); // TEST STRING | ||
title = Case.title(str); // Test String | ||
uppper = Case.upper(str); // TEST STRING | ||
localeUpper = Case.localeUpper(str, 'en'); // TEST STRING | ||
lower = Case.lower(str); // test string | ||
localeLower = Case.localeLower(str, 'en'); // test string | ||
lowerFirst = Case.lowerFirst(str); // test string | ||
upperFirst = Case.upperFirst(str); // Test string | ||
isUpper = Case.isUpper(str); // false | ||
isLower = Case.isLower(str); // true | ||
``` | ||
### Function based usage | ||
```ts | ||
import { camelCase, upperCase, ... } from 'change-case-all'; | ||
const str = 'test string'; | ||
camel = camelCase(str); // testString | ||
capital = capitalCase(str); // Test String | ||
constant = constantCase(str); // TEST_STRING | ||
dot = dotCase(str); // test.string | ||
no = noCase(str); // test string | ||
pascal = pascalCase(str); // TestString | ||
path = pathCase(str); // test/string | ||
sentence = sentenceCase(str); // Test string | ||
snake = snakeCase(str); // test_string | ||
train = trainCase(str); // Test-String | ||
kebap = kebapCase(str); // test-string | ||
sponge = spongeCase(str); // TeSt StRiNg | ||
swapCase = swapCase(str); // TEST STRING | ||
title = titleCase(str); // Test String | ||
uppper = upperCase(str); // TEST STRING | ||
localeUpper = localeUpperCase(str, 'en'); // TEST STRING | ||
lower = lowerCase(str); // test string | ||
localeLower = localeLowerCase(str, 'en'); // test string | ||
lowerFirst = lowerCaseFirst(str); // test string | ||
upperFirst = upperCaseFirst(str); // Test string | ||
isUpper = isUpperCase(str); // false | ||
isLower = isLowerCase(str); // true | ||
``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
16639
4
5
6
238
104
Yes
1
+ Addedchange-case@5.4.4(transitive)
+ Addedsponge-case@2.0.3(transitive)
+ Addedswap-case@3.0.3(transitive)
- Removedis-lower-case@^2.0.2
- Removedis-upper-case@^2.0.2
- Removedlower-case@^2.0.2
- Removedlower-case-first@^2.0.2
- Removedupper-case@^2.0.2
- Removedupper-case-first@^2.0.2
- Removedcamel-case@4.1.2(transitive)
- Removedcapital-case@1.0.4(transitive)
- Removedchange-case@4.1.2(transitive)
- Removedconstant-case@3.0.4(transitive)
- Removeddot-case@3.0.4(transitive)
- Removedheader-case@2.0.4(transitive)
- Removedis-lower-case@2.0.2(transitive)
- Removedis-upper-case@2.0.2(transitive)
- Removedlower-case@2.0.2(transitive)
- Removedlower-case-first@2.0.2(transitive)
- Removedno-case@3.0.4(transitive)
- Removedparam-case@3.0.4(transitive)
- Removedpascal-case@3.1.2(transitive)
- Removedpath-case@3.0.4(transitive)
- Removedsentence-case@3.0.4(transitive)
- Removedsnake-case@3.0.4(transitive)
- Removedsponge-case@1.0.1(transitive)
- Removedswap-case@2.0.2(transitive)
- Removedupper-case@2.0.2(transitive)
- Removedupper-case-first@2.0.2(transitive)
Updatedchange-case@^5.2.0
Updatedsponge-case@^2.0.2
Updatedswap-case@^3.0.2