* Performs decode on given content. * @protected * @param {Chain} content * @return {number[]|string|Uint8Array|Chain|Promise} Decoded content
(content)
| 99 | * @return {number[]|string|Uint8Array|Chain|Promise} Decoded content |
| 100 | */ |
| 101 | performDecode (content) { |
| 102 | switch (this._mode) { |
| 103 | case CharacterToBlockMode: { |
| 104 | return content.split(this.getSeparator()) |
| 105 | .map((block, index, blocks) => |
| 106 | this.performBlockDecodeToChar(block, index, blocks, content)) |
| 107 | .filter(codePoint => codePoint !== null) |
| 108 | } |
| 109 | case BlockToCharacterMode: { |
| 110 | const blocks = content.getCodePoints() |
| 111 | .map((codePoint, index) => |
| 112 | this.performCharDecodeToBlock(codePoint, index, content)) |
| 113 | .filter(block => block !== null) |
| 114 | .map(Chain.wrap) |
| 115 | return Chain.join(blocks, this.getSeparator()) |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Encodes given character to a block. |
nothing calls this directly
no test coverage detected