mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-19 14:45:44 +01:00
Refuse markdown past V8's longest string on every engine, before building it
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import { failure, type ConvertErrorPath, type Result } from './result.ts'
|
||||
|
||||
// V8's longest string, held on every engine so a document converts alike everywhere (docs/decisions.md §Markdown past V8's longest string is refused on every engine).
|
||||
export const longestOutput = 2 ** 29 - 24
|
||||
|
||||
export function tooLong<T>(path: ConvertErrorPath): Result<T> {
|
||||
return failure('unsupported-node-shape', `the markdown would be longer than ${longestOutput} characters, the longest string V8 holds`, path)
|
||||
}
|
||||
Reference in New Issue
Block a user