@x-oasis/return-hook 0.1.20

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 ADDED
@@ -0,0 +1,19 @@
1
+ # @x-oasis/return-hook
2
+
3
+ ## Installation
4
+
5
+ ```bash
6
+ $ npm i @x-oasis/return-hook
7
+ ```
8
+
9
+ ## How to use
10
+
11
+ ```typescript
12
+ import returnHook from '@x-oasis/return-hook'
13
+ ```
14
+
15
+ ## How to run test
16
+
17
+ ```bash
18
+ $ pnpm test
19
+ ```
@@ -0,0 +1,8 @@
1
+ declare type Callback = {
2
+ (val?: any): void;
3
+ };
4
+ declare const _default: (callback: Callback) => (val: any) => any;
5
+ export default _default;
6
+ export declare type ReturnHook = {
7
+ (val: any): any;
8
+ };
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+
2
+ 'use strict'
3
+
4
+ if (process.env.NODE_ENV === 'production') {
5
+ module.exports = require('./return-hook.cjs.production.min.js')
6
+ } else {
7
+ module.exports = require('./return-hook.cjs.development.js')
8
+ }
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var index = (function (callback) {
6
+ return function (val) {
7
+ if (typeof callback === 'function') callback(val);
8
+ return val;
9
+ };
10
+ });
11
+
12
+ exports.default = index;
13
+ //# sourceMappingURL=return-hook.cjs.development.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"return-hook.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["type Callback = {\n (val?: any): void;\n};\n\nexport default (callback: Callback) => (val: any) => {\n if (typeof callback === 'function') callback(val);\n return val;\n};\n\nexport type ReturnHook = {\n (val: any): any;\n};\n"],"names":["callback","val"],"mappings":";;;;AAIA,aAAe,UAACA,QAAkB;EAAA,OAAK,UAACC,GAAQ;IAC9C,IAAI,OAAOD,QAAQ,KAAK,UAAU,EAAEA,QAAQ,CAACC,GAAG,CAAC;IACjD,OAAOA,GAAG;GACX;AAAA;;;;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e){return function(t){return"function"==typeof e&&e(t),t}};
2
+ //# sourceMappingURL=return-hook.cjs.production.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"return-hook.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["type Callback = {\n (val?: any): void;\n};\n\nexport default (callback: Callback) => (val: any) => {\n if (typeof callback === 'function') callback(val);\n return val;\n};\n\nexport type ReturnHook = {\n (val: any): any;\n};\n"],"names":["callback","val"],"mappings":"6FAIgBA,GAAkB,OAAK,SAACC,GAEtC,MADwB,mBAAbD,GAAyBA,EAASC,GACtCA"}
@@ -0,0 +1,9 @@
1
+ var index = (function (callback) {
2
+ return function (val) {
3
+ if (typeof callback === 'function') callback(val);
4
+ return val;
5
+ };
6
+ });
7
+
8
+ export default index;
9
+ //# sourceMappingURL=return-hook.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"return-hook.esm.js","sources":["../src/index.ts"],"sourcesContent":["type Callback = {\n (val?: any): void;\n};\n\nexport default (callback: Callback) => (val: any) => {\n if (typeof callback === 'function') callback(val);\n return val;\n};\n\nexport type ReturnHook = {\n (val: any): any;\n};\n"],"names":["callback","val"],"mappings":"AAIA,aAAe,UAACA,QAAkB;EAAA,OAAK,UAACC,GAAQ;IAC9C,IAAI,OAAOD,QAAQ,KAAK,UAAU,EAAEA,QAAQ,CAACC,GAAG,CAAC;IACjD,OAAOA,GAAG;GACX;AAAA;;;;"}
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@x-oasis/return-hook",
3
+ "version": "0.1.20",
4
+ "description": "return-hook function",
5
+ "main": "dist/index.js",
6
+ "typings": "dist/index.d.ts",
7
+ "module": "dist/return-hook.esm.js",
8
+ "files": [
9
+ "dist",
10
+ "index.ts",
11
+ "src"
12
+ ],
13
+ "author": "",
14
+ "license": "ISC",
15
+ "devDependencies": {
16
+ "tsdx": "^0.14.1"
17
+ },
18
+ "scripts": {
19
+ "build": "tsdx build --tsconfig tsconfig.build.json",
20
+ "clean": "rimraf ./dist",
21
+ "test": "vitest",
22
+ "compile": "tsc -p tsconfig.build.json"
23
+ }
24
+ }
package/src/index.ts ADDED
@@ -0,0 +1,12 @@
1
+ type Callback = {
2
+ (val?: any): void;
3
+ };
4
+
5
+ export default (callback: Callback) => (val: any) => {
6
+ if (typeof callback === 'function') callback(val);
7
+ return val;
8
+ };
9
+
10
+ export type ReturnHook = {
11
+ (val: any): any;
12
+ };