Skip to content

Releases: 1Computer1/lexure

0.17.0

Choose a tag to compare

@1Computer1 1Computer1 released this 12 Aug 14:37

Changes

  • Added matchingStrategy that replaces exactStrategy and caseSensitiveStrategy. It uses Intl.Collator to support locales and sensitivities for comparing strings.
  • Added mapKeys and renameKeys to augment existing unordered strategies. The latter also uses Intl.Collator.
  • Added setInput and reset to Lexer and Parser to allow reusing the same instance.
  • Implemented IterableIterator for Args; it will iterate over the string value of the ordered tokens.
  • Improved performance of mergeOutputs.
  • Fixed compact option keys not being matched correctly (comes with matchingStrategy).
  • Fixed missing fail_ export for ESM.
  • 1.0.0 never?

0.16.0

Choose a tag to compare

@1Computer1 1Computer1 released this 11 Aug 04:11

Changes

  • Added ?undefined fields to Option, Result, and LoopAction so that one can do e.g. x.value?.foobar without needing to check the tag.
  • Removed compactOptions argument from exactStrategy and caseInsensitiveStrategy and use the same as options.
  • Some documentation improvements.
  • 1.0.0 soon?

0.15.0

Choose a tag to compare

@1Computer1 1Computer1 released this 09 Aug 04:38

Changes

  • Added functions maybeOption and maybeResult to create Option/Result from nullable values.
  • Added functions orOption and orResult{All,First,Last} to select a Option/Result.
  • Improved the performance of Parser#parse.
  • Fixed lexer erroring on strings consisting of only whitespace.

0.14.1

Choose a tag to compare

@1Computer1 1Computer1 released this 02 Aug 21:25

Changes

  • Fixed lexer, given multiple quotes, not correctly matching quoted text that does not have whitespace before it.

0.14.0

Choose a tag to compare

@1Computer1 1Computer1 released this 02 Aug 00:12

Changes

Note: The methods Args#singleMap and Args#singleParse and their async variants are referred to as Args#single{Map,Parse}{,Async}.

  • Added useAnyways parameter to Args#single{Map,Parse}{,Async} that makes the token be considered used even on failure.
  • Changed Args#single{Map,Parse}{,Async} to return null when all the tokens have been used already, instead of none() or err(none()) respectively. The rationale is detailed in c2ff98a.
  • Fixed Args#single{Map,Parse}{,Async} making the token be used on failure when it is not supposed to.

0.13.1

Choose a tag to compare

@1Computer1 1Computer1 released this 30 Jul 23:53

Changes

  • Fixed missing export for util module in ESM.

0.13.0

Choose a tag to compare

@1Computer1 1Computer1 released this 30 Jul 21:41

Changes

  • Modules are now also exported to keep things compact e.g. import { loops } from 'lexure' which contains the exports of loops.ts.
  • Added new methods to the Args class: singleParse, findParse, and async variants. They act like their map variants but use Result instead of Option.
  • Added new functions in the util module that converts Option to Result to LoopAction and back: someToOk, okToSome, errToSome, someToStep, someToFinish, okToStep, and okToFinish.
  • Added fail_ and err_ for null errors.
  • Removed state passing from the loop abstraction. I could not find a use for them, so let me know if you need it.
  • Fixed joinTokens failing on an empty list.
  • Documentation now contains a cookbook for examples.

0.12.0

Choose a tag to compare

@1Computer1 1Computer1 released this 29 Jul 22:51

Changes

  • Added Args#save and Args#restore for backtracking retrieval of arguments.
  • Added new methods to Args for retrieving and mapping: singleMap, singleMapAsync, findMapAsync, and filterMapAsync.
  • Refactored LoopAction to use LoopTag as the discriminant rather than strings.
  • Improved documentation with examples.

0.11.0

Choose a tag to compare

@1Computer1 1Computer1 released this 20 Jul 00:55

Changes

  • Changed longStrategy and longShortStrategy to use prefixedStrategy under the hood. This makes their behavior consistent. The short flags can be longer than one character, the short options can be separated from the value, and the = is now required for compact options.

0.10.0

Choose a tag to compare

@1Computer1 1Computer1 released this 19 Jul 21:49

Changes

  • Added Lexer#lexCommand which combines extractCommand and Lexer#lex for a more convenient lexing.
  • Added ability to pass multiple key names to Args#{flag, option, options} to act as aliases.
  • Changed exactStrategy and caseInsensitiveStrategy to take a record of names to list of words, allowing the name to differ from the text of the unordered argument.