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

Export parsers / refiners #71

Closed
bradvogel opened this issue Nov 28, 2015 · 2 comments
Closed

Export parsers / refiners #71

bradvogel opened this issue Nov 28, 2015 · 2 comments

Comments

@bradvogel
Copy link

It'd be nice to export the internal parsers / refiners so we cherry pick which ones we want to add. For example, if I want all of them except for 'UnlikelyFormatFilter', I need to do:

  var obj = new chrono.Chrono(chrono.options.casualOption());

  obj.refiners = _.reject(obj.refiners, function(refiner) {
    return refiner.constructor.name == 'UnlikelyFormatFilter';
  });

Instead I'd like to add them directly, e.g.

new chrono.Chrono(function(){
   return {
      parsers: [
          chrono.builtIn.ENISOFormatParser(true /* Strict */)
      ],
      ...
   };
});
@benaubin
Copy link
Collaborator

+1

@wanasit
Copy link
Owner

wanasit commented Dec 5, 2015

Agree. From version 1.1.0, chrono will export those parser/refiner classes through chrono.parser and chrono.refiner objects.

If you want to cherry pick those parsers/refiners, you can do so. (It is slightly different from what you suggested)

new chrono.Chrono({
      parsers: [
          new chrono.parser.ENISOFormatParser(true /* Strict */)
      ],
      ...
});

See the change here: 9a7801c

@wanasit wanasit closed this as completed Dec 5, 2015
This was referenced Jan 3, 2016
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

No branches or pull requests

3 participants