| 1 | let utils = require('./utils') |
| 2 | |
| 3 | class OldValue { |
| 4 | constructor(unprefixed, prefixed, string, regexp) { |
| 5 | this.unprefixed = unprefixed |
| 6 | this.prefixed = prefixed |
| 7 | this.string = string || prefixed |
| 8 | this.regexp = regexp || utils.regexp(prefixed) |
| 9 | } |
| 10 | |
| 11 | /** |
| 12 | * Check, that value contain old value |
| 13 | */ |
| 14 | check(value) { |
| 15 | if (value.includes(this.string)) { |
| 16 | return !!value.match(this.regexp) |
| 17 | } |
| 18 | return false |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | module.exports = OldValue |