question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for nested attribute properties

See original GitHub issue

The 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:open
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hparkerttcommented, Jul 8, 2021

@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!

0reactions
longbuibaocommented, Jul 8, 2021

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found