Gathering detailed insights and metrics for lodash-humps-ts
Gathering detailed insights and metrics for lodash-humps-ts
Gathering detailed insights and metrics for lodash-humps-ts
Gathering detailed insights and metrics for lodash-humps-ts
npm install lodash-humps-ts
Typescript
Module System
Node Version
NPM Version
68.1
Supply Chain
79.9
Quality
75.1
Maintenance
100
Vulnerability
99.6
License
TypeScript (94.68%)
JavaScript (5.32%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
ISC License
2 Stars
38 Commits
1 Branches
1 Contributors
Updated on Jun 22, 2022
Latest Version
0.0.6
Package Id
lodash-humps-ts@0.0.6
Unpacked Size
8.60 kB
Size
3.86 kB
File Count
13
NPM Version
6.10.3
Node Version
12.13.1
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-ts
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-ts' 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.ts for an example. Open an issue if you want a proper export.
1import { createHumps } from 'lodash-humps-ts' 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
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
23 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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