lang-json 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/babel.config.js +8 -0
- package/coverage/clover.xml +6 -0
- package/coverage/coverage-final.json +1 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +101 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/dist/esm/src/index.d.ts +18 -0
- package/dist/esm/src/index.js +415 -0
- package/dist/esm/src/index.js.map +1 -0
- package/dist/esm/src/modules/is-this/index.d.ts +136 -0
- package/dist/esm/src/modules/is-this/index.js +484 -0
- package/dist/esm/src/modules/is-this/index.js.map +1 -0
- package/dist/esm/tests/helpers.test.d.ts +1 -0
- package/dist/esm/tests/helpers.test.js +220 -0
- package/dist/esm/tests/helpers.test.js.map +1 -0
- package/dist/esm/tests/index.test.d.ts +1 -0
- package/dist/esm/tests/index.test.js +537 -0
- package/dist/esm/tests/index.test.js.map +1 -0
- package/jest.config.ts +212 -0
- package/package.json +19 -9
- package/src/index.ts +450 -296
- package/src/modules/is-this/index.ts +682 -0
- package/tests/helpers.test.ts +259 -0
- package/tests/index.test.ts +681 -0
- package/tsconfig.json +15 -16
- package/dist/esm/dump.js +0 -2
- package/dist/esm/dump.js.map +0 -1
- package/dist/esm/example.d.ts +0 -13
- package/dist/esm/example.js +0 -93
- package/dist/esm/example.js.map +0 -1
- package/dist/esm/index.d.ts +0 -36
- package/dist/esm/index.js +0 -326
- package/dist/esm/index.js.map +0 -1
- package/src/example.ts +0 -116
- /package/{dist/esm/dump.d.ts → coverage/lcov.info} +0 -0
package/jest.config.ts
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
/**
|
2
|
+
* For a detailed explanation regarding each configuration property, visit:
|
3
|
+
* https://jestjs.io/docs/configuration
|
4
|
+
*/
|
5
|
+
|
6
|
+
import type { Config } from "jest";
|
7
|
+
|
8
|
+
const config: Config = {
|
9
|
+
preset: "ts-jest", // Add this to use ts-jest for TypeScript files
|
10
|
+
testEnvironment: "node",
|
11
|
+
transform: {
|
12
|
+
'^.+\\.tsx?$': 'ts-jest', // For TypeScript files
|
13
|
+
'^.+\\.js$': 'babel-jest', // For JavaScript files
|
14
|
+
},
|
15
|
+
moduleFileExtensions: ["ts", "js"], // Specifies the allowed module file extensions
|
16
|
+
testMatch: ["**/tests/**/*.test.ts"], // Points Jest to your test files
|
17
|
+
transformIgnorePatterns: [
|
18
|
+
"/node_modules/(?!@devanshdeveloper/is-this)", // Add your specific module here
|
19
|
+
"/node_modules/",
|
20
|
+
],
|
21
|
+
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
22
|
+
// All imported modules in your tests should be mocked automatically
|
23
|
+
// automock: false,
|
24
|
+
|
25
|
+
// Stop running tests after `n` failures
|
26
|
+
// bail: 0,
|
27
|
+
|
28
|
+
// The directory where Jest should store its cached dependency information
|
29
|
+
// cacheDirectory: "C:\\Users\\devan\\AppData\\Local\\Temp\\jest",
|
30
|
+
|
31
|
+
// Automatically clear mock calls, instances, contexts and results before every test
|
32
|
+
// clearMocks: true,
|
33
|
+
|
34
|
+
// Indicates whether the coverage information should be collected while executing the test
|
35
|
+
// collectCoverage: true,
|
36
|
+
|
37
|
+
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
38
|
+
// collectCoverageFrom: undefined,
|
39
|
+
|
40
|
+
// The directory where Jest should output its coverage files
|
41
|
+
// coverageDirectory: "coverage",
|
42
|
+
|
43
|
+
// An array of regexp pattern strings used to skip coverage collection
|
44
|
+
// coveragePathIgnorePatterns: [
|
45
|
+
// "\\\\node_modules\\\\"
|
46
|
+
// ],
|
47
|
+
|
48
|
+
// Indicates which provider should be used to instrument code for coverage
|
49
|
+
// coverageProvider: "v8",
|
50
|
+
|
51
|
+
// A list of reporter names that Jest uses when writing coverage reports
|
52
|
+
// coverageReporters: [
|
53
|
+
// "json",
|
54
|
+
// "text",
|
55
|
+
// "lcov",
|
56
|
+
// "clover"
|
57
|
+
// ],
|
58
|
+
|
59
|
+
// An object that configures minimum threshold enforcement for coverage results
|
60
|
+
// coverageThreshold: undefined,
|
61
|
+
|
62
|
+
// A path to a custom dependency extractor
|
63
|
+
// dependencyExtractor: undefined,
|
64
|
+
|
65
|
+
// Make calling deprecated APIs throw helpful error messages
|
66
|
+
// errorOnDeprecated: false,
|
67
|
+
|
68
|
+
// The default configuration for fake timers
|
69
|
+
// fakeTimers: {
|
70
|
+
// "enableGlobally": false
|
71
|
+
// },
|
72
|
+
|
73
|
+
// Force coverage collection from ignored files using an array of glob patterns
|
74
|
+
// forceCoverageMatch: [],
|
75
|
+
|
76
|
+
// A path to a module which exports an async function that is triggered once before all test suites
|
77
|
+
// globalSetup: undefined,
|
78
|
+
|
79
|
+
// A path to a module which exports an async function that is triggered once after all test suites
|
80
|
+
// globalTeardown: undefined,
|
81
|
+
|
82
|
+
// A set of global variables that need to be available in all test environments
|
83
|
+
// globals: {},
|
84
|
+
|
85
|
+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
86
|
+
// maxWorkers: "50%",
|
87
|
+
|
88
|
+
// An array of directory names to be searched recursively up from the requiring module's location
|
89
|
+
// moduleDirectories: [
|
90
|
+
// "node_modules"
|
91
|
+
// ],
|
92
|
+
|
93
|
+
// An array of file extensions your modules use
|
94
|
+
// moduleFileExtensions: [
|
95
|
+
// "js",
|
96
|
+
// "mjs",
|
97
|
+
// "cjs",
|
98
|
+
// "jsx",
|
99
|
+
// "ts",
|
100
|
+
// "tsx",
|
101
|
+
// "json",
|
102
|
+
// "node"
|
103
|
+
// ],
|
104
|
+
|
105
|
+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
106
|
+
// moduleNameMapper: {},
|
107
|
+
|
108
|
+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
109
|
+
// modulePathIgnorePatterns: [],
|
110
|
+
|
111
|
+
// Activates notifications for test results
|
112
|
+
// notify: false,
|
113
|
+
|
114
|
+
// An enum that specifies notification mode. Requires { notify: true }
|
115
|
+
// notifyMode: "failure-change",
|
116
|
+
|
117
|
+
// A preset that is used as a base for Jest's configuration
|
118
|
+
// preset: undefined,
|
119
|
+
|
120
|
+
// Run tests from one or more projects
|
121
|
+
// projects: undefined,
|
122
|
+
|
123
|
+
// Use this configuration option to add custom reporters to Jest
|
124
|
+
// reporters: undefined,
|
125
|
+
|
126
|
+
// Automatically reset mock state before every test
|
127
|
+
// resetMocks: false,
|
128
|
+
|
129
|
+
// Reset the module registry before running each individual test
|
130
|
+
// resetModules: false,
|
131
|
+
|
132
|
+
// A path to a custom resolver
|
133
|
+
// resolver: undefined,
|
134
|
+
|
135
|
+
// Automatically restore mock state and implementation before every test
|
136
|
+
// restoreMocks: false,
|
137
|
+
|
138
|
+
// The root directory that Jest should scan for tests and modules within
|
139
|
+
// rootDir: undefined,
|
140
|
+
|
141
|
+
// A list of paths to directories that Jest should use to search for files in
|
142
|
+
// roots: [
|
143
|
+
// "<rootDir>"
|
144
|
+
// ],
|
145
|
+
|
146
|
+
// Allows you to use a custom runner instead of Jest's default test runner
|
147
|
+
// runner: "jest-runner",
|
148
|
+
|
149
|
+
// The paths to modules that run some code to configure or set up the testing environment before each test
|
150
|
+
// setupFiles: [],
|
151
|
+
|
152
|
+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
153
|
+
// setupFilesAfterEnv: [],
|
154
|
+
|
155
|
+
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
156
|
+
// slowTestThreshold: 5,
|
157
|
+
|
158
|
+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
159
|
+
// snapshotSerializers: [],
|
160
|
+
|
161
|
+
// The test environment that will be used for testing
|
162
|
+
// testEnvironment: "jest-environment-node",
|
163
|
+
|
164
|
+
// Options that will be passed to the testEnvironment
|
165
|
+
// testEnvironmentOptions: {},
|
166
|
+
|
167
|
+
// Adds a location field to test results
|
168
|
+
// testLocationInResults: false,
|
169
|
+
|
170
|
+
// The glob patterns Jest uses to detect test files
|
171
|
+
// testMatch: [
|
172
|
+
// "**/__tests__/**/*.[jt]s?(x)",
|
173
|
+
// "**/?(*.)+(spec|test).[tj]s?(x)"
|
174
|
+
// ],
|
175
|
+
|
176
|
+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
177
|
+
// testPathIgnorePatterns: [
|
178
|
+
// "\\\\node_modules\\\\"
|
179
|
+
// ],
|
180
|
+
|
181
|
+
// The regexp pattern or array of patterns that Jest uses to detect test files
|
182
|
+
// testRegex: [],
|
183
|
+
|
184
|
+
// This option allows the use of a custom results processor
|
185
|
+
// testResultsProcessor: undefined,
|
186
|
+
|
187
|
+
// This option allows use of a custom test runner
|
188
|
+
// testRunner: "jest-circus/runner",
|
189
|
+
|
190
|
+
// A map from regular expressions to paths to transformers
|
191
|
+
// transform: undefined,
|
192
|
+
|
193
|
+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
194
|
+
// transformIgnorePatterns: [
|
195
|
+
// "\\\\node_modules\\\\",
|
196
|
+
// "\\.pnp\\.[^\\\\]+$"
|
197
|
+
// ],
|
198
|
+
|
199
|
+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
200
|
+
// unmockedModulePathPatterns: undefined,
|
201
|
+
|
202
|
+
// Indicates whether each individual test should be reported during the run
|
203
|
+
// verbose: undefined,
|
204
|
+
|
205
|
+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
206
|
+
// watchPathIgnorePatterns: [],
|
207
|
+
|
208
|
+
// Whether to use watchman for file crawling
|
209
|
+
// watchman: true,
|
210
|
+
};
|
211
|
+
|
212
|
+
export default config;
|
package/package.json
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "lang-json",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.1",
|
4
4
|
"description": "A lib for templating json",
|
5
|
-
"main": "dist/esm/index.js",
|
6
|
-
"module": "dist/esm/index.js",
|
7
|
-
"types": "dist/esm/index.d.ts",
|
8
|
-
"type":
|
5
|
+
"main": "dist/esm/src/index.js",
|
6
|
+
"module": "dist/esm/src/index.js",
|
7
|
+
"types": "dist/esm/src/index.d.ts",
|
8
|
+
"type": "module",
|
9
9
|
"scripts": {
|
10
10
|
"build:cjs": "tsc --outDir dist/cjs --module commonjs",
|
11
11
|
"build:esm": "tsc --outDir dist/esm --module esnext",
|
@@ -13,7 +13,9 @@
|
|
13
13
|
"watch:cjs": "tsc --outDir dist/cjs --module commonjs --watch",
|
14
14
|
"watch:esm": "tsc --outDir dist/esm --module esnext --watch",
|
15
15
|
"watch": "npm run watch:esm & npm run watch:cjs",
|
16
|
-
"publish": "git add . && git commit -m /\"code updated\"/ && git push && npm publish"
|
16
|
+
"publish": "git add . && git commit -m /\"code updated\"/ && git push && npm publish",
|
17
|
+
"test": "jest",
|
18
|
+
"dev": "nodemon dist/esm/src/index.js"
|
17
19
|
},
|
18
20
|
"repository": {
|
19
21
|
"type": "git",
|
@@ -26,9 +28,17 @@
|
|
26
28
|
],
|
27
29
|
"author": "Devansh Khetwani",
|
28
30
|
"license": "MIT",
|
29
|
-
"dependencies": {
|
30
|
-
"typescript": "^5.0.0"
|
31
|
-
},
|
32
31
|
"devDependencies": {
|
32
|
+
"@babel/preset-env": "^7.25.8",
|
33
|
+
"@babel/preset-typescript": "^7.25.7",
|
34
|
+
"@types/is": "^0.0.25",
|
35
|
+
"@types/jest": "^29.5.13",
|
36
|
+
"babel-jest": "^29.7.0",
|
37
|
+
"ts-jest": "^29.2.5",
|
38
|
+
"ts-node": "^10.9.2",
|
39
|
+
"typescript": "^5.6.3"
|
40
|
+
},
|
41
|
+
"dependencies": {
|
42
|
+
"@devanshdeveloper/is-this": "^1.1.6"
|
33
43
|
}
|
34
44
|
}
|