* Returns the current variant options. * @return {object} Variant options
()
| 247 | * @return {object} Variant options |
| 248 | */ |
| 249 | getVariantOptions () { |
| 250 | const name = this.getSettingValue('variant') |
| 251 | if (name === 'custom') { |
| 252 | // Compose custom variant options |
| 253 | const padding = this.getSettingValue('padding') |
| 254 | return { |
| 255 | alphabet: this.getSettingValue('alphabet'), |
| 256 | padding: padding.getLength() === 1 ? padding.getCodePointAt(0) : null, |
| 257 | decodeContentFilter: null, |
| 258 | decodeMap: {} |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | // Find variant options |
| 263 | const options = variants.find(variant => variant.name === name) |
| 264 | options.alphabet = Chain.wrap(options.alphabet) |
| 265 | options.decodeMap = options.decodeMap || {} |
| 266 | return options |
| 267 | } |
| 268 | } |
no test coverage detected