Comments (7)
this seem to be inherited in other places in the lib as well. Continuing the above example:
_.pickDeep(z, 'd')
// => { a: { d: [] } } ❌
// expected result similar to lodash pick
_.pick(z, 'a.d')
// => { a: { d: [ 'kk', 'jj' ] } } ✅
from deepdash.
I was about to create an issue. I noticed that it does not work for Array as well
from deepdash.
Hi all, this is as expected by default config:
omit keeps parent if some children are not omitted.
To omit from the top as you expect try adding
_.omitDeep(z, 'b',{onMatch:{skipChildren:true}})
You can check docs:
https://deepdash.io/#omitdeep
As you see in example - "bad2" is also not omitted, because there is "good" inside.
Any further feedback is welcome in this issue even after closing,
if there will be enough votes about such defaults are confusing - I will consider to change defaults on next major version.
from deepdash.
yes, I think the defaults are confusing... what I wrote as an issue is exactly what anyone would expect without reading and understanding anything. Then for those esoteric uses, one would adjust options. I already know how _.omit works, so when I searched and found this lib, the assumption is that it should just behave like _.omit out of the box (since it's ...dash as in lodash). The defaults are more opinionated I think.
from deepdash.
I will try to use the config as indicated in the meantime, as I trust you will do the right thing 😅 in the next version.
from deepdash.
oh my, it's working without the options added, wanted to have a false test first... did you already apply and publish the change? I recently installed it.
from deepdash.
Hi, no changes yet.
I updated playground referenced by docs to illustrate skip children option I suggested above, so you can see before/after:
https://codepen.io/yurigor/pen/zQOMNj?editors=0010
You see in second case bad2/good was also omitted because of this option, but in first case it's still there.
from deepdash.
Related Issues (20)
- omitDeep changes input on empty array HOT 1
- ERR_PACKAGE_PATH_NOT_EXPORTED HOT 3
- how to remove values from json if they exist
- Feature Request Parent path
- filterDeep not working on deeply nested object HOT 2
- Working with promises HOT 2
- Frustrating that things like `pickDeep` and `filterDeep` can only return a nested structure HOT 3
- deepdash-es not working with jest-resolve HOT 9
- deepFilter keep parents
- ESM: IIterateeContext typescript interface not exposed
- findPathDeep doesn't return first Value path
- findDeep or findDeepValue - Return object that contains the key & value
- eachDeep with childrenPath == wrong parent, parent path etc
- Bug in documentation _.findDeep*
- findDeep return types problem HOT 3
- Add contributing docs HOT 1
- findDeep is not a function HOT 1
- explicit return values, why and how does this work HOT 1
- mapValuesDeep mutates the original object if `leavesOnly: false` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepdash.