Spaces:
Running
Running
Download node_modules/JSV/jsdoc-toolkit/app/lib/JSDOC/TextStream.js from k-l-lambda/lotus: direct link, hf CLI and curl.
- Browser
- Download file 804 Bytes
-
https://huggingface.co/spaces/k-l-lambda/lotus/resolve/main/node_modules/JSV/jsdoc-toolkit/app/lib/JSDOC/TextStream.js
- Command line
-
hf download hf://spaces/k-l-lambda/lotus/node_modules/JSV/jsdoc-toolkit/app/lib/JSDOC/TextStream.js
-
curl -L -o TextStream.js https://huggingface.co/spaces/k-l-lambda/lotus/resolve/main/node_modules/JSV/jsdoc-toolkit/app/lib/JSDOC/TextStream.js
804 Bytes
| /** | |
| @constructor | |
| */ | |
| JSDOC.TextStream = function(text) { | |
| if (typeof(text) == "undefined") text = ""; | |
| text = ""+text; | |
| this.text = text; | |
| this.cursor = 0; | |
| } | |
| JSDOC.TextStream.prototype.look = function(n) { | |
| if (typeof n == "undefined") n = 0; | |
| if (this.cursor+n < 0 || this.cursor+n >= this.text.length) { | |
| var result = new String(""); | |
| result.eof = true; | |
| return result; | |
| } | |
| return this.text.charAt(this.cursor+n); | |
| } | |
| JSDOC.TextStream.prototype.next = function(n) { | |
| if (typeof n == "undefined") n = 1; | |
| if (n < 1) return null; | |
| var pulled = ""; | |
| for (var i = 0; i < n; i++) { | |
| if (this.cursor+i < this.text.length) { | |
| pulled += this.text.charAt(this.cursor+i); | |
| } | |
| else { | |
| var result = new String(""); | |
| result.eof = true; | |
| return result; | |
| } | |
| } | |
| this.cursor += n; | |
| return pulled; | |
| } |