chore: replaced lodash function packages #303#309
Conversation
|
Thanks for the PR but I don't think we should take this approach, this essentially just reverts the work that was done in #291 which reduced the bundle size significantly. |
|
Would love to get this issue fixed, as we use this lib at work and the vulnerabilities found in our security audit pipeline are bugging our team ( we use snyk.io for vuln scanning ). Moving forward the options I can think of ( in no particular order )
I'm happy to contribute or if @Staxie wants to do it I'm happy to contribute somehow |
|
Another point regarding bundle size - I'd assume most people are using this lib with nodejs, does bundle size really matter in that case? For frontend, surely most devs would have tree shaking enabled? Perhaps I'm mistaken... |
|
@mrslwiseman I think it should be relatively straightforward to remove the usage of simple cases like queryBody.query = queryBody.query || {}
queryBody.query.bool = queryBody.query.bool || {}
queryBody.query.bool.must = querieswhich does exactly the same as lodash.set in our cases. It only appears in Alternatively, write a 3-line custom function set(obj, path, value) {
const keys = Array.isArray(path) ? path : path.split('.'); // convert path to array if it's a string
const lastKeyIndex = keys.length - 1;
for (let i = 0; i < lastKeyIndex; i++) {
const key = keys[i];
if (!(key in obj)) {
obj[key] = {};
}
obj = obj[key];
}
obj[keys[lastKeyIndex]] = value;
} |
No description provided.