From f5bf41def6dafd20e8890378d66da27aadf94399 Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Tue, 7 Mar 2023 06:44:36 +0000 Subject: [PATCH] CFI: export collapse function --- epubcfi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epubcfi.js b/epubcfi.js index ed45d4e..a046bab 100644 --- a/epubcfi.js +++ b/epubcfi.js @@ -131,7 +131,7 @@ const toInnerString = parsed => parsed.parent const toString = parsed => wrap(toInnerString(parsed)) -const collapse = (x, toEnd) => typeof x === 'string' +export const collapse = (x, toEnd) => typeof x === 'string' ? toString(collapse(parse(x), toEnd)) : x.parent ? concatArrays(x.parent, x[toEnd ? 'end' : 'start']) : x