Add support for nested attribute properties
See original GitHub issueThe goal for this enhancement is to provide the ability to ‘flatten’ properties from the input into primitive attributes. For example:
data = {
lat: 12.34,
lng: 56.78,
info: {
name: 'Johnny Goode',
age: 12
}
}
GeoJSON.parse(data, {Point: ['lat', 'lng'], include: ['name']});
There is currently no way to get the ‘name’ property as an attribute of the resulting GeoJSON object.
In an attempt to avoid breaking existing logic, I think this may be a good solution:
function getPropFunction(params) {
...
else if (params.extract) {
func = function(properties) {
...
}
} else if (params.include) {
...
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
ActiveRecord::NestedAttributes::ClassMethods - Rails API
Active Record Nested Attributes Nested attributes allow you to save attributes on associated records through the parent.
Read more >Nested Custom Attributes
You can use nested custom attributes to send objects as a new data type for custom attributes. This nested data allows you to...
Read more >Creating and using nested attributes - Algolia
Nested attributes are a way of applying sub-categories to your attributes. For instance, instead of having a single searchable attribute price ...
Read more >Ruby on Rails Nested Attributes - Pluralsight
To add Nested Attributes support to the product model all you need to do is add the following line: 1class Product < ActiveRecord::Base...
Read more >Support for nested attributes and post meta #5191 - GitHub
The only way you can update a nested attribute is by updating the whole attribute. So my current workaround is like this: const...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@longbuibao Hi there! This functionality has not been implemented yet. I found a different solution to this problem in my code and did not circle back to this enhancement. If you want to try and implement this, I’m sure @caseycesari would welcome a PR!
I will try sir! 😂 I’m new to programming so I think I dont have enough experience to read code 😂
btw my solution is pull out the property…thank you for great npm module!