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.

Pass tag name to "tagValueProcessor" and "attrValueProcessor"

See original GitHub issue

What do you think about passing a tag name to tagValueProcessor and attrValueProcessor? That’s might be helpful to choose parse logic depends on tags name (my case).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
andreafspezialecommented, Aug 17, 2022

@infacto @amitguptagwl Hello everyone!

Shouldn’t the tagValueProcessor signature be something like this?

tagValueProcessor: (tagName: string, tagValue: string, jPath: string, hasAttributes: boolean, isLeafNode: boolean) => unknown;

Instead of returning a string?

Otherwise I’m missing the point… I would use it like that

tagValueProcessor: (tagName, tagValue) => {
  switch (tagName) {
    case 'created_at':
      return new Date(tagValue)
  }

  return value;
};

Or there is any other way to achieve it?

1reaction
amitguptagwlcommented, Apr 16, 2019

Ah! my bad. Yes, it passes their values. We can modify it to pass the tag name.

Read more comments on GitHub >

github_iconTop Results From Across the Web

fast-xml-parser/docs.md at master - GitHub
When function a tag name is passed to the callback that can be checked. tagValueProcessor : Process tag value during transformation. Like HTML...
Read more >
fast-xml-parser/README.md - UNPKG
Instead, use tagValueProcessor, and attrValueProcessor. See above example. ... When `function` a tag name is passed to the callback that can be checked....
Read more >
fast-xml-parser - npm
tagValueProcessor : Process tag value during transformation. Like HTML decoding, word capitalization, etc. Applicable in case of string only.
Read more >
Parse XML to JSON with JavaScript - Morioh
Instead, use tagValueProcessor, and attrValueProcessor. See above example. ... When function a tag name is passed to the callback that can be checked....
Read more >
To Get Tag value by passing Tag name from a string in XML ...
You should be able to do records."$tag".text().
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