Gathering detailed insights and metrics for lodash-humps
Gathering detailed insights and metrics for lodash-humps
Gathering detailed insights and metrics for lodash-humps
Gathering detailed insights and metrics for lodash-humps
npm install lodash-humps
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
37 Stars
39 Commits
4 Forks
2 Watchers
7 Branches
2 Contributors
Updated on Feb 06, 2024
Latest Version
3.1.6
Package Id
lodash-humps@3.1.6
Unpacked Size
104.92 kB
Size
27.33 kB
File Count
9
NPM Version
7.3.0
Node Version
15.5.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Converting object keys to camelCase. Works on deeply nested objects/arrays. Handy for converting underscore keys to camelCase. Using lodash keeps the code small and light at around 10 lines.
1$ npm i --save lodash-humps
Remove any hyphens, underscores, whitespace characters, and uppercases the first character that follows. Returns a new object. See _.camelCase()
https://lodash.com/docs#camelCase and https://en.wikipedia.org/wiki/CamelCase.
1import humps from 'lodash-humps' 2 3const object = { attr_one: 'foo', attr_two: 'bar', attr_three: { attr_one: 'foo' } } 4humps(object) // { attrOne: 'foo', attrTwo: 'bar', attrThree: { attrOne: 'foo' } }
Arrays of objects are also converted:
1const array = [{ attr_one: 'foo' }, { attr_one: 'bar' }] 2humps(array) // [{ attrOne: 'foo' }, { attrOne: 'bar' }]
What if you want to convert it back?!? See test/createHumps.spec.js for an example. Open an issue if you want a proper export.
1import createHumps from 'humps/lib/createHumps' 2import { snakeCase } from 'lodash' 3 4const snakes = createHumps(snakeCase) 5const object = { attrOne: 'foo', attrTwo: 'bar', attrThree: { attrOne: 'foo' } } 6snakes(object) // { attr_one: 'foo', attr_two: 'bar', attr_three: { attr_one: 'foo' } }
NOTE: Version 3.x will only work with objects created by the Object constructor. You may need to do something like const result = humps({ ...SomeOtherClass })
to get humps to process your stuff. Function properties are now kept and not converted to {}
. Some might say this is a bug and others might call it a feature. Full version bump so you can have your pick.
Internally switched from using _.isObject
to _.isPlainObject
before converting the keys and children objects.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
17 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More