unix-socket-address 0.0.2 → 0.1.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/README.md CHANGED
@@ -3,16 +3,18 @@
3
3
  ## Runtime agnostic core Unix Socket IpAddr class base on Rust implementation.
4
4
 
5
5
  ## Installation
6
+
6
7
  ```bash
7
8
  npm i unix-socket-address
8
9
  ```
9
10
 
10
11
  ## Examples
12
+
11
13
  ```typescript
12
- const socketAddress = new SocketAddrUnix('/tmp/app.sock');
13
- const windowsNamedPipeAddress = new SocketAddrUnix('\\\\.\\pipe\\app');
14
+ const socketAddress = new SocketAddrUnix("/tmp/app.sock");
15
+ const windowsNamedPipeAddress = new SocketAddrUnix("\\\\.\\pipe\\app");
14
16
 
15
- server.listen(socketAddress.asNodeListenerOptions())
16
- ```
17
+ server.listen(socketAddress.asNodeListener());
18
+ ```
17
19
 
18
- ## Full [Documentation](https://luolapeikko.github.io/net-address-base/)
20
+ ## Full [Documentation](https://luolapeikko.github.io/net-address-base/)
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class{family=`unix`;path;constructor(e){this.path=e}asNodeListenerOptions(){return{path:this.path}}toString(){return this.path}};exports.SocketAddrUnix=e;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class{family=`unix`;path;constructor(e){this.path=e}asNodeListener(){return{path:this.path}}toString(){return this.path}equals(e){return`family`in e&&this.family===e.family&&this.path===e.path}};exports.SocketAddrUnix=e;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/SocketAddrUnix.ts"],"sourcesContent":["/**\n * Represents a Unix domain socket address, consisting of a file system path.\n * @example\n * const socketAddress = new SocketAddrUnix('/tmp/app.sock');\n * const windowsNamedPipeAddress = new SocketAddrUnix('\\\\\\\\.\\\\pipe\\\\app');\n */\nexport class SocketAddrUnix {\n\tpublic readonly family = 'unix';\n\tpublic readonly path: string;\n\n\tpublic constructor(path: string) {\n\t\tthis.path = path;\n\t}\n\n\tpublic asNodeListenerOptions(): {path: string} {\n\t\treturn {\n\t\t\tpath: this.path,\n\t\t};\n\t}\n\n\tpublic toString(): string {\n\t\treturn this.path;\n\t}\n}\n"],"mappings":"mEAMA,IAAa,EAAb,KAA4B,CAC3B,OAAyB,OACzB,KAEA,YAAmB,EAAc,CAChC,KAAK,KAAO,CACb,CAEA,uBAA+C,CAC9C,MAAO,CACN,KAAM,KAAK,IACZ,CACD,CAEA,UAA0B,CACzB,OAAO,KAAK,IACb,CACD"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/SocketAddrUnix.ts"],"sourcesContent":["/**\n * Represents a Unix domain socket address, consisting of a file system path.\n * @example\n * const socketAddress = new SocketAddrUnix('/tmp/app.sock');\n * const windowsNamedPipeAddress = new SocketAddrUnix('\\\\\\\\.\\\\pipe\\\\app');\n */\nexport class SocketAddrUnix {\n\tpublic readonly family = 'unix';\n\tpublic readonly path: string;\n\n\tpublic constructor(path: string) {\n\t\tthis.path = path;\n\t}\n\n\tpublic asNodeListener(): {path: string} {\n\t\treturn {\n\t\t\tpath: this.path,\n\t\t};\n\t}\n\n\tpublic toString(): string {\n\t\treturn this.path;\n\t}\n\n\t/**\n\t * Compares this Unix socket path with another for equality.\n\t * @param other instance of another Unix socket path to compare with.\n\t * @returns `true` if both paths are equal, otherwise `false`.\n\t * @since v0.1.0\n\t */\n\tpublic equals(other: SocketAddrUnix | object): boolean {\n\t\treturn 'family' in other && this.family === other.family && this.path === other.path;\n\t}\n}\n"],"mappings":"mEAMA,IAAa,EAAb,KAA4B,CAC3B,OAAyB,OACzB,KAEA,YAAmB,EAAc,CAChC,KAAK,KAAO,CACb,CAEA,gBAAwC,CACvC,MAAO,CACN,KAAM,KAAK,IACZ,CACD,CAEA,UAA0B,CACzB,OAAO,KAAK,IACb,CAQA,OAAc,EAAyC,CACtD,MAAO,WAAY,GAAS,KAAK,SAAW,EAAM,QAAU,KAAK,OAAS,EAAM,IACjF,CACD"}
package/dist/index.d.cts CHANGED
@@ -9,10 +9,17 @@ declare class SocketAddrUnix {
9
9
  readonly family = "unix";
10
10
  readonly path: string;
11
11
  constructor(path: string);
12
- asNodeListenerOptions(): {
12
+ asNodeListener(): {
13
13
  path: string;
14
14
  };
15
15
  toString(): string;
16
+ /**
17
+ * Compares this Unix socket path with another for equality.
18
+ * @param other instance of another Unix socket path to compare with.
19
+ * @returns `true` if both paths are equal, otherwise `false`.
20
+ * @since v0.1.0
21
+ */
22
+ equals(other: SocketAddrUnix | object): boolean;
16
23
  }
17
24
  //#endregion
18
25
  export { SocketAddrUnix };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/SocketAddrUnix.ts"],"mappings":";;AAMA;;;;;cAAa,cAAA;EAAA,SACI,MAAA;EAAA,SACA,IAAA;EAEhB,WAAA,CAAmB,IAAA;EAInB,qBAAA;IAAiC,IAAA;EAAA;EAMjC,QAAA;AAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/SocketAddrUnix.ts"],"mappings":";;AAMA;;;;;cAAa,cAAA;EAAA,SACI,MAAA;EAAA,SACA,IAAA;EAEhB,WAAA,CAAmB,IAAA;EAInB,cAAA;IAA0B,IAAA;EAAA;EAM1B,QAAA;;;AAUqB;;;;EAArB,MAAA,CAAc,KAAA,EAAO,cAAA;AAAA"}
package/dist/index.d.mts CHANGED
@@ -9,10 +9,17 @@ declare class SocketAddrUnix {
9
9
  readonly family = "unix";
10
10
  readonly path: string;
11
11
  constructor(path: string);
12
- asNodeListenerOptions(): {
12
+ asNodeListener(): {
13
13
  path: string;
14
14
  };
15
15
  toString(): string;
16
+ /**
17
+ * Compares this Unix socket path with another for equality.
18
+ * @param other instance of another Unix socket path to compare with.
19
+ * @returns `true` if both paths are equal, otherwise `false`.
20
+ * @since v0.1.0
21
+ */
22
+ equals(other: SocketAddrUnix | object): boolean;
16
23
  }
17
24
  //#endregion
18
25
  export { SocketAddrUnix };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/SocketAddrUnix.ts"],"mappings":";;AAMA;;;;;cAAa,cAAA;EAAA,SACI,MAAA;EAAA,SACA,IAAA;EAEhB,WAAA,CAAmB,IAAA;EAInB,qBAAA;IAAiC,IAAA;EAAA;EAMjC,QAAA;AAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/SocketAddrUnix.ts"],"mappings":";;AAMA;;;;;cAAa,cAAA;EAAA,SACI,MAAA;EAAA,SACA,IAAA;EAEhB,WAAA,CAAmB,IAAA;EAInB,cAAA;IAA0B,IAAA;EAAA;EAM1B,QAAA;;;AAUqB;;;;EAArB,MAAA,CAAc,KAAA,EAAO,cAAA;AAAA"}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var e=class{family=`unix`;path;constructor(e){this.path=e}asNodeListenerOptions(){return{path:this.path}}toString(){return this.path}};export{e as SocketAddrUnix};
1
+ var e=class{family=`unix`;path;constructor(e){this.path=e}asNodeListener(){return{path:this.path}}toString(){return this.path}equals(e){return`family`in e&&this.family===e.family&&this.path===e.path}};export{e as SocketAddrUnix};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/SocketAddrUnix.ts"],"sourcesContent":["/**\n * Represents a Unix domain socket address, consisting of a file system path.\n * @example\n * const socketAddress = new SocketAddrUnix('/tmp/app.sock');\n * const windowsNamedPipeAddress = new SocketAddrUnix('\\\\\\\\.\\\\pipe\\\\app');\n */\nexport class SocketAddrUnix {\n\tpublic readonly family = 'unix';\n\tpublic readonly path: string;\n\n\tpublic constructor(path: string) {\n\t\tthis.path = path;\n\t}\n\n\tpublic asNodeListenerOptions(): {path: string} {\n\t\treturn {\n\t\t\tpath: this.path,\n\t\t};\n\t}\n\n\tpublic toString(): string {\n\t\treturn this.path;\n\t}\n}\n"],"mappings":"AAMA,IAAa,EAAb,KAA4B,CAC3B,OAAyB,OACzB,KAEA,YAAmB,EAAc,CAChC,KAAK,KAAO,CACb,CAEA,uBAA+C,CAC9C,MAAO,CACN,KAAM,KAAK,IACZ,CACD,CAEA,UAA0B,CACzB,OAAO,KAAK,IACb,CACD"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/SocketAddrUnix.ts"],"sourcesContent":["/**\n * Represents a Unix domain socket address, consisting of a file system path.\n * @example\n * const socketAddress = new SocketAddrUnix('/tmp/app.sock');\n * const windowsNamedPipeAddress = new SocketAddrUnix('\\\\\\\\.\\\\pipe\\\\app');\n */\nexport class SocketAddrUnix {\n\tpublic readonly family = 'unix';\n\tpublic readonly path: string;\n\n\tpublic constructor(path: string) {\n\t\tthis.path = path;\n\t}\n\n\tpublic asNodeListener(): {path: string} {\n\t\treturn {\n\t\t\tpath: this.path,\n\t\t};\n\t}\n\n\tpublic toString(): string {\n\t\treturn this.path;\n\t}\n\n\t/**\n\t * Compares this Unix socket path with another for equality.\n\t * @param other instance of another Unix socket path to compare with.\n\t * @returns `true` if both paths are equal, otherwise `false`.\n\t * @since v0.1.0\n\t */\n\tpublic equals(other: SocketAddrUnix | object): boolean {\n\t\treturn 'family' in other && this.family === other.family && this.path === other.path;\n\t}\n}\n"],"mappings":"AAMA,IAAa,EAAb,KAA4B,CAC3B,OAAyB,OACzB,KAEA,YAAmB,EAAc,CAChC,KAAK,KAAO,CACb,CAEA,gBAAwC,CACvC,MAAO,CACN,KAAM,KAAK,IACZ,CACD,CAEA,UAA0B,CACzB,OAAO,KAAK,IACb,CAQA,OAAc,EAAyC,CACtD,MAAO,WAAY,GAAS,KAAK,SAAW,EAAM,QAAU,KAAK,OAAS,EAAM,IACjF,CACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unix-socket-address",
3
- "version": "0.0.2",
3
+ "version": "0.1.0",
4
4
  "description": "Unix domain socket address instances",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",