Download node_modules/@aws-sdk/smithy-client/dist-cjs/split-every.js from sweet2004/bot: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/spaces/sweet2004/bot/resolve/main/node_modules/%40aws-sdk/smithy-client/dist-cjs/split-every.js
- Command line
-
hf download hf://spaces/sweet2004/bot/node_modules/@aws-sdk/smithy-client/dist-cjs/split-every.js
-
curl -L -o split-every.js https://huggingface.co/spaces/sweet2004/bot/resolve/main/node_modules/%40aws-sdk/smithy-client/dist-cjs/split-every.js
1.01 kB
| ; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.splitEvery = void 0; | |
| function splitEvery(value, delimiter, numDelimiters) { | |
| if (numDelimiters <= 0 || !Number.isInteger(numDelimiters)) { | |
| throw new Error("Invalid number of delimiters (" + numDelimiters + ") for splitEvery."); | |
| } | |
| const segments = value.split(delimiter); | |
| if (numDelimiters === 1) { | |
| return segments; | |
| } | |
| const compoundSegments = []; | |
| let currentSegment = ""; | |
| for (let i = 0; i < segments.length; i++) { | |
| if (currentSegment === "") { | |
| currentSegment = segments[i]; | |
| } | |
| else { | |
| currentSegment += delimiter + segments[i]; | |
| } | |
| if ((i + 1) % numDelimiters === 0) { | |
| compoundSegments.push(currentSegment); | |
| currentSegment = ""; | |
| } | |
| } | |
| if (currentSegment !== "") { | |
| compoundSegments.push(currentSegment); | |
| } | |
| return compoundSegments; | |
| } | |
| exports.splitEvery = splitEvery; | |