function
jsc.isRope
input: string
): boolean;
Returns whether a string is currently stored as a "rope".
JavaScriptCore represents the result of string concatenation as a rope, a tree pointing at the pieces, and only copies the pieces into one contiguous buffer ("flattens" the rope) when something needs the characters, such as a comparison, charCodeAt, using the string as a property key, or passing it to native code. Once flattened, a string stays flat.
Returns false for anything that is not a string.
import { isRope } from "bun:jsc";
const s = "a".repeat(100) + "b".repeat(100);
isRope(s); // true
s.charCodeAt(0);
isRope(s); // false