(comp, options)
| 8 | } |
| 9 | |
| 10 | constructor (comp, options) { |
| 11 | options = parseOptions(options) |
| 12 | |
| 13 | if (comp instanceof Comparator) { |
| 14 | if (comp.loose === !!options.loose) { |
| 15 | return comp |
| 16 | } else { |
| 17 | comp = comp.value |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | comp = comp.trim().split(/\s+/).join(' ') |
| 22 | debug('comparator', comp, options) |
| 23 | this.options = options |
| 24 | this.loose = !!options.loose |
| 25 | this.parse(comp) |
| 26 | |
| 27 | if (this.semver === ANY) { |
| 28 | this.value = '' |
| 29 | } else { |
| 30 | this.value = this.operator + this.semver.version |
| 31 | } |
| 32 | |
| 33 | debug('comp', this) |
| 34 | } |
| 35 | |
| 36 | parse (comp) { |
| 37 | const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] |
nothing calls this directly
no test coverage detected