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

@alice-health/ky-hooks-change-case

Package Overview
Dependencies
Maintainers
5
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alice-health/ky-hooks-change-case

Allow modifications cases on requests and responses of the objects during the ky request

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
409
decreased by-22.68%
Maintainers
5
Weekly downloads
 
Created
Source

Coverage Status

ky hooks change case

Allow modifications cases on requests and responses of the objects during the ky request

Install

NPM
$ npm install @alice-health/ky-hooks-change-case
CDN

unpkg

Usage

import ky from "ky";
import {
  requestToSnakeCase,
  responseToCamelCase,
} from "@alice-health/ky-hooks-change-case";

ky.post(`${server.url}/path`, {
  json: { fooBar: true },
  hooks: {
    beforeRequest: [requestToSnakeCase],
    afterResponse: [responseToCamelCase],
  },
});

In the example above, the requestToSnakeCase method will convert the resquest body from {fooBar: true} to {foo_bar: true} and the response from {response_body: false} to {responseBody: false}. This way, the frontend and the backend API can each define their independent style guide.

API

Before request hooks

requestToSnakeCase

Convert the request body keys objects to snake_case.

requestToCamelCase

Convert the request body keys objects to camelCase.

requestToKebabCase

Convert the request body keys objects to kebab-case.

After response hooks

responseToSnakeCase

Convert the response body keys objects to snake_case.

responseToCamelCase

Convert the response body keys objects to camelCase.

responseToKebabCase

Convert the response body keys objects to kebab-case.

Browser support

The latest version of Chrome, Firefox, and Safari.

ky 🌳 Tiny & elegant HTTP client based on window.fetch

FAQs

Package last updated on 07 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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