@x-oasis/clamp 0.0.15

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/clamp
2
+
3
+ ## Installation
4
+
5
+ ```bash
6
+ $ npm i @x-oasis/clamp
7
+ ```
8
+
9
+ ## How to use
10
+
11
+ ```typescript
12
+ import clamp from '@x-oasis/clamp'
13
+ ```
14
+
15
+ ## How to run test
16
+
17
+ ```bash
18
+ $ pnpm test
19
+ ```
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var clamp = function clamp(min, value, max) {
6
+ if (value < min) {
7
+ return min;
8
+ }
9
+ if (value > max) {
10
+ return max;
11
+ }
12
+ return value;
13
+ };
14
+
15
+ exports.default = clamp;
16
+ //# sourceMappingURL=clamp.cjs.development.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clamp.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["const clamp = (min: number, value: number, max: number) => {\n if (value < min) {\n return min;\n }\n\n if (value > max) {\n return max;\n }\n\n return value;\n};\n\nexport default clamp;\n"],"names":["clamp","min","value","max"],"mappings":";;;;AAAA,IAAMA,KAAK,GAAG,SAARA,KAAKA,CAAIC,GAAW,EAAEC,KAAa,EAAEC,GAAW;EACpD,IAAID,KAAK,GAAGD,GAAG,EAAE;IACf,OAAOA,GAAG;;EAGZ,IAAIC,KAAK,GAAGC,GAAG,EAAE;IACf,OAAOA,GAAG;;EAGZ,OAAOD,KAAK;AACd,CAAC;;;;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,t,r){return t<e?e:t>r?r:t};
2
+ //# sourceMappingURL=clamp.cjs.production.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clamp.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["const clamp = (min: number, value: number, max: number) => {\n if (value < min) {\n return min;\n }\n\n if (value > max) {\n return max;\n }\n\n return value;\n};\n\nexport default clamp;\n"],"names":["min","value","max"],"mappings":"oFAAc,SAACA,EAAaC,EAAeC,GACzC,OAAID,EAAQD,EACHA,EAGLC,EAAQC,EACHA,EAGFD"}
@@ -0,0 +1,12 @@
1
+ var clamp = function clamp(min, value, max) {
2
+ if (value < min) {
3
+ return min;
4
+ }
5
+ if (value > max) {
6
+ return max;
7
+ }
8
+ return value;
9
+ };
10
+
11
+ export default clamp;
12
+ //# sourceMappingURL=clamp.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clamp.esm.js","sources":["../src/index.ts"],"sourcesContent":["const clamp = (min: number, value: number, max: number) => {\n if (value < min) {\n return min;\n }\n\n if (value > max) {\n return max;\n }\n\n return value;\n};\n\nexport default clamp;\n"],"names":["clamp","min","value","max"],"mappings":"AAAA,IAAMA,KAAK,GAAG,SAARA,KAAKA,CAAIC,GAAW,EAAEC,KAAa,EAAEC,GAAW;EACpD,IAAID,KAAK,GAAGD,GAAG,EAAE;IACf,OAAOA,GAAG;;EAGZ,IAAIC,KAAK,GAAGC,GAAG,EAAE;IACf,OAAOA,GAAG;;EAGZ,OAAOD,KAAK;AACd,CAAC;;;;"}
@@ -0,0 +1,2 @@
1
+ declare const clamp: (min: number, value: number, max: number) => number;
2
+ export default clamp;
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('./clamp.cjs.production.min.js')
6
+ } else {
7
+ module.exports = require('./clamp.cjs.development.js')
8
+ }
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@x-oasis/clamp",
3
+ "version": "0.0.15",
4
+ "description": "clamp function",
5
+ "main": "dist/index.js",
6
+ "typings": "dist/index.d.ts",
7
+ "module": "dist/clamp.esm.js",
8
+ "author": "",
9
+ "license": "ISC",
10
+ "devDependencies": {
11
+ "tsdx": "^0.14.1"
12
+ },
13
+ "scripts": {
14
+ "build": "tsdx build --tsconfig tsconfig.build.json",
15
+ "clean": "rimraf ./dist",
16
+ "test": "vitest",
17
+ "compile": "tsc -p tsconfig.build.json"
18
+ }
19
+ }
package/src/index.ts ADDED
@@ -0,0 +1,13 @@
1
+ const clamp = (min: number, value: number, max: number) => {
2
+ if (value < min) {
3
+ return min;
4
+ }
5
+
6
+ if (value > max) {
7
+ return max;
8
+ }
9
+
10
+ return value;
11
+ };
12
+
13
+ export default clamp;
@@ -0,0 +1,5 @@
1
+ import { expect, test } from 'vitest';
2
+
3
+ test('vitest', async () => {
4
+ expect('vitest').toBe('vitest');
5
+ });
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../../../tsconfig.build.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "esModuleInterop": true
6
+ },
7
+
8
+ "include": [
9
+ "src/**/*"
10
+ ]
11
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "jsx": "react",
5
+ "esModuleInterop": true
6
+ }
7
+ }