Skip to content

Commit 173520b

Browse files
committed
chore(ip): expose named export, deprecate default
This commit adds a named export for `findIp`. The default export is still supported but deprecated. Related-to: GH-4723. Related-to: GH-4860. Related-to: GH-4875.
1 parent d427c39 commit 173520b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

ip/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ function getHeader(headers: HeaderLike["headers"], headerKey: string) {
804804
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
805805
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
806806
// SOFTWARE.
807-
function findIp(
807+
export function findIp(
808808
request: RequestLike,
809809
options?: Options | null | undefined,
810810
): string {
@@ -1025,4 +1025,10 @@ function findIp(
10251025
*/
10261026
type Cidr = Ipv4Cidr | Ipv6Cidr;
10271027

1028+
/**
1029+
* Find an IP address.
1030+
*
1031+
* @deprecated
1032+
* Use the named export `findIp` instead.
1033+
*/
10281034
export default findIp;

ip/test/ip.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ const cases: Array<Case> = [
185185
test("@arcjet/ip", async function (t) {
186186
await t.test("should expose the public api", async function () {
187187
assert.deepEqual(Object.keys(await import("../index.js")).sort(), [
188-
// TODO(@wooorm-arcjet): use named exports.
189188
"default",
189+
"findIp",
190190
"parseProxy",
191191
]);
192192
});

0 commit comments

Comments
 (0)