How to use snakeize - 2 common examples

To help you get started, we’ve selected a few snakeize examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BaelorSwift / web-app / backend / src / server / middleware / error.js View on Github external
export default function (error, req, res, next) {
	typeof next; // handles linting issue

	if (typeof error.code !== 'string') {
		console.warn(error, error.stack);
		error = log.CuvvaError.coerce(error);
		log.warn('traditional_error', [error]);
	}

	// eslint-disable-next-line no-magic-numbers
	res.status(errors[error.code] || 500);
	res.json(snakecaseKeys(error));
}

snakeize

recursively transform key strings from camel-case to underscore-style

MIT
Latest version published 10 years ago

Package Health Score

50 / 100
Full package analysis

Popular snakeize functions