Download .opencode/node_modules/yaml/dist/compose/util-empty-scalar-position.js from Chenloong999/opencode-data: direct link, hf CLI and curl.
- Browser
- Download file 850 Bytes
-
https://huggingface.co/datasets/Chenloong999/opencode-data/resolve/main/.opencode/node_modules/yaml/dist/compose/util-empty-scalar-position.js
- Command line
-
hf download hf://datasets/Chenloong999/opencode-data/.opencode/node_modules/yaml/dist/compose/util-empty-scalar-position.js
-
curl -L -o util-empty-scalar-position.js https://huggingface.co/datasets/Chenloong999/opencode-data/resolve/main/.opencode/node_modules/yaml/dist/compose/util-empty-scalar-position.js
850 Bytes
| ; | |
| function emptyScalarPosition(offset, before, pos) { | |
| if (before) { | |
| pos ?? (pos = before.length); | |
| for (let i = pos - 1; i >= 0; --i) { | |
| let st = before[i]; | |
| switch (st.type) { | |
| case 'space': | |
| case 'comment': | |
| case 'newline': | |
| offset -= st.source.length; | |
| continue; | |
| } | |
| // Technically, an empty scalar is immediately after the last non-empty | |
| // node, but it's more useful to place it after any whitespace. | |
| st = before[++i]; | |
| while (st?.type === 'space') { | |
| offset += st.source.length; | |
| st = before[++i]; | |
| } | |
| break; | |
| } | |
| } | |
| return offset; | |
| } | |
| exports.emptyScalarPosition = emptyScalarPosition; | |