ipaddress 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/ipaddress.js +1 -1
- package/dist/test/test_ipv6.js +7 -0
- package/package.json +1 -1
- package/src/ipaddress.ts +1 -1
- package/test/test_ipv6.ts +7 -0
package/dist/src/ipaddress.js
CHANGED
|
@@ -893,7 +893,7 @@ export class IPAddress {
|
|
|
893
893
|
// // => "192.168.100.1"
|
|
894
894
|
//
|
|
895
895
|
first() {
|
|
896
|
-
return this.from(this.network().host_address.add(
|
|
896
|
+
return this.from(this.network().host_address.add(Crunchy.one()), this.prefix);
|
|
897
897
|
}
|
|
898
898
|
// Like its sibling method IPv4// first, this method
|
|
899
899
|
// returns a new IPv4 object with the
|
package/dist/test/test_ipv6.js
CHANGED
|
@@ -103,6 +103,13 @@ describe("ipv6", () => {
|
|
|
103
103
|
assert.equal(true, setup().network.is_network());
|
|
104
104
|
assert.equal(false, setup().ip.is_network());
|
|
105
105
|
});
|
|
106
|
+
it("test_method_first", () => {
|
|
107
|
+
// the zero host is the subnet-router anycast, NOT a usable unicast —
|
|
108
|
+
// first()/last() are the first/last USABLE hosts (:1/:f), 2026-08-19
|
|
109
|
+
const ip = IPAddress.parse("fd00::10:12:80:0/124");
|
|
110
|
+
assert.equal("fd00::10:12:80:1", ip.first().to_s());
|
|
111
|
+
assert.equal("fd00::10:12:80:f", ip.last().to_s());
|
|
112
|
+
});
|
|
106
113
|
it("test_method_network_u128", () => {
|
|
107
114
|
assert.isOk(Ipv6.from_int(Crunchy.parse("42540766411282592856903984951653826560"), 64).eq(setup().ip.network()));
|
|
108
115
|
});
|
package/package.json
CHANGED
package/src/ipaddress.ts
CHANGED
|
@@ -978,7 +978,7 @@ export class IPAddress {
|
|
|
978
978
|
// // => "192.168.100.1"
|
|
979
979
|
//
|
|
980
980
|
public first(): IPAddress {
|
|
981
|
-
return this.from(this.network().host_address.add(
|
|
981
|
+
return this.from(this.network().host_address.add(Crunchy.one()), this.prefix);
|
|
982
982
|
}
|
|
983
983
|
|
|
984
984
|
// Like its sibling method IPv4// first, this method
|
package/test/test_ipv6.ts
CHANGED
|
@@ -112,6 +112,13 @@ describe("ipv6", () => {
|
|
|
112
112
|
assert.equal(true, setup().network.is_network());
|
|
113
113
|
assert.equal(false, setup().ip.is_network());
|
|
114
114
|
});
|
|
115
|
+
it("test_method_first", () => {
|
|
116
|
+
// the zero host is the subnet-router anycast, NOT a usable unicast —
|
|
117
|
+
// first()/last() are the first/last USABLE hosts (:1/:f), 2026-08-19
|
|
118
|
+
const ip = IPAddress.parse("fd00::10:12:80:0/124");
|
|
119
|
+
assert.equal("fd00::10:12:80:1", ip!.first().to_s());
|
|
120
|
+
assert.equal("fd00::10:12:80:f", ip!.last().to_s());
|
|
121
|
+
});
|
|
115
122
|
it("test_method_network_u128", () => {
|
|
116
123
|
assert.isOk(Ipv6.from_int(Crunchy.parse("42540766411282592856903984951653826560"), 64)!.eq(setup().ip.network()));
|
|
117
124
|
});
|