pmcf 6.57.0 → 6.58.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "6.57.0",
3
+ "version": "6.58.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -2,7 +2,6 @@ import {
2
2
  default_attribute,
3
3
  type_attribute,
4
4
  getAttribute,
5
- asArray,
6
5
  leafValues
7
6
  } from "pacc";
8
7
  import { familyIP, formatCIDR, decodeIP, addressType } from "ip-utilties";
package/src/subnet.mjs CHANGED
@@ -3,8 +3,9 @@ import {
3
3
  rangeIP,
4
4
  decodeIP,
5
5
  matchPrefixIP,
6
+ addressType
6
7
  } from "ip-utilties";
7
- import { name_attribute, integer_attribute } from "pacc";
8
+ import { name_attribute, integer_attribute, string_attribute } from "pacc";
8
9
  import { networks_attribute, family_attribute } from "./common-attributes.mjs";
9
10
  import { addType, network, core } from "pmcf";
10
11
 
@@ -18,7 +19,8 @@ export class Subnet extends core {
18
19
  address: { ...name_attribute, name: "address", private: true },
19
20
  networks: networks_attribute,
20
21
  prefixLength: { ...integer_attribute, name: "prefixLength" },
21
- family: family_attribute
22
+ family: family_attribute,
23
+ addressType: { ...string_attribute, name: "addressType" }
22
24
  };
23
25
 
24
26
  static {
@@ -30,7 +32,7 @@ export class Subnet extends core {
30
32
  constructor(owner, address) {
31
33
  super();
32
34
 
33
- switch(typeof address) {
35
+ switch (typeof address) {
34
36
  case "object":
35
37
  address = address.address;
36
38
  }
@@ -79,6 +81,10 @@ export class Subnet extends core {
79
81
  get longAddress() {
80
82
  return `${this.longPrefix}/${this.prefixLength}`;
81
83
  }
84
+
85
+ get addressType() {
86
+ return addressType(this.address);
87
+ }
82
88
  }
83
89
 
84
90
  export const SUBNET_GLOBAL_IPV4 = new Subnet(undefined, "0.0.0.0/0");