@webergency-utils/typechecker 0.1.6 → 0.1.8

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.
@@ -199,23 +199,7 @@ export function createObjectCheck(props, requiredUtils, expected = 'object') {
199
199
  const tpl = `
200
200
  (v, path, ctx) => {
201
201
  if (!validators.object(v, path, ctx, __KEYS__, __EXPECTED__)) return v;
202
- let data = v;
203
- if (ctx.mode === 'strip') {
204
- let hasAdditional = false;
205
- const keys = Object.keys(v);
206
- const allowed = __KEYS__;
207
- if (keys.length > allowed.length) {
208
- hasAdditional = true;
209
- } else {
210
- for (let i = 0; i < keys.length; i++) {
211
- if (!allowed.includes(keys[i])) {
212
- hasAdditional = true;
213
- break;
214
- }
215
- }
216
- }
217
- if (hasAdditional) data = {};
218
- }
202
+ const data = ctx.mode === 'strip' ? {} : v;
219
203
  validators.props(v, data, path, ctx, __PROPS__);
220
204
  return data;
221
205
  }
package/dist/ts.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import * as tsModule from 'typescript';
2
+ import { createRequire } from 'node:module';
2
3
  let tsInstance = tsModule;
3
4
  if (!tsInstance.createProgram) {
4
5
  try {
5
- const ts6 = await import('@typescript/typescript6');
6
+ const require = createRequire(import.meta.url);
7
+ const ts6 = require('@typescript/typescript6');
6
8
  tsInstance = ts6.default || ts6;
7
9
  }
8
10
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webergency-utils/typechecker",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "description": "TypeScript compiler plugin for runtime validation",
6
6
  "author": "radixxko",