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

snakecase-keys

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snakecase-keys - npm Package Compare versions

Comparing version 6.0.0 to 7.0.0

10

index.d.ts

@@ -50,10 +50,10 @@ import { SnakeCase } from "type-fest";

export type SnakeCaseKeys<
T extends ObjectUnion | readonly any[],
T extends ObjectUnion | ReadonlyArray<Record<string, unknown>>,
Deep extends boolean = true,
Exclude extends readonly unknown[] = EmptyTuple,
Path extends string = ""
> = T extends readonly any[]
> = T extends ReadonlyArray<Record<string, unknown>>
? // Handle arrays or tuples.
{
[P in keyof T]: T[P] extends Record<string, unknown> | readonly any[]
[P in keyof T]: T[P] extends Record<string, unknown> | ReadonlyArray<Record<string, unknown>>
? SnakeCaseKeys<T[P], Deep, Exclude>

@@ -68,3 +68,3 @@ : T[P];

: SnakeCase<P>]: [Deep] extends [true]
? T[P] extends ObjectUnion | readonly any[]
? T[P] extends ObjectUnion | ReadonlyArray<Record<string, unknown>>
? SnakeCaseKeys<T[P], Deep, Exclude, AppendPath<Path, P & string>>

@@ -111,3 +111,3 @@ : T[P]

declare function snakecaseKeys<
T extends Record<string, unknown> | readonly any[],
T extends Record<string, unknown> | ReadonlyArray<Record<string, unknown>>,
Options extends snakecaseKeys.Options

@@ -114,0 +114,0 @@ >(

@@ -7,2 +7,5 @@ 'use strict'

module.exports = function (obj, options) {
if (Array.isArray(obj) && obj.some(item => item.constructor !== Object)) { throw new Error('obj must be array of plain objects') }
if (obj.constructor !== Object) throw new Error('obj must be an plain object')
options = Object.assign({ deep: true, exclude: [], parsingOptions: {} }, options)

@@ -9,0 +12,0 @@

{
"name": "snakecase-keys",
"main": "index.js",
"version": "6.0.0",
"version": "7.0.0",
"description": "Convert an object's keys to snake case",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -32,5 +32,5 @@ # snakecase-keys [![tests](https://github.com/bendrucker/snakecase-keys/workflows/tests/badge.svg)](https://github.com/bendrucker/snakecase-keys/actions?query=workflow%3Atests)

*Required*
Type: `object`
Type: `object | array[object]`
An object to transform into snake case (keys only).
A plain object or array of plain objects to transform into snake case (keys only).

@@ -37,0 +37,0 @@ ##### options

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