Releases: 1Computer1/lexure
Releases · 1Computer1/lexure
0.17.0
Changes
- Added
matchingStrategy
that replacesexactStrategy
andcaseSensitiveStrategy
. It usesIntl.Collator
to support locales and sensitivities for comparing strings. - Added
mapKeys
andrenameKeys
to augment existing unordered strategies. The latter also usesIntl.Collator
. - Added
setInput
andreset
toLexer
andParser
to allow reusing the same instance. - Implemented
IterableIterator
forArgs
; 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
Changes
- Added
?undefined
fields toOption
,Result
, andLoopAction
so that one can do e.g.x.value?.foobar
without needing to check the tag. - Removed
compactOptions
argument fromexactStrategy
andcaseInsensitiveStrategy
and use the same asoptions
. - Some documentation improvements.
- 1.0.0 soon?
0.15.0
Changes
- Added functions
maybeOption
andmaybeResult
to createOption
/Result
from nullable values. - Added functions
orOption
andorResult{All,First,Last}
to select aOption
/Result
. - Improved the performance of
Parser#parse
. - Fixed lexer erroring on strings consisting of only whitespace.
0.14.1
Changes
- Fixed lexer, given multiple quotes, not correctly matching quoted text that does not have whitespace before it.
0.14.0
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 toArgs#single{Map,Parse}{,Async}
that makes the token be considered used even on failure. - Changed
Args#single{Map,Parse}{,Async}
to returnnull
when all the tokens have been used already, instead ofnone()
orerr(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
Changes
- Fixed missing export for
util
module in ESM.
0.13.0
Changes
- Modules are now also exported to keep things compact e.g.
import { loops } from 'lexure'
which contains the exports ofloops.ts
. - Added new methods to the
Args
class:singleParse
,findParse
, and async variants. They act like theirmap
variants but useResult
instead ofOption
. - Added new functions in the
util
module that convertsOption
toResult
toLoopAction
and back:someToOk
,okToSome
,errToSome
,someToStep
,someToFinish
,okToStep
, andokToFinish
. - Added
fail_
anderr_
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
Changes
- Added
Args#save
andArgs#restore
for backtracking retrieval of arguments. - Added new methods to
Args
for retrieving and mapping:singleMap
,singleMapAsync
,findMapAsync
, andfilterMapAsync
. - Refactored
LoopAction
to useLoopTag
as the discriminant rather than strings. - Improved documentation with examples.
0.11.0
Changes
- Changed
longStrategy
andlongShortStrategy
to useprefixedStrategy
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
Changes
- Added
Lexer#lexCommand
which combinesextractCommand
andLexer#lex
for a more convenient lexing. - Added ability to pass multiple key names to
Args#{flag, option, options}
to act as aliases. - Changed
exactStrategy
andcaseInsensitiveStrategy
to take a record of names to list of words, allowing the name to differ from the text of the unordered argument.