Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

camelcase-keys

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

camelcase-keys - npm Package Compare versions

Comparing version 8.0.2 to 9.0.0

40

index.d.ts

@@ -1,2 +0,2 @@

import {CamelCase, PascalCase} from 'type-fest';
import type {CamelCase, PascalCase} from 'type-fest';

@@ -6,2 +6,4 @@ // eslint-disable-next-line @typescript-eslint/ban-types

type ObjectOptional = Record<string, unknown> | undefined;
/**

@@ -40,3 +42,3 @@ Return a default type if input type is nil.

export type CamelCaseKeys<
T extends Record<string, any> | readonly any[],
T extends ObjectOptional | readonly any[],
Deep extends boolean = false,

@@ -50,16 +52,13 @@ IsPascalCase extends boolean = false,

? {
[P in keyof T]: T[P] extends Record<string, any> | readonly any[]
// eslint-disable-next-line @typescript-eslint/ban-types
? {} extends CamelCaseKeys<T[P]>
? T[P]
: CamelCaseKeys<
T[P],
Deep,
IsPascalCase,
Exclude,
StopPaths
>
[P in keyof T]: T[P] extends Record<string, unknown> | readonly any[]
? CamelCaseKeys<
T[P],
Deep,
IsPascalCase,
Exclude,
StopPaths
>
: T[P];
}
: T extends Record<string, any>
: T extends Record<string, unknown>
// Handle objects.

@@ -75,6 +74,4 @@ ? {

? T[P]
// eslint-disable-next-line @typescript-eslint/ban-types
: {} extends CamelCaseKeys<T[P]>
? T[P]
: [Deep] extends [true]
: [Deep] extends [true]
? T[P] extends ObjectOptional | readonly any[]
? CamelCaseKeys<

@@ -88,3 +85,4 @@ T[P],

>
: T[P];
: T[P]
: T[P];
}

@@ -187,3 +185,3 @@ // Return anything else as-is.

```
import {parseArgs} from 'node:utils';
import {parseArgs} from 'node:util';
import camelcaseKeys from 'camelcase-keys';

@@ -199,3 +197,3 @@

export default function camelcaseKeys<
T extends Record<string, any> | readonly any[],
T extends Record<string, unknown> | readonly any[],
OptionsType extends Options = Options,

@@ -202,0 +200,0 @@ >(

@@ -25,3 +25,3 @@ import mapObject from 'map-obj';

const camelCaseConvert = (input, options) => {
const transform = (input, options = {}) => {
if (!isObject(input)) {

@@ -31,10 +31,9 @@ return input;

options = {
deep: false,
pascalCase: false,
...options,
};
const {
exclude,
pascalCase = false,
stopPaths,
deep = false,
} = options;
const {exclude, pascalCase, stopPaths, deep} = options;
const stopPathsSet = new Set(stopPaths);

@@ -75,6 +74,6 @@

if (Array.isArray(input)) {
return Object.keys(input).map(key => camelCaseConvert(input[key], options));
return Object.keys(input).map(key => transform(input[key], options));
}
return camelCaseConvert(input, options);
return transform(input, options);
}
{
"name": "camelcase-keys",
"version": "8.0.2",
"version": "9.0.0",
"description": "Convert object keys to camel case",

@@ -14,6 +14,8 @@ "license": "MIT",

"type": "module",
"exports": "./index.js",
"types": "./index.d.ts",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"engines": {
"node": ">=14.16"
"node": ">=16"
},

@@ -30,3 +32,2 @@ "scripts": {

"map",
"obj",
"object",

@@ -37,3 +38,2 @@ "key",

"values",
"val",
"iterate",

@@ -59,12 +59,12 @@ "camelcase",

"dependencies": {
"camelcase": "^7.0.0",
"map-obj": "^4.3.0",
"camelcase": "^8.0.0",
"map-obj": "5.0.0",
"quick-lru": "^6.1.1",
"type-fest": "^2.13.0"
"type-fest": "^4.2.0"
},
"devDependencies": {
"ava": "^4.3.0",
"ava": "^5.3.1",
"matcha": "^0.7.0",
"tsd": "^0.23.0",
"xo": "^0.49.0"
"tsd": "^0.28.1",
"xo": "^0.56.0"
},

@@ -71,0 +71,0 @@ "xo": {

@@ -36,3 +36,3 @@ # camelcase-keys

```js
import {parseArgs} from 'node:utils';
import {parseArgs} from 'node:util';
import camelcaseKeys from 'camelcase-keys';

@@ -117,12 +117,6 @@

## camelcase-keys for enterprise
Available as part of the Tidelift Subscription.
The maintainers of camelcase-keys and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-camelcase-keys?utm_source=npm-camelcase-keys&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
## Related
- [decamelize-keys](https://github.com/sindresorhus/decamelize-keys) - The inverse of this package
- [snakecase-keys](https://github.com/bendrucker/snakecase-keys)
- [kebabcase-keys](https://github.com/mattiloh/kebabcase-keys)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc