MCPcopy Create free account
hub / github.com/cryptii/cryptii / getVariantOptions

Method getVariantOptions

src/Encoder/Base32.js:249–267  ·  view source on GitHub ↗

* Returns the current variant options. * @return {object} Variant options

()

Source from the content-addressed store, hash-verified

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}

Callers 2

performEncodeMethod · 0.95
performDecodeMethod · 0.95

Calls 4

getSettingValueMethod · 0.80
getCodePointAtMethod · 0.80
wrapMethod · 0.80
getLengthMethod · 0.45

Tested by

no test coverage detected