snakecase-keys
Advanced tools
Comparing version 5.5.0 to 6.0.0
@@ -89,2 +89,9 @@ import { SnakeCase } from "type-fest"; | ||
/** | ||
A function that determines whether to recurse for a specific key and value. | ||
*/ | ||
readonly shouldRecurse?: { | ||
(key: any, value: any): boolean; | ||
} | ||
/** | ||
Options object that gets passed to snake-case parsing function. | ||
@@ -91,0 +98,0 @@ @default {} |
@@ -12,3 +12,4 @@ 'use strict' | ||
matches(options.exclude, key) ? key : snakeCase(key, options.parsingOptions), | ||
val | ||
val, | ||
mapperOptions(key, val, options) | ||
] | ||
@@ -25,1 +26,7 @@ }, options) | ||
} | ||
function mapperOptions (key, val, options) { | ||
return options.shouldRecurse | ||
? { shouldRecurse: options.shouldRecurse(key, val) } | ||
: undefined | ||
} |
{ | ||
"name": "snakecase-keys", | ||
"main": "index.js", | ||
"version": "5.5.0", | ||
"version": "6.0.0", | ||
"description": "Convert an object's keys to snake case", | ||
@@ -26,3 +26,3 @@ "license": "MIT", | ||
"tape": "^5.0.1", | ||
"tsd": "^0.27.0" | ||
"tsd": "^0.30.0" | ||
}, | ||
@@ -39,4 +39,4 @@ "files": [ | ||
"engines": { | ||
"node": ">=12" | ||
"node": ">=18" | ||
} | ||
} |
@@ -55,2 +55,11 @@ # snakecase-keys [![tests](https://github.com/bendrucker/snakecase-keys/workflows/tests/badge.svg)](https://github.com/bendrucker/snakecase-keys/actions?query=workflow%3Atests) | ||
###### `shouldRecurse(key, val)` -> `boolean` | ||
*Optional* | ||
Type: `function` | ||
A function that determines if `val` should be recursed. | ||
Requires `deep: true`. | ||
## Related | ||
@@ -57,0 +66,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7227
133
72