Open cinderblock opened 5 years ago
map-obj already has the ability to handle Arrays.
Only nested arrays. Not a top-level array.
Doesn't map-obj already have a caching mechanism?
No
Your use-case is very obscure, but I'm willing to merge a good PR from anyone that includes tests.
map-obj already has the ability to handle Arrays.
Only nested arrays. Not a top-level array.
I'm not following what you're saying. It seems to support them to me:
const mapObj = require('map-obj');
console.log('mapped:', mapObj(['test']));
// mapped: [ 'test' ]
Also: https://github.com/sindresorhus/camelcase-keys/blob/master/test.js#L29-L35
Doesn't map-obj already have a caching mechanism?
No
Forgive my persistence, but it sure seems to https://github.com/sindresorhus/map-obj/blob/master/index.js#L17-L23 Am I missing something?
On that subject, any thoughts on https://github.com/sindresorhus/map-obj/pull/15
At top level, array members are turned into array elements.
At lower levels, array members are lost.
I realize this is bad practice. However, that this library mangles them and, in particular, inconsistently is I think problematic.
Proposed solution
map-obj
already has the ability to handle Arrays. Simply remove the extra function atmodule.exports
and exportcamelCaseConvert
directly.Side note
Doesn't
map-obj
already have a caching mechanism? It seems a little redundant to me to have a caching layer in this package. Maybe I'm missing something?