npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

connect-recase

v1.0.2

Published

convert your external api to snake_case (ruby style) for easier machine consumption, and back to camelCase for conventional JavaScript

Readme

connect-recase

Convert your API back and forth between snake_case and camelCase.

{ "popularCatchphrase": "it's morphin' time!" } => { "popular_catchphrase": "it's morphin' time!" }

If your API is designed to be consumed by Ruby, Python, Go, or other modern web frameworks, it will be easier for consumers if you serve them snake_case_properties, y'know.

It's no secret that machines can parse snake_case easier than camelCase. And guess what: so can humans! It's easier to read. It's easier to regex. It's empirically better.

But we live in the JavaScript world and the convention is so strongly camelCase that there's no use in fighting it.

Normal Use

npm install --save connect-recase
var recase = require('connect-recase')
app.use('/api', recase());

Example

// some resource
app.use('/api/some-resource', function (req, res) {
  console.log(req.body);
  res.send({ popularCatchphrase: "it's morphin' time!" });
});

If you test getting the resource, it will come in snake_case:

curl https://local.daplie.com/api/some-resource

{ "popular_catchphrase": "it's morphin' time!" }

If you test posting some data, it will come in snake_case:

curl https://local.daplie.com/api/some-resource \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{ "user_data": { "display_name": "Johnny Lingo", "profile_url": "https://aj.daplie.com" } }'
  
# you'll see this in your console.log
{ "userData": { "displayName": "Johnny Lingo", "profileUrl": "https://aj.daplie.com" } }

Getting Fancy

var recase = require('connect-recase');
app.use(recase({
  prefixes: ['/api']
, cancelParam: 'camel'
, exceptions: { Poorly_NamedProp: 'better_named_property' }
}));

API

  • prefixes
  • cancelParam
  • exceptions

prefixes

only recase on endpoints that begin with these prefixes

Remember to put external APIs hooks such as for stripe, mailgun, twilio, facebook, etc on a different route or include the cancelParam in your hook (unless you're not using a 3rd party lib to handle the hook).

defaults to []

cancelParam

The query parameter than causes recase to be skipped

https://example.com/api/some-resource?camel=true

Useful if a developer wants to use camelCase and for incoming API hooks

defaults to camel

exceptions

gets passed to recase as properties that should explicitly mapped

recase defaults this to { XMLHttpRequest: 'xml_http_request' }

TODO

  • exceptions to prefixes
  • separate incoming and outgoing