Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.0: Asynchronous loading and null-on-failed-parse #14

Merged
merged 8 commits into from
May 6, 2016
Merged

2.0.0: Asynchronous loading and null-on-failed-parse #14

merged 8 commits into from
May 6, 2016

Conversation

fluggo
Copy link
Contributor

@fluggo fluggo commented Apr 18, 2016

I'm using this library for parsing syslog, and I wanted to offer some changes I've made in my fork. This is a rollup of three changes, two of which break backwards compatibility:

  • Asynchronous loading. Previous versions of load and loadDefault were actually synchronous; the callback was called before the function returned. I've made them asynchronous. This is a breaking change because it rearranges the parameters in one of the callbacks to match nodejs standards.
  • Null on parse failure. If the entire pattern fails, the previous code returned an empty object, which is difficult to check for. This version responds with null instead.
  • Uppercase characters allowed in field names.

Please do let me know if I need to make any changes.

Brian Crowell added 8 commits April 18, 2016 15:18
The previous version was synchronous no matter what. This version uses
fs.readFile to make the call actually asynchronous.
This should be up to the caller, who can decide if they might want to
reload the patterns list later, or have multiple collections with different
default patterns.
The reversal of parameters to loadDefault could have been handled
automatically in code, but the callback needed an error parameter, and
that goes first.

This is a breaking change.
This uses the async library to load all of the files in parallel.
Null is much easier to test for than an empty object.
This version change comes at the end of a few suggested breaking changes:

* Asynchronous loading, which is breaking because it rearranges parameters
  in the callback
* Null on parse fail

In addition to one non-breaking change:

* Allow uppercase characters in field names
@Beh01der Beh01der merged commit 33a25a9 into Beh01der:master May 6, 2016
@fluggo
Copy link
Contributor Author

fluggo commented May 6, 2016

Thanks much!

@Beh01der
Copy link
Owner

Beh01der commented May 9, 2016

No worries. I've just released 2.0.1 to npm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants