SemVer DSL
A simple internal DSL which allows you to invoke different functionality depending on version match. Used in codelyzer for keeping the code compatible across different versions of the Angular compiler.
Demo
$ npm i semver-dsl --save
; ;;;; SemVerDSL'3.0.0' .gt'3.2.1', base .elseIf.gt'3.0.1', elseIf1 .elseIf.between'3.0.1', '3.1.8', elseIf2 .elseelse;
In the example above will be invoked else
.
API
SemDSL(version: string)
- factory which accepts a version and returns an object.gte(version: string, callback?: Function): ISemContextualDSL
- returns an object withelseIf
andelse
properties.lte(version: string, callback?: Function): ISemContextualDSL
- returns an object withelseIf
andelse
properties.gt(version: string, callback?: Function): ISemContextualDSL
- returns an object withelseIf
andelse
properties.lt(version: string, callback?: Function): ISemContextualDSL
- returns an object withelseIf
andelse
properties.eq(version: string, callback?: Function): ISemContextualDSL
- returns an object withelseIf
andelse
properties.neq(version: string, callback?: Function): ISemContextualDSL
- returns an object withelseIf
andelse
properties.between(v1: string, v2: string, callback?: Function): ISemContextualDSL
- returns an object withelseIf
properties.elseIf
- returns an object of typeISemVerDSL
bound to the previous predicate.else
- invokes given callback if all of the previous conditions have failed.
License
MIT