You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the api of the util is updated to accept a second predicate parameter which accepts a function to check the if the input is IP.
type PredicateFn = (input: string) => boolean;
User can pass the “isIP” function from “is-ip” package or pass a custom function based on NodeJs net lib.
import net from “node:net”;
const isIP = (input:string) => net.isIP(input) !== 0;
This can reduce one extra dependency for apps that only depend on single type server runtime, since other runtimes may provide their native ip checking function.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently “get-client-ip-address” util accepts only one parameter and uses “is-ip” package to check if the header value is a IP address or not.
But on NodeJS, as pointed out by README of “is-ip” package, there is built in “net.isIP”.
If the api of the util is updated to accept a second predicate parameter which accepts a function to check the if the input is IP.
type PredicateFn = (input: string) => boolean;
User can pass the “isIP” function from “is-ip” package or pass a custom function based on NodeJs net lib.
import net from “node:net”;
const isIP = (input:string) => net.isIP(input) !== 0;
This can reduce one extra dependency for apps that only depend on single type server runtime, since other runtimes may provide their native ip checking function.
Beta Was this translation helpful? Give feedback.
All reactions