* Performs encode on given content. * @protected * @param {Chain} content * @return {number[]|string|Uint8Array|Chain|Promise} Encoded content
(content)
| 74 | * @return {number[]|string|Uint8Array|Chain|Promise} Encoded content |
| 75 | */ |
| 76 | performEncode (content) { |
| 77 | switch (this._mode) { |
| 78 | case CharacterToBlockMode: { |
| 79 | const blocks = content.getCodePoints() |
| 80 | .map((codePoint, index) => |
| 81 | this.performCharEncodeToBlock(codePoint, index, content)) |
| 82 | .filter(block => block !== null) |
| 83 | .map(Chain.wrap) |
| 84 | return Chain.join(blocks, this.getSeparator()) |
| 85 | } |
| 86 | case BlockToCharacterMode: { |
| 87 | return content.split(this.getSeparator()) |
| 88 | .map((block, index, blocks) => |
| 89 | this.performBlockEncodeToChar(block, index, blocks, content)) |
| 90 | .filter(codePoint => codePoint !== null) |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Performs decode on given content. |
nothing calls this directly
no test coverage detected