Function
encodeSymbol
(sym: symbol, ast: AST.AST)
Source from the content-addressed store, hash-verified
| 5444 | }) {} |
| 5445 | |
| 5446 | const encodeSymbol = (sym: symbol, ast: AST.AST) => { |
| 5447 | const key = Symbol.keyFor(sym) |
| 5448 | return key === undefined |
| 5449 | ? ParseResult.fail( |
| 5450 | new ParseResult.Type(ast, sym, `Unable to encode a unique symbol ${String(sym)} into a string`) |
| 5451 | ) |
| 5452 | : ParseResult.succeed(key) |
| 5453 | } |
| 5454 | |
| 5455 | const decodeSymbol = (s: string) => ParseResult.succeed(Symbol.for(s)) |
| 5456 | |
Tested by
no test coverage detected