aboutsummaryrefslogtreecommitdiff
path: root/src/js/node/tty.js
diff options
context:
space:
mode:
authorGravatar jhmaster <32803471+jhmaster2000@users.noreply.github.com> 2023-09-28 03:51:49 -0300
committerGravatar GitHub <noreply@github.com> 2023-09-27 23:51:49 -0700
commite60b3607c12c91959ec795228cc299703d5b09d0 (patch)
tree2b4e8115501077adef7dc5d35a3627cc588ae63a /src/js/node/tty.js
parent31d96a1b7f8a72a1976bee92e6c3f08faade8c31 (diff)
downloadbun-e60b3607c12c91959ec795228cc299703d5b09d0.tar.gz
bun-e60b3607c12c91959ec795228cc299703d5b09d0.tar.zst
bun-e60b3607c12c91959ec795228cc299703d5b09d0.zip
Complete rework of the majority of `node:util`, primarily `util.inspect` (#4493)
* 1st revision of new util.inspect impl. (not done) * fix util.types.isArrayBuffer * fix some utl tests and bugs * fix node:tty missing primordials * fix utl stackoverflow handling & some tests * narrow down diff. context test * util.inspect indirect circulars optimization * temp workaround for buggy is...Function checks * impl. Map/Set/Iterator entries inspection * fix bigint & symbol objects inspection * error inspection fixes * misc util tests stuff * inline getExternalValue stub * leftovers * util.inspect promise internals * run bun fmt * commit make js changes * cut out unnecessary utl files * reorganize utl folder structure * remove browserify buffer check * Try to revert git messing up uws somehow This reverts commit 2c27e16e7d361657b9c3a7dc7892117cf31e15ee. * commit src/js/out files again * redo this edit too * refresh js/out files * Removed uws submodule * tidy up * unused primordials * run fmt --------- Co-authored-by: dave caruso <me@paperdave.net>
Diffstat (limited to 'src/js/node/tty.js')
-rw-r--r--src/js/node/tty.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/js/node/tty.js b/src/js/node/tty.js
index 9ccde6ffe..2ffc2d764 100644
--- a/src/js/node/tty.js
+++ b/src/js/node/tty.js
@@ -1,5 +1,9 @@
const { ttySetMode, isatty, getWindowSize: _getWindowSize } = $lazy("tty");
+// primordials
+const StringPrototypeSplit = Function.prototype.call.bind(String.prototype.split);
+const NumberIsInteger = Number.isInteger;
+
function ReadStream(fd) {
if (!(this instanceof ReadStream)) return new ReadStream(fd);
if (fd >> 0 !== fd || fd < 0) throw new RangeError("fd must be a positive integer");
@@ -284,7 +288,7 @@ Object.defineProperty(WriteStream, "prototype", {
var validateInteger = (value, name, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) => {
if (typeof value !== "number") throw new ERR_INVALID_ARG_TYPE(name, "number", value);
- if (!Number.isInteger(value)) throw new ERR_OUT_OF_RANGE(name, "an integer", value);
+ if (!NumberIsInteger(value)) throw new ERR_OUT_OF_RANGE(name, "an integer", value);
if (value < min || value > max) throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
};