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.

string with ~ break Dry.parse

See original GitHub issue

Use case that break parse:

console.log(Dry.parse('{"path": "~/projects"}'));

return {"path": undefined}

for internal ref usage, it should not be string that can easily by used by user. Maybe something like:

{"__dry__": "ref", "value": "projects"}

if the object have prop __dry__ it mean it internal object and not real object provided by user.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

nevcoscommented, Jan 22, 2018

+1 for using an object for references.

skeritcommented, Jan 29, 2018

An earlier iteration of json-dry actually contained its own json.js based parser, but it was more trouble than it’s worth.

Also: the stringifying is an afterthought. Dry.stringify is actually just a JSON.stringify wrapper around Dry.toDryObject.

So json-dry actually first creates an intermediate object and then stringifies that using the built-in JSON parser. And yeah: this is much faster than using a custom stringifier/parser 😃

If you’re wondering why such an intermediate object would be useful: it’s for times when you can use a structured clone (like in IndexedDB or web workers), which is (again) a lot faster.

And backwards compatibility with json is important. If you would first use JSON.parse ton a json-dry string you would get a valid object. That valid object can then still be given to Dry.parse

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clean fastest & efficient way to parse a string in c# - Stack ...
The code loops through each row parsing the items in the string. I made a simple class to hold the items; however the...
Read more >
Parsing Strings with split -
Strings in Java can be parsed using the split method of the String class. ( StringTokenizer can also be used to parse a...
Read more >
optparse — Parser for command line options — Python 3.11.1 ...
When optparse sees the option string -f , it consumes the next argument, foo.txt , and stores it in options.filename . So, after...
Read more >
Optimize parsing of strings : r/lua - Reddit
EDIT: Solved - thanks to everyone for the code and lessons. Hello, I am working on a simple module that outputs pango formatted...
Read more >
Example of how to parse options with bash/getopt · GitHub
#!/bin/bash. #. # Example of how to parse short/long options with 'getopt'. #. OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n ...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found