Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typia

Package Overview
Dependencies
Maintainers
1
Versions
588
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typia - npm Package Compare versions

Comparing version 3.5.0-dev.20230211 to 3.5.0-dev.20230212

lib/programmers/AssertPruneProgrammer.d.ts

182

lib/module.d.ts

@@ -492,4 +492,4 @@ import { IJsonApplication } from "./schemas/IJsonApplication";

*
* For reference, this `typia.stringify()` does not validate the input value type. It
* just believes that the input value is following the type `T`. Therefore, if you
* For reference, this `typia.stringify()` does not validate the input value type.
* It just believes that the input value is following the type `T`. Therefore, if you
* can't ensure the input value type, it would be better to call one of below functions

@@ -581,3 +581,3 @@ * instead.

* (JavaScript Object Notation) string, with type checking.
*
*f
* In such reason, when `input` value is not matched with the type `T`, it returns

@@ -651,4 +651,13 @@ * `null` value. Otherwise, there's no problem on the `input` value, JSON string would

*
* For reference, this `typia.prune()` function does not validate the input value type.
* It just believes that the input value is following the type `T`. Therefore, if you
* can't ensure the input value type, it would better to call one of below functions
* instead.
*
* - {@link assertPrune}
* - {@link isPrune}
* - {@link validatePrune}
*
* @template T Type of the input value
* @param input target instance to prune
* @param input Target instance to prune
*

@@ -659,2 +668,110 @@ * @author Jeongho Nam - https://github.com/samchon

/**
* Prune, erase superfluous properties, with type assertion.
*
* `typia.assertPrune()` is a combination function of {@link assert} and {@link prune}.
* Therefore, it removes every superfluous properties from the `input` object including
* nested objects, with type assertion.
*
* In such reason, when `input` value is not matched with the type `T`, it throws an
* {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, its
* every superfluous properties would be removed, including nested objects.
*
* @template T Type of the input value
* @param input Target instance to assert and prune
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare function assertPrune<T>(input: T): T;
/**
* Prune, erase superfluous properties, with type assertion.
*
* `typia.assertPrune()` is a combination function of {@link assert} and {@link prune}.
* Therefore, it removes every superfluous properties from the `input` object including
* nested objects, with type assertion.
*
* In such reason, when `input` value is not matched with the type `T`, it throws an
* {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, its
* every superfluous properties would be removed, including nested objects.
*
* @template T Type of the input value
* @param input Target instance to assert and prune
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare function assertPrune<T>(input: unknown): T;
/**
* Prune, erase superfluous properties, with type checking.
*
* `typia.assertPrune()` is a combination function of {@link is} and {@link prune}.
* Therefore, it removes every superfluous properties from the `input` object including
* nested objects, with type checking.
*
* In such reason, when `input` value is not matched with the type `T`, it returns
* `false` value. Otherwise, there's no problem on the `input` value, it returns
* `true` after removing every superfluous properties, including nested objects.
*
* @template T Type of the input value
* @param input Target instance to check and prune
* @returns Whether the parametric value is following the type `T` or not
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare function isPrune<T>(input: T): input is T;
/**
* Prune, erase superfluous properties, with type checking.
*
* `typia.assertPrune()` is a combination function of {@link is} and {@link prune}.
* Therefore, it removes every superfluous properties from the `input` object including
* nested objects, with type checking.
*
* In such reason, when `input` value is not matched with the type `T`, it returns
* `false` value. Otherwise, there's no problem on the `input` value, it returns
* `true` after removing every superfluous properties, including nested objects.
*
* @template T Type of the input value
* @param input Target instance to check and prune
* @returns Whether the parametric value is following the type `T` or not
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare function isPrune<T>(input: unknown): input is T;
/**
* Prune, erase superfluous properties, with type validation.
*
* `typia.validatePrune()` is a combination function of {@link validate} and {@link prune}.
* Therefore, it removes every superfluous properties from the `input` object including
* nested objects, with type validation.
*
* In such reason, when `input` value is not matched with the type `T`, it returns
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
* no problem on the `input` value, it returns {@link IValidation.ISucess} value after
* removing every superfluous properties, including nested objects.
*
* @template T Type of the input value
* @param input Target instance to validate and prune
* @returns Validation result
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare function validatePrune<T>(input: T): IValidation<T>;
/**
* Prune, erase superfluous properties, with type validation.
*
* `typia.validatePrune()` is a combination function of {@link validate} and {@link prune}.
* Therefore, it removes every superfluous properties from the `input` object including
* nested objects, with type validation.
*
* In such reason, when `input` value is not matched with the type `T`, it returns
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
* no problem on the `input` value, it returns {@link IValidation.ISucess} value after
* removing every superfluous properties, including nested objects.
*
* @template T Type of the input value
* @param input Target instance to validate and prune
* @returns Validation result
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare function validatePrune<T>(input: unknown): IValidation<T>;
/**
* Creates a reusable {@link assert} function.

@@ -950,1 +1067,58 @@ *

export declare function createPrune<T extends object>(): (input: T) => void;
/**
* Creates a reusable {@link isPrune} function.
*
* @danger You have to specify the generic argument `T`
* @return Nothing until specifying the generic argument `T`
* @throws compile error
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare function createAssertPrune(): never;
/**
* Creates a resuable {@link isPrune} function.
*
* @template T Type of the input value
* @returns A reusable `isPrune` function
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare function createAssertPrune<T extends object>(): (input: T) => T;
/**
* Creates a reusable {@link isPrune} function.
*
* @danger You have to specify the generic argument `T`
* @return Nothing until specifying the generic argument `T`
* @throws compile error
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare function createIsPrune(): never;
/**
* Creates a resuable {@link isPrune} function.
*
* @template T Type of the input value
* @returns A reusable `isPrune` function
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare function createIsPrune<T extends object>(): (input: T) => input is T;
/**
* Creates a reusable {@link validatePrune} function.
*
* @danger You have to specify the generic argument `T`
* @return Nothing until specifying the generic argument `T`
* @throws compile error
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare function createValidatePrune(): never;
/**
* Creates a resuable {@link validatePrune} function.
*
* @template T Type of the input value
* @returns A reusable `validatePrune` function
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare function createValidatePrune<T extends object>(): (input: T) => IValidation<T>;

@@ -28,3 +28,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.createPrune = exports.createValidateStringify = exports.createIsStringify = exports.createAssertStringify = exports.createStringify = exports.createValidateParse = exports.createAssertParse = exports.createIsParse = exports.createValidateEquals = exports.createEquals = exports.createAssertEquals = exports.createValidate = exports.createIs = exports.createAssertType = exports.createAssert = exports.prune = exports.metadata = exports.validateStringify = exports.isStringify = exports.assertStringify = exports.stringify = exports.validateParse = exports.isParse = exports.assertParse = exports.application = exports.validateEquals = exports.equals = exports.assertEquals = exports.validate = exports.is = exports.assertType = exports.assert = void 0;
exports.createValidatePrune = exports.createIsPrune = exports.createAssertPrune = exports.createPrune = exports.createValidateStringify = exports.createIsStringify = exports.createAssertStringify = exports.createStringify = exports.createValidateParse = exports.createAssertParse = exports.createIsParse = exports.createValidateEquals = exports.createEquals = exports.createAssertEquals = exports.createValidate = exports.createIs = exports.createAssertType = exports.createAssert = exports.validatePrune = exports.isPrune = exports.assertPrune = exports.prune = exports.metadata = exports.validateStringify = exports.isStringify = exports.assertStringify = exports.stringify = exports.validateParse = exports.isParse = exports.assertParse = exports.application = exports.validateEquals = exports.equals = exports.assertEquals = exports.validate = exports.is = exports.assertType = exports.assert = void 0;
var _every_1 = require("./functional/$every");

@@ -298,3 +298,2 @@ var _guard_1 = require("./functional/$guard");

prune.is_between = _is_between_1.$is_between;
prune.rest = _rest_1.$rest;
function throws(props) {

@@ -305,2 +304,39 @@ throw new TypeGuardError_1.TypeGuardError(__assign(__assign({}, props), { method: "typia.prune" }));

})(prune = exports.prune || (exports.prune = {}));
function assertPrune() {
halt("assertPrune");
}
exports.assertPrune = assertPrune;
(function (assertPrune) {
assertPrune.is_uuid = _is_uuid_1.$is_uuid;
assertPrune.is_email = _is_email_1.$is_email;
assertPrune.is_url = _is_url_1.$is_url;
assertPrune.is_ipv4 = _is_ipv4_1.$is_ipv4;
assertPrune.is_ipv6 = _is_ipv6_1.$is_ipv6;
assertPrune.is_between = _is_between_1.$is_between;
assertPrune.join = _join_1.$join;
assertPrune.every = _every_1.$every;
assertPrune.guard = (0, _guard_1.$guard)("typia.assertPrune");
})(assertPrune = exports.assertPrune || (exports.assertPrune = {}));
function isPrune() {
halt("isPrune");
}
exports.isPrune = isPrune;
(function (isPrune) {
isPrune.is_uuid = _is_uuid_1.$is_uuid;
isPrune.is_email = _is_email_1.$is_email;
isPrune.is_url = _is_url_1.$is_url;
isPrune.is_ipv4 = _is_ipv4_1.$is_ipv4;
isPrune.is_ipv6 = _is_ipv6_1.$is_ipv6;
isPrune.is_between = _is_between_1.$is_between;
function throws(props) {
throw new TypeGuardError_1.TypeGuardError(__assign(__assign({}, props), { method: "typia.prune" }));
}
isPrune.throws = throws;
})(isPrune = exports.isPrune || (exports.isPrune = {}));
function validatePrune() {
halt("validatePrune");
}
exports.validatePrune = validatePrune;
Object.assign(validatePrune, prune);
Object.assign(validatePrune, validate);
function createAssert() {

@@ -381,2 +417,17 @@ halt("createAssert");

Object.assign(createPrune, prune);
function createAssertPrune() {
halt("createAssertPrune");
}
exports.createAssertPrune = createAssertPrune;
Object.assign(createAssertPrune, assertPrune);
function createIsPrune() {
halt("createIsPrune");
}
exports.createIsPrune = createIsPrune;
Object.assign(createIsPrune, isPrune);
function createValidatePrune() {
halt("createValidatePrune");
}
exports.createValidatePrune = createValidatePrune;
Object.assign(createValidatePrune, validatePrune);
function halt(name) {

@@ -383,0 +434,0 @@ throw new Error("Error on typia.".concat(name, "(): no transform has been configured. Configure the \"tsconfig.json\" file following the [README.md#setup](https://github.com/samchon/typia#setup)"));

2

lib/programmers/internal/feature_object_entries.d.ts
import ts from "typescript";
import { MetadataObject } from "../../metadata/MetadataObject";
import { FeatureProgrammer } from "../FeatureProgrammer";
export declare const feature_object_entries: <Output extends ts.ConciseBody>(config: Pick<FeatureProgrammer.IConfig<Output>, "path" | "trace" | "decoder">) => (obj: MetadataObject) => (input: ts.Expression) => {
export declare const feature_object_entries: <Output extends ts.ConciseBody>(config: Pick<FeatureProgrammer.IConfig<Output>, "path" | "decoder" | "trace">) => (obj: MetadataObject) => (input: ts.Expression) => {
input: ts.Identifier | ts.ElementAccessExpression | ts.PropertyAccessExpression;

@@ -6,0 +6,0 @@ key: import("../../metadata/Metadata").Metadata;

@@ -168,3 +168,3 @@ "use strict";

});
var value = function (v) {
var converter = function (v) {
return typescript_1.default.isReturnStatement(v) || typescript_1.default.isBlock(v)

@@ -175,3 +175,3 @@ ? v

var statements = unions.map(function (u) {
return typescript_1.default.factory.createIfStatement(u.is(), value(u.value()));
return typescript_1.default.factory.createIfStatement(u.is(), converter(u.value()));
});

@@ -178,0 +178,0 @@ return typescript_1.default.factory.createBlock(statements, true);

@@ -9,5 +9,11 @@ "use strict";

var ApplicationTransformer_1 = require("./features/miscellaneous/ApplicationTransformer");
var AssertPruneTransformer_1 = require("./features/miscellaneous/AssertPruneTransformer");
var CreateAssertPruneTransformer_1 = require("./features/miscellaneous/CreateAssertPruneTransformer");
var CreateIsPruneTransformer_1 = require("./features/miscellaneous/CreateIsPruneTransformer");
var CreatePruneTransformer_1 = require("./features/miscellaneous/CreatePruneTransformer");
var CreateValidatePruneTransformer_1 = require("./features/miscellaneous/CreateValidatePruneTransformer");
var IsPruneTransformer_1 = require("./features/miscellaneous/IsPruneTransformer");
var MetadataTransformer_1 = require("./features/miscellaneous/MetadataTransformer");
var PruneTransformer_1 = require("./features/miscellaneous/PruneTransformer");
var ValidatePruneTransformer_1 = require("./features/miscellaneous/ValidatePruneTransformer");
var AssertParseTransformer_1 = require("./features/parsers/AssertParseTransformer");

@@ -71,2 +77,5 @@ var CreateAssertParseTransformer_1 = require("./features/parsers/CreateAssertParseTransformer");

prune: function () { return PruneTransformer_1.PruneTransformer.transform; },
assertPrune: function () { return AssertPruneTransformer_1.AssertPruneTransformer.transform; },
isPrune: function () { return IsPruneTransformer_1.IsPruneTransformer.transform; },
validatePrune: function () { return ValidatePruneTransformer_1.ValidatePruneTransformer.transform; },
createAssert: function () { return CreateAssertTransformer_1.CreateAssertTransformer.transform(false); },

@@ -87,3 +96,6 @@ createAssertType: function () { return CreateAssertTransformer_1.CreateAssertTransformer.transform(false); },

createPrune: function () { return CreatePruneTransformer_1.CreatePruneTransformer.transform; },
createAssertPrune: function () { return CreateAssertPruneTransformer_1.CreateAssertPruneTransformer.transform; },
createIsPrune: function () { return CreateIsPruneTransformer_1.CreateIsPruneTransformer.transform; },
createValidatePrune: function () { return CreateValidatePruneTransformer_1.CreateValidatePruneTransformer.transform; },
};
//# sourceMappingURL=CallExpressionTransformer.js.map
{
"name": "typia",
"version": "3.5.0-dev.20230211",
"version": "3.5.0-dev.20230212",
"description": "Superfast runtime validators with only one line",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -25,2 +25,9 @@ # Typia

// +) stringify, isStringify, validateStringify
// MISC
export function random<T>(): T;
export function clone<T>(input: T): Primitive<T>;
export function prune<T extends object>(input: T): void;
// +) isClone, assertClone, validateClone
// +) isPrune, assertPrune, validatePrune
```

@@ -27,0 +34,0 @@

@@ -832,4 +832,4 @@ import { $every } from "./functional/$every";

*
* For reference, this `typia.stringify()` does not validate the input value type. It
* just believes that the input value is following the type `T`. Therefore, if you
* For reference, this `typia.stringify()` does not validate the input value type.
* It just believes that the input value is following the type `T`. Therefore, if you
* can't ensure the input value type, it would be better to call one of below functions

@@ -994,3 +994,3 @@ * instead.

* (JavaScript Object Notation) string, with type checking.
*
*f
* In such reason, when `input` value is not matched with the type `T`, it returns

@@ -1117,4 +1117,13 @@ * `null` value. Otherwise, there's no problem on the `input` value, JSON string would

*
* For reference, this `typia.prune()` function does not validate the input value type.
* It just believes that the input value is following the type `T`. Therefore, if you
* can't ensure the input value type, it would better to call one of below functions
* instead.
*
* - {@link assertPrune}
* - {@link isPrune}
* - {@link validatePrune}
*
* @template T Type of the input value
* @param input target instance to prune
* @param input Target instance to prune
*

@@ -1143,3 +1152,2 @@ * @author Jeongho Nam - https://github.com/samchon

export const rest = $rest;
export function throws(

@@ -1155,2 +1163,176 @@ props: Pick<TypeGuardError.IProps, "expected" | "value">,

/**
* Prune, erase superfluous properties, with type assertion.
*
* `typia.assertPrune()` is a combination function of {@link assert} and {@link prune}.
* Therefore, it removes every superfluous properties from the `input` object including
* nested objects, with type assertion.
*
* In such reason, when `input` value is not matched with the type `T`, it throws an
* {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, its
* every superfluous properties would be removed, including nested objects.
*
* @template T Type of the input value
* @param input Target instance to assert and prune
*
* @author Jeongho Nam - https://github.com/samchon
*/
export function assertPrune<T>(input: T): T;
/**
* Prune, erase superfluous properties, with type assertion.
*
* `typia.assertPrune()` is a combination function of {@link assert} and {@link prune}.
* Therefore, it removes every superfluous properties from the `input` object including
* nested objects, with type assertion.
*
* In such reason, when `input` value is not matched with the type `T`, it throws an
* {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, its
* every superfluous properties would be removed, including nested objects.
*
* @template T Type of the input value
* @param input Target instance to assert and prune
*
* @author Jeongho Nam - https://github.com/samchon
*/
export function assertPrune<T>(input: unknown): T;
/**
* @internal
*/
export function assertPrune<T>(): unknown {
halt("assertPrune");
}
/**
* @internal
*/
export namespace assertPrune {
export const is_uuid = $is_uuid;
export const is_email = $is_email;
export const is_url = $is_url;
export const is_ipv4 = $is_ipv4;
export const is_ipv6 = $is_ipv6;
export const is_between = $is_between;
export const join = $join;
export const every = $every;
export const guard = $guard("typia.assertPrune");
}
/**
* Prune, erase superfluous properties, with type checking.
*
* `typia.assertPrune()` is a combination function of {@link is} and {@link prune}.
* Therefore, it removes every superfluous properties from the `input` object including
* nested objects, with type checking.
*
* In such reason, when `input` value is not matched with the type `T`, it returns
* `false` value. Otherwise, there's no problem on the `input` value, it returns
* `true` after removing every superfluous properties, including nested objects.
*
* @template T Type of the input value
* @param input Target instance to check and prune
* @returns Whether the parametric value is following the type `T` or not
*
* @author Jeongho Nam - https://github.com/samchon
*/
export function isPrune<T>(input: T): input is T;
/**
* Prune, erase superfluous properties, with type checking.
*
* `typia.assertPrune()` is a combination function of {@link is} and {@link prune}.
* Therefore, it removes every superfluous properties from the `input` object including
* nested objects, with type checking.
*
* In such reason, when `input` value is not matched with the type `T`, it returns
* `false` value. Otherwise, there's no problem on the `input` value, it returns
* `true` after removing every superfluous properties, including nested objects.
*
* @template T Type of the input value
* @param input Target instance to check and prune
* @returns Whether the parametric value is following the type `T` or not
*
* @author Jeongho Nam - https://github.com/samchon
*/
export function isPrune<T>(input: unknown): input is T;
/**
* @internal
*/
export function isPrune(): never {
halt("isPrune");
}
/**
* @internal
*/
export namespace isPrune {
export const is_uuid = $is_uuid;
export const is_email = $is_email;
export const is_url = $is_url;
export const is_ipv4 = $is_ipv4;
export const is_ipv6 = $is_ipv6;
export const is_between = $is_between;
export function throws(
props: Pick<TypeGuardError.IProps, "expected" | "value">,
): void {
throw new TypeGuardError({
...props,
method: "typia.prune",
});
}
}
/**
* Prune, erase superfluous properties, with type validation.
*
* `typia.validatePrune()` is a combination function of {@link validate} and {@link prune}.
* Therefore, it removes every superfluous properties from the `input` object including
* nested objects, with type validation.
*
* In such reason, when `input` value is not matched with the type `T`, it returns
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
* no problem on the `input` value, it returns {@link IValidation.ISucess} value after
* removing every superfluous properties, including nested objects.
*
* @template T Type of the input value
* @param input Target instance to validate and prune
* @returns Validation result
*
* @author Jeongho Nam - https://github.com/samchon
*/
export function validatePrune<T>(input: T): IValidation<T>;
/**
* Prune, erase superfluous properties, with type validation.
*
* `typia.validatePrune()` is a combination function of {@link validate} and {@link prune}.
* Therefore, it removes every superfluous properties from the `input` object including
* nested objects, with type validation.
*
* In such reason, when `input` value is not matched with the type `T`, it returns
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
* no problem on the `input` value, it returns {@link IValidation.ISucess} value after
* removing every superfluous properties, including nested objects.
*
* @template T Type of the input value
* @param input Target instance to validate and prune
* @returns Validation result
*
* @author Jeongho Nam - https://github.com/samchon
*/
export function validatePrune<T>(input: unknown): IValidation<T>;
/**
* @internal
*/
export function validatePrune<T>(): IValidation<T> {
halt("validatePrune");
}
Object.assign(validatePrune, prune);
Object.assign(validatePrune, validate);
/* ===========================================================

@@ -1620,4 +1802,95 @@ FACTORY FUNCTIONS

/**
* Creates a reusable {@link isPrune} function.
*
* @danger You have to specify the generic argument `T`
* @return Nothing until specifying the generic argument `T`
* @throws compile error
*
* @author Jeongho Nam - https://github.com/samchon
*/
export function createAssertPrune(): never;
/**
* Creates a resuable {@link isPrune} function.
*
* @template T Type of the input value
* @returns A reusable `isPrune` function
*
* @author Jeongho Nam - https://github.com/samchon
*/
export function createAssertPrune<T extends object>(): (input: T) => T;
/**
* @internal
*/
export function createAssertPrune<T extends object>(): (input: T) => T {
halt("createAssertPrune");
}
Object.assign(createAssertPrune, assertPrune);
/**
* Creates a reusable {@link isPrune} function.
*
* @danger You have to specify the generic argument `T`
* @return Nothing until specifying the generic argument `T`
* @throws compile error
*
* @author Jeongho Nam - https://github.com/samchon
*/
export function createIsPrune(): never;
/**
* Creates a resuable {@link isPrune} function.
*
* @template T Type of the input value
* @returns A reusable `isPrune` function
*
* @author Jeongho Nam - https://github.com/samchon
*/
export function createIsPrune<T extends object>(): (input: T) => input is T;
/**
* @internal
*/
export function createIsPrune<T extends object>(): (input: T) => input is T {
halt("createIsPrune");
}
Object.assign(createIsPrune, isPrune);
/**
* Creates a reusable {@link validatePrune} function.
*
* @danger You have to specify the generic argument `T`
* @return Nothing until specifying the generic argument `T`
* @throws compile error
*
* @author Jeongho Nam - https://github.com/samchon
*/
export function createValidatePrune(): never;
/**
* Creates a resuable {@link validatePrune} function.
*
* @template T Type of the input value
* @returns A reusable `validatePrune` function
*
* @author Jeongho Nam - https://github.com/samchon
*/
export function createValidatePrune<T extends object>(): (
input: T,
) => IValidation<T>;
/**
* @internal
*/
export function createValidatePrune<T extends object>(): (
input: T,
) => IValidation<T> {
halt("createValidatePrune");
}
Object.assign(createValidatePrune, validatePrune);
/**
* @internal
*/
function halt(name: string): never {

@@ -1624,0 +1897,0 @@ throw new Error(

@@ -148,8 +148,11 @@ import ts from "typescript";

//----
const value = (v: ts.Expression | ts.Block | ts.ReturnStatement) =>
const converter = (
v: ts.Expression | ts.Block | ts.ReturnStatement,
) =>
ts.isReturnStatement(v) || ts.isBlock(v)
? v
: ts.factory.createExpressionStatement(v);
const statements: ts.Statement[] = unions.map((u) =>
ts.factory.createIfStatement(u.is(), value(u.value())),
ts.factory.createIfStatement(u.is(), converter(u.value())),
);

@@ -156,0 +159,0 @@ return ts.factory.createBlock(statements, true);

@@ -6,5 +6,11 @@ import path from "path";

import { ApplicationTransformer } from "./features/miscellaneous/ApplicationTransformer";
import { AssertPruneTransformer } from "./features/miscellaneous/AssertPruneTransformer";
import { CreateAssertPruneTransformer } from "./features/miscellaneous/CreateAssertPruneTransformer";
import { CreateIsPruneTransformer } from "./features/miscellaneous/CreateIsPruneTransformer";
import { CreatePruneTransformer } from "./features/miscellaneous/CreatePruneTransformer";
import { CreateValidatePruneTransformer } from "./features/miscellaneous/CreateValidatePruneTransformer";
import { IsPruneTransformer } from "./features/miscellaneous/IsPruneTransformer";
import { MetadataTransformer } from "./features/miscellaneous/MetadataTransformer";
import { PruneTransformer } from "./features/miscellaneous/PruneTransformer";
import { ValidatePruneTransformer } from "./features/miscellaneous/ValidatePruneTransformer";
import { AssertParseTransformer } from "./features/parsers/AssertParseTransformer";

@@ -103,2 +109,5 @@ import { CreateAssertParseTransformer } from "./features/parsers/CreateAssertParseTransformer";

prune: () => PruneTransformer.transform,
assertPrune: () => AssertPruneTransformer.transform,
isPrune: () => IsPruneTransformer.transform,
validatePrune: () => ValidatePruneTransformer.transform,

@@ -132,2 +141,5 @@ //----

createPrune: () => CreatePruneTransformer.transform,
createAssertPrune: () => CreateAssertPruneTransformer.transform,
createIsPrune: () => CreateIsPruneTransformer.transform,
createValidatePrune: () => CreateValidatePruneTransformer.transform,
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc