@ts-type/object-freeze 1.0.1
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/CHANGELOG.md +11 -0
- package/README.md +12 -0
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.development.cjs +15 -0
- package/dist/index.cjs.development.cjs.map +1 -0
- package/dist/index.cjs.production.min.cjs +2 -0
- package/dist/index.cjs.production.min.cjs.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.esm.mjs +10 -0
- package/dist/index.esm.mjs.map +1 -0
- package/dist/index.umd.development.cjs +21 -0
- package/dist/index.umd.development.cjs.map +1 -0
- package/dist/index.umd.production.min.cjs +2 -0
- package/dist/index.umd.production.min.cjs.map +1 -0
- package/package.json +105 -0
- package/src/index.js.map +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## 1.0.1 (2022-07-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### đŸ”–ă€€Miscellaneous
|
|
10
|
+
|
|
11
|
+
* `@ts-type/object-freeze` ([c6b78cb](https://github.com/bluelovers/ws-ts-type/commit/c6b78cb4481d83337e8e981df108709bf2d258e3))
|
package/README.md
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function freezeArray(obj) {
|
|
6
|
+
return Object.freeze(obj);
|
|
7
|
+
}
|
|
8
|
+
function freezeObject(obj) {
|
|
9
|
+
return Object.freeze(obj);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports["default"] = freezeObject;
|
|
13
|
+
exports.freezeArray = freezeArray;
|
|
14
|
+
exports.freezeObject = freezeObject;
|
|
15
|
+
//# sourceMappingURL=index.cjs.development.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.development.cjs","sources":["../src/index.ts"],"sourcesContent":["import { ITSEmptyTuple } from 'ts-type/lib/type/tuple/empty';\nimport { ITSToReadonlyArray } from 'ts-type/lib/helper/array/readonly';\nimport { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';\n\nexport function freezeArray<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>\nexport function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>\nexport function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)\n{\n\treturn Object.freeze(obj)\n}\n\nexport function freezeObject<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>\nexport function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>\n\nexport function freezeObject<T extends Function>(f: T): T\nexport function freezeObject<T extends { [idx: string]: U | null | undefined | object }, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>\nexport function freezeObject<T>(o: T): Readonly<T>\n\nexport function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)\n{\n\treturn Object.freeze(obj)\n}\n\nexport default freezeObject\n"],"names":["obj"],"mappings":";;;;;;;qBAuBA,CAA2BA,GAA3B,EAA2B;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function freezeObject(e){return Object.freeze(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=freezeObject,exports.freezeArray=function freezeArray(e){return Object.freeze(e)},exports.freezeObject=freezeObject;
|
|
2
|
+
//# sourceMappingURL=index.cjs.production.min.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.production.min.cjs","sources":["../src/index.ts"],"sourcesContent":["import { ITSEmptyTuple } from 'ts-type/lib/type/tuple/empty';\nimport { ITSToReadonlyArray } from 'ts-type/lib/helper/array/readonly';\nimport { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';\n\nexport function freezeArray<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>\nexport function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>\nexport function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)\n{\n\treturn Object.freeze(obj)\n}\n\nexport function freezeObject<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>\nexport function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>\n\nexport function freezeObject<T extends Function>(f: T): T\nexport function freezeObject<T extends { [idx: string]: U | null | undefined | object }, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>\nexport function freezeObject<T>(o: T): Readonly<T>\n\nexport function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)\n{\n\treturn Object.freeze(obj)\n}\n\nexport default freezeObject\n"],"names":["obj"],"mappings":"mCAuB2BA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ITSEmptyTuple } from 'ts-type/lib/type/tuple/empty';
|
|
2
|
+
import { ITSToReadonlyArray } from 'ts-type/lib/helper/array/readonly';
|
|
3
|
+
import { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';
|
|
4
|
+
export declare function freezeArray<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>;
|
|
5
|
+
export declare function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>;
|
|
6
|
+
export declare function freezeObject<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>;
|
|
7
|
+
export declare function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>;
|
|
8
|
+
export declare function freezeObject<T extends Function>(f: T): T;
|
|
9
|
+
export declare function freezeObject<T extends {
|
|
10
|
+
[idx: string]: U | null | undefined | object;
|
|
11
|
+
}, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>;
|
|
12
|
+
export declare function freezeObject<T>(o: T): Readonly<T>;
|
|
13
|
+
export default freezeObject;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.mjs","sources":["../src/index.ts"],"sourcesContent":["import { ITSEmptyTuple } from 'ts-type/lib/type/tuple/empty';\nimport { ITSToReadonlyArray } from 'ts-type/lib/helper/array/readonly';\nimport { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';\n\nexport function freezeArray<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>\nexport function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>\nexport function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)\n{\n\treturn Object.freeze(obj)\n}\n\nexport function freezeObject<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>\nexport function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>\n\nexport function freezeObject<T extends Function>(f: T): T\nexport function freezeObject<T extends { [idx: string]: U | null | undefined | object }, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>\nexport function freezeObject<T>(o: T): Readonly<T>\n\nexport function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)\n{\n\treturn Object.freeze(obj)\n}\n\nexport default freezeObject\n"],"names":["obj"],"mappings":";;;;sBAuB2BA;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TsTypeObjectFreeze = {}));
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function freezeArray(obj) {
|
|
8
|
+
return Object.freeze(obj);
|
|
9
|
+
}
|
|
10
|
+
function freezeObject(obj) {
|
|
11
|
+
return Object.freeze(obj);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports["default"] = freezeObject;
|
|
15
|
+
exports.freezeArray = freezeArray;
|
|
16
|
+
exports.freezeObject = freezeObject;
|
|
17
|
+
|
|
18
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
19
|
+
|
|
20
|
+
}));
|
|
21
|
+
//# sourceMappingURL=index.umd.development.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.umd.development.cjs","sources":["../src/index.ts"],"sourcesContent":["import { ITSEmptyTuple } from 'ts-type/lib/type/tuple/empty';\nimport { ITSToReadonlyArray } from 'ts-type/lib/helper/array/readonly';\nimport { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';\n\nexport function freezeArray<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>\nexport function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>\nexport function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)\n{\n\treturn Object.freeze(obj)\n}\n\nexport function freezeObject<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>\nexport function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>\n\nexport function freezeObject<T extends Function>(f: T): T\nexport function freezeObject<T extends { [idx: string]: U | null | undefined | object }, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>\nexport function freezeObject<T>(o: T): Readonly<T>\n\nexport function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)\n{\n\treturn Object.freeze(obj)\n}\n\nexport default freezeObject\n"],"names":["obj"],"mappings":";;;;;;;;;sBAuBA,CAA2BA,GAA3B,EAA2B;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TsTypeObjectFreeze={})}(this,(function(e){"use strict";function freezeObject(e){return Object.freeze(e)}e.default=freezeObject,e.freezeArray=function freezeArray(e){return Object.freeze(e)},e.freezeObject=freezeObject,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
|
+
//# sourceMappingURL=index.umd.production.min.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.umd.production.min.cjs","sources":["../src/index.ts"],"sourcesContent":["import { ITSEmptyTuple } from 'ts-type/lib/type/tuple/empty';\nimport { ITSToReadonlyArray } from 'ts-type/lib/helper/array/readonly';\nimport { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';\n\nexport function freezeArray<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>\nexport function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>\nexport function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)\n{\n\treturn Object.freeze(obj)\n}\n\nexport function freezeObject<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>\nexport function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>\n\nexport function freezeObject<T extends Function>(f: T): T\nexport function freezeObject<T extends { [idx: string]: U | null | undefined | object }, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>\nexport function freezeObject<T>(o: T): Readonly<T>\n\nexport function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)\n{\n\treturn Object.freeze(obj)\n}\n\nexport default freezeObject\n"],"names":["obj"],"mappings":"gRAuB2BA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ts-type/object-freeze",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "better typescript type for Object.freeze",
|
|
5
|
+
"keywords": [
|
|
6
|
+
".d.ts",
|
|
7
|
+
"@types",
|
|
8
|
+
"declaration",
|
|
9
|
+
"dev",
|
|
10
|
+
"develop",
|
|
11
|
+
"development",
|
|
12
|
+
"environment",
|
|
13
|
+
"ide",
|
|
14
|
+
"interface",
|
|
15
|
+
"node",
|
|
16
|
+
"playground",
|
|
17
|
+
"runtime",
|
|
18
|
+
"ts",
|
|
19
|
+
"type",
|
|
20
|
+
"type-level",
|
|
21
|
+
"typelevel",
|
|
22
|
+
"types",
|
|
23
|
+
"typescript",
|
|
24
|
+
"typing",
|
|
25
|
+
"typings",
|
|
26
|
+
"type-helprt",
|
|
27
|
+
"toolbox",
|
|
28
|
+
"toolbelt",
|
|
29
|
+
"create-by-yarn-tool",
|
|
30
|
+
"create-by-tsdx"
|
|
31
|
+
],
|
|
32
|
+
"homepage": "https://github.com/bluelovers/ws-ts-type/tree/master/packages/@ts-type/object-freeze#readme",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/bluelovers/ws-ts-type/issues"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/bluelovers/ws-ts-type.git"
|
|
39
|
+
},
|
|
40
|
+
"license": "ISC",
|
|
41
|
+
"author": "bluelovers",
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"exports": {
|
|
44
|
+
".": {
|
|
45
|
+
"types": "./dist/index.d.ts",
|
|
46
|
+
"import": "./dist/index.esm.mjs",
|
|
47
|
+
"require": "./dist/index.cjs"
|
|
48
|
+
},
|
|
49
|
+
"./package.json": "./package.json",
|
|
50
|
+
"./src/*": "./src/*"
|
|
51
|
+
},
|
|
52
|
+
"main": "dist/index.cjs",
|
|
53
|
+
"unpkg": "dist/index.umd.production.min.cjs",
|
|
54
|
+
"module": "dist/index.esm.mjs",
|
|
55
|
+
"types": "dist/index.d.ts",
|
|
56
|
+
"typings": "dist/index.d.ts",
|
|
57
|
+
"scripts": {
|
|
58
|
+
"review": "yarn run review:coverage",
|
|
59
|
+
"review:coverage": "yarn run lint && yarn run coverage",
|
|
60
|
+
"review:test": "yarn run lint && yarn run test",
|
|
61
|
+
"coverage": "yarn run test -- --coverage",
|
|
62
|
+
"lint": "yarn run lint:eslint",
|
|
63
|
+
"lint:eslint": "ynpx eslint --ext .ts,.tsx,.mts,.cts ./",
|
|
64
|
+
"pretest": "echo pretest",
|
|
65
|
+
"test": "echo \"Error: no test specified\"",
|
|
66
|
+
"test:jest": "jest --passWithNoTests",
|
|
67
|
+
"test:mocha": "ynpx --quiet -p ts-node -p mocha mocha -- --require ts-node/register \"!(node_modules)/**/*.{test,spec}.{ts,tsx}\"",
|
|
68
|
+
"test:tsdx": "ynpx @bluelovers/tsdx test --passWithNoTests",
|
|
69
|
+
"posttest": "yarn run build",
|
|
70
|
+
"build": "yarn run build:tsdx && yarn run build:dts:tsc",
|
|
71
|
+
"build:dts:bundle": "ynpx dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --no-banner --inline-declare-global & echo build:dts:bundle",
|
|
72
|
+
"build:dts:copy": "copy .\\src\\index.d.ts .\\dist\\index.d.ts & echo build:dts",
|
|
73
|
+
"build:dts:tsc": "yarn run build:dts:tsc:emit && yarn run build:dts:copy",
|
|
74
|
+
"build:dts:tsc:emit": "tsc --emitDeclarationOnly --declaration --noEmit false",
|
|
75
|
+
"build:microbundle": "ynpx microbundle --target node",
|
|
76
|
+
"build:tsdx": "ynpx @bluelovers/tsdx build --target node --name index",
|
|
77
|
+
"ci:install": "echo ci:install",
|
|
78
|
+
"ci:build": "echo ci:build",
|
|
79
|
+
"preversion": "echo preversion && yarn run test",
|
|
80
|
+
"version": "echo version",
|
|
81
|
+
"postversion": "echo postversion",
|
|
82
|
+
"prepublish": "echo prepublish",
|
|
83
|
+
"prepare": "echo prepare",
|
|
84
|
+
"prepublishOnly": "echo prepublishOnly",
|
|
85
|
+
"prepublishOnly:update": "yarn run ncu && yarn run sort-package-json",
|
|
86
|
+
"prepack": "echo prepack",
|
|
87
|
+
"pack": "echo pack",
|
|
88
|
+
"postpack": "echo postpack",
|
|
89
|
+
"publish": "echo publish",
|
|
90
|
+
"postpublish": "echo postpublish",
|
|
91
|
+
"postpublishOnly": "echo postpublishOnly",
|
|
92
|
+
"ncu": "yarn-tool ncu -u",
|
|
93
|
+
"sort-package-json": "yarn-tool sort",
|
|
94
|
+
"tsc:showConfig": "ynpx get-current-tsconfig -p"
|
|
95
|
+
},
|
|
96
|
+
"dependencies": {
|
|
97
|
+
"ts-type": "^2.1.8",
|
|
98
|
+
"tslib": "^2"
|
|
99
|
+
},
|
|
100
|
+
"packageManager": "yarn@^1.22.11",
|
|
101
|
+
"publishConfig": {
|
|
102
|
+
"access": "public"
|
|
103
|
+
},
|
|
104
|
+
"gitHead": "095cead0934e3722045025990d906c290869e3f6"
|
|
105
|
+
}
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAMA,SAAgB,WAAW,CAA+C,GAAM;IAE/E,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC;AAHD,kCAGC;AASD,SAAgB,YAAY,CAA+C,GAAM;IAEhF,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC;AAHD,oCAGC;AAED,kBAAe,YAAY,CAAA","sourcesContent":["import { ITSEmptyTuple } from 'ts-type/lib/type/tuple/empty';\nimport { ITSToReadonlyArray } from 'ts-type/lib/helper/array/readonly';\nimport { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';\n\nexport function freezeArray<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>\nexport function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>\nexport function freezeArray<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)\n{\n\treturn Object.freeze(obj)\n}\n\nexport function freezeObject<T extends ITSEmptyTuple>(obj: T): ITSToReadonlyArray<T>\nexport function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T): ITSToReadonlyArray<T>\n\nexport function freezeObject<T extends Function>(f: T): T\nexport function freezeObject<T extends { [idx: string]: U | null | undefined | object }, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>\nexport function freezeObject<T>(o: T): Readonly<T>\n\nexport function freezeObject<T extends ITSArrayListMaybeReadonly<unknown>>(obj: T)\n{\n\treturn Object.freeze(obj)\n}\n\nexport default freezeObject\n"]}
|