diff --git a/docs/docs.json b/docs/docs.json index b1331ed..1321dda 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -17,7 +17,7 @@ "fileName": "hello.ts", "line": 6, "character": 15, - "url": "https://github.com/wtasg/node-lib/blob/be4189222f32cc9b2fdf81c380cde5c51f69046c/src/hello.ts#L6" + "url": "https://github.com/wtasg/node-lib/blob/890fd5e866d9096470d56594a5788bf55e34bf7c/src/hello.ts#L6" } ], "signatures": [ @@ -51,7 +51,7 @@ "fileName": "hello.ts", "line": 6, "character": 15, - "url": "https://github.com/wtasg/node-lib/blob/be4189222f32cc9b2fdf81c380cde5c51f69046c/src/hello.ts#L6" + "url": "https://github.com/wtasg/node-lib/blob/890fd5e866d9096470d56594a5788bf55e34bf7c/src/hello.ts#L6" } ], "type": { @@ -72,13 +72,122 @@ } } ] + }, + { + "id": 3, + "name": "pojo", + "variant": "declaration", + "kind": 64, + "flags": {}, + "sources": [ + { + "fileName": "pojo.ts", + "line": 10, + "character": 9, + "url": "https://github.com/wtasg/node-lib/blob/890fd5e866d9096470d56594a5788bf55e34bf7c/src/pojo.ts#L10" + } + ], + "signatures": [ + { + "id": 4, + "name": "pojo", + "variant": "signature", + "kind": 4096, + "flags": {}, + "comment": { + "summary": [ + { + "kind": "text", + "text": "Convert a class instance into a plain JavaScript object.\nCopies only the instance's own enumerable data properties\nand excludes methods or prototype values." + } + ], + "blockTags": [ + { + "tag": "@returns", + "content": [ + { + "kind": "text", + "text": "A plain JavaScript object containing only data fields." + } + ] + } + ] + }, + "sources": [ + { + "fileName": "pojo.ts", + "line": 10, + "character": 9, + "url": "https://github.com/wtasg/node-lib/blob/890fd5e866d9096470d56594a5788bf55e34bf7c/src/pojo.ts#L10" + } + ], + "typeParameters": [ + { + "id": 5, + "name": "T", + "variant": "typeParam", + "kind": 131072, + "flags": {}, + "type": { + "type": "intrinsic", + "name": "object" + } + } + ], + "parameters": [ + { + "id": 6, + "name": "instance", + "variant": "param", + "kind": 32768, + "flags": {}, + "comment": { + "summary": [ + { + "kind": "text", + "text": "A class instance to convert." + } + ] + }, + "type": { + "type": "reference", + "target": 5, + "name": "T", + "package": "@wtasnorg/node-lib", + "refersToTypeParameter": true + } + } + ], + "type": { + "type": "reference", + "target": { + "packageName": "typescript", + "packagePath": "lib/lib.es5.d.ts", + "qualifiedName": "Record" + }, + "typeArguments": [ + { + "type": "intrinsic", + "name": "string" + }, + { + "type": "intrinsic", + "name": "any" + } + ], + "name": "Record", + "package": "typescript" + } + } + ] } ], "groups": [ { "title": "Functions", "children": [ - 1 + 1, + 3 ] } ], @@ -153,6 +262,26 @@ "packageName": "@wtasnorg/node-lib", "packagePath": "src/hello.ts", "qualifiedName": "hello" + }, + "3": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/pojo.ts", + "qualifiedName": "pojo" + }, + "4": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/pojo.ts", + "qualifiedName": "pojo" + }, + "5": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/pojo.ts", + "qualifiedName": "T" + }, + "6": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/pojo.ts", + "qualifiedName": "instance" } }, "files": { diff --git a/docs/functions/hello.md b/docs/functions/hello.md index b112874..7ddf9c4 100644 --- a/docs/functions/hello.md +++ b/docs/functions/hello.md @@ -8,7 +8,7 @@ > **hello**(): `Promise`\<`string`\> -Defined in: [hello.ts:6](https://github.com/wtasg/node-lib/blob/be4189222f32cc9b2fdf81c380cde5c51f69046c/src/hello.ts#L6) +Defined in: [hello.ts:6](https://github.com/wtasg/node-lib/blob/890fd5e866d9096470d56594a5788bf55e34bf7c/src/hello.ts#L6) A sample function that should work to test if lib is installed correctly. diff --git a/docs/functions/pojo.md b/docs/functions/pojo.md new file mode 100644 index 0000000..1b930c8 --- /dev/null +++ b/docs/functions/pojo.md @@ -0,0 +1,35 @@ +[**@wtasnorg/node-lib**](../README.md) + +*** + +[@wtasnorg/node-lib](../globals.md) / pojo + +# Function: pojo() + +> **pojo**\<`T`\>(`instance`): `Record`\<`string`, `any`\> + +Defined in: [pojo.ts:10](https://github.com/wtasg/node-lib/blob/890fd5e866d9096470d56594a5788bf55e34bf7c/src/pojo.ts#L10) + +Convert a class instance into a plain JavaScript object. +Copies only the instance's own enumerable data properties +and excludes methods or prototype values. + +## Type Parameters + +### T + +`T` *extends* `object` + +## Parameters + +### instance + +`T` + +A class instance to convert. + +## Returns + +`Record`\<`string`, `any`\> + +A plain JavaScript object containing only data fields. diff --git a/docs/globals.md b/docs/globals.md index fad54e0..9ddc19f 100644 --- a/docs/globals.md +++ b/docs/globals.md @@ -7,3 +7,4 @@ ## Functions - [hello](functions/hello.md) +- [pojo](functions/pojo.md) diff --git a/package-lock.json b/package-lock.json index 71a8e76..5db807b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wtasnorg/node-lib", - "version": "0.0.4", + "version": "0.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wtasnorg/node-lib", - "version": "0.0.4", + "version": "0.0.5", "cpu": [ "x64" ], diff --git a/package.json b/package.json index 9813457..1282283 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wtasnorg/node-lib", - "version": "0.0.4", + "version": "0.0.5", "description": "node library", "main": "src/index.js", "scripts": { diff --git a/src/index.d.ts b/src/index.d.ts index 5559aef..e0f3de3 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -1,3 +1,4 @@ import { hello } from "./hello.js"; -export { hello }; +import { pojo } from "./pojo.js"; +export { hello, pojo }; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/src/index.js b/src/index.js index 91f4fe6..498f174 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,4 @@ import { hello } from "./hello.js"; -export { hello }; +import { pojo } from "./pojo.js"; +export { hello, pojo }; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 56d0634..c99ae46 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,7 @@ import { hello } from "./hello.js"; +import { pojo } from "./pojo.js"; -export { hello }; +export { + hello, + pojo +};