Skip to content

Commit

Permalink
feat: support vercel, close #194
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Dec 30, 2023
1 parent 4c1c605 commit 497f27c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import { encodeUTF16toUTF8 } from "./utfx.js";
* Continues with the callback on the next tick.
*/
export const nextTick =
typeof process !== "undefined" &&
process &&
typeof process.nextTick === "function"
? typeof setImmediate === "function"
typeof process === "object" && process.env.NEXT_RUNTIME === "edge"
? setTimeout
: typeof setImmediate === "function"
? setImmediate
: // eslint-disable-next-line @typescript-eslint/unbound-method
process.nextTick
: setTimeout;
: typeof process === "object" && typeof process.nextTick === "function"
? // eslint-disable-next-line @typescript-eslint/unbound-method
process.nextTick
: setTimeout;

/**
* @private
Expand All @@ -32,7 +32,7 @@ export const stringToBytes = (str: string): number[] => {
() => (i >= str.length ? null : str.charCodeAt(i++)),
(b: number) => {
out.push(b);
},
}
);

return out;
Expand Down

0 comments on commit 497f27c

Please sign in to comment.