Skip to content

Commit

Permalink
Bundle dependencies in module to support Node.js
Browse files Browse the repository at this point in the history
  • Loading branch information
btxtiger committed Nov 27, 2023
1 parent 009a346 commit 573a6f6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,34 @@ ESM and CJS bundles are included, also backwards compatible with [email protected]
npm install --save change-case-all
```

### Via class
### Browser / ESM
```ts
import { Case } from 'change-case-all';

const camel = Case.camel('test string'); // testString
const upper = Case.upper('test string'); // TEST STRING
```

### Via functions
```ts
import { camelCase, upperCase, ... } from 'change-case-all';

import { camelCase, upperCase, ... } from 'change-case-all';
const camel = camelCase('test string'); // testString
const upper = upperCase('test string'); // TEST STRING
```

### Node.js
```ts
const { Case } = require('change-case-all');
const camel = Case.camel('foo-bar'); // fooBar
const snake = Case.snake('fooBar'); // foo_bar

const { camelCase, snakeCase } = require('change-case-all');
const camel = camelCase('foo-bar'); // fooBar
const snake = snakeCase('fooBar'); // foo_bar
```

## Changelog

### 2.1.0
- Bundle dependencies in module to support Node.js

### 2.0.0

- Updated dependencies to `[email protected]`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "change-case-all",
"version": "2.0.1",
"version": "2.1.0",
"description": "All change-case methods bundled in a single module",
"license": "MIT",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default defineConfig({
fileName: 'index',
},
rollupOptions: {
external: ['change-case', 'sponge-case', 'swap-case', 'title-case'],
// external: ['change-case', 'sponge-case', 'swap-case', 'title-case'],
output: {
globals: {
'change-case': 'changeCase',
Expand Down

0 comments on commit 573a6f6

Please sign in to comment.