Skip to content

Commit

Permalink
Close ryoppippi/unplugin-typia#335: change $ prefix to _ for Svelte.
Browse files Browse the repository at this point in the history
As Svelte-Kit prohibits `$` starting instance name, I've changed typia v7 to utilize `_` starting functions internally generated.
  • Loading branch information
samchon committed Oct 22, 2024
1 parent 6943536 commit 513b92a
Show file tree
Hide file tree
Showing 120 changed files with 891 additions and 879 deletions.
2 changes: 1 addition & 1 deletion benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@
"suppress-warnings": "^1.0.2",
"tstl": "^3.0.0",
"uuid": "^9.0.1",
"typia": "../typia-7.0.0-dev.20241022-3.tgz"
"typia": "../typia-7.0.0-dev.20241022-4.tgz"
}
}
2 changes: 1 addition & 1 deletion errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"typescript": "^5.3.2"
},
"dependencies": {
"typia": "../typia-7.0.0-dev.20241022-3.tgz"
"typia": "../typia-7.0.0-dev.20241022-4.tgz"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typia",
"version": "7.0.0-dev.20241022-3",
"version": "7.0.0-dev.20241022-4",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/typescript-json/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript-json",
"version": "7.0.0-dev.20241022-3",
"version": "7.0.0-dev.20241022-4",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -64,7 +64,7 @@
},
"homepage": "https://typia.io",
"dependencies": {
"typia": "7.0.0-dev.20241022-3"
"typia": "7.0.0-dev.20241022-4"
},
"peerDependencies": {
"typescript": ">=4.8.0 <5.7.0"
Expand Down
4 changes: 2 additions & 2 deletions src/factories/ExpressionFactory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ts from "typescript";

import { $randomFormatUuid } from "../internal/$randomFormatUuid";
import { _randomFormatUuid } from "../internal/_randomFormatUuid";

export namespace ExpressionFactory {
export const number = (value: number) =>
Expand Down Expand Up @@ -134,7 +134,7 @@ export namespace ExpressionFactory {
script: string,
) => {
const file: ts.SourceFile = ts.createSourceFile(
`${$randomFormatUuid()}.ts`,
`${_randomFormatUuid()}.ts`,
script,
ts.ScriptTarget.ESNext,
true,
Expand Down
2 changes: 0 additions & 2 deletions src/internal/$httpParameterReadString.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/internal/$isBetween.ts

This file was deleted.

13 changes: 0 additions & 13 deletions src/internal/$notationCamel.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/internal/$notationPascal.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/internal/$randomBigint.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/internal/$randomBoolean.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/internal/$randomFormatHostname.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/internal/$randomFormatIdnEmail.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/internal/$randomFormatIdnHostname.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/internal/$randomFormatIri.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/internal/$randomFormatIriReference.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/internal/$randomFormatJsonPointer.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/internal/$randomFormatPassword.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/internal/$randomFormatRelativeJsonPointer.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/internal/$randomFormatUri.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/internal/$randomFormatUriReference.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/internal/$randomFormatUriTemplate.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/internal/$randomPick.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface $IProtobufWriter {
export interface _IProtobufWriter {
bool(value: boolean): void;
int32(value: number): void;
sint32(value: number): void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ProtobufWire } from "../programmers/helpers/ProtobufWire";
import { Singleton } from "../utils/Singleton";

/// @reference https://github.com/piotr-oles/as-proto/blob/main/packages/as-proto/assembly/internal/FixedReader.ts
export class $ProtobufReader {
export class _ProtobufReader {
/**
* Read buffer
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { $IProtobufWriter } from "./$IProtobufWriter";
import { _IProtobufWriter } from "./_IProtobufWriter";

/// @reference https://github.com/piotr-oles/as-proto/blob/main/packages/as-proto/assembly/internal/FixedSizer.ts
export class $ProtobufSizer implements $IProtobufWriter {
export class _ProtobufSizer implements _IProtobufWriter {
/**
* Total length.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Singleton } from "../utils/Singleton";

import { $IProtobufWriter } from "./$IProtobufWriter";
import { $ProtobufSizer } from "./$ProtobufSizer";
import { _IProtobufWriter } from "./_IProtobufWriter";
import { _ProtobufSizer } from "./_ProtobufSizer";

/// @reference https://github.com/piotr-oles/as-proto/blob/main/packages/as-proto/assembly/internal/FixedWriter.ts
export class $ProtobufWriter implements $IProtobufWriter {
export class _ProtobufWriter implements _IProtobufWriter {
/**
* Related sizer
*/
private readonly sizer: $ProtobufSizer;
private readonly sizer: _ProtobufSizer;

/**
* Current pointer.
Expand All @@ -30,7 +30,7 @@ export class $ProtobufWriter implements $IProtobufWriter {
*/
private varlenidx: number;

constructor(sizer: $ProtobufSizer) {
constructor(sizer: _ProtobufSizer) {
this.sizer = sizer;
this.buf = new Uint8Array(sizer.len);
this.view = new DataView(this.buf.buffer);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $accessExpressionAsString = (str: string): string =>
export const _accessExpressionAsString = (str: string): string =>
variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;

const variable = (str: string): boolean =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TypeGuardError } from "../TypeGuardError";

export const $assertGuard = (
export const _assertGuard = (
exceptionable: boolean,
props: TypeGuardError.IProps,
factory?: (props: TypeGuardError.IProps) => Error,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TypeGuardError } from "../TypeGuardError";

export const $functionalTypeGuardErrorFactory = (p: TypeGuardError.IProps) =>
export const _functionalTypeGuardErrorFactory = (p: TypeGuardError.IProps) =>
new TypeGuardError(p);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpFormDataReadArray = (
export const _httpFormDataReadArray = (
input: any[],
alternative: null | undefined,
) => (input.length ? input : alternative);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpFormDataReadBigint = (
export const _httpFormDataReadBigint = (
input: string | File | null,
): bigint | null | undefined =>
input instanceof File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpFormDataReadBlob = (
export const _httpFormDataReadBlob = (
input: string | Blob | null,
): Blob | null | undefined =>
input instanceof Blob
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpFormDataReadBoolean = (
export const _httpFormDataReadBoolean = (
input: string | File | null,
): boolean | null | undefined =>
input instanceof File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpFormDataReadFile = (
export const _httpFormDataReadFile = (
input: string | File | null,
): File | null | undefined =>
input instanceof File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpFormDataReadNumber = (
export const _httpFormDataReadNumber = (
input: string | File | null,
): number | null | undefined =>
input instanceof File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpFormDataReadString = (
export const _httpFormDataReadString = (
input: string | File | null,
): string | null | undefined =>
input instanceof File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpHeaderReadBigint = (value: string | undefined) =>
export const _httpHeaderReadBigint = (value: string | undefined) =>
value !== undefined ? toBigint(value) : undefined;

const toBigint = (str: string): bigint | string => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpHeaderReadBoolean = (value: string | undefined) =>
export const _httpHeaderReadBoolean = (value: string | undefined) =>
value !== undefined
? value === "true"
? true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpHeaderReadNumber = (value: string | undefined) =>
export const _httpHeaderReadNumber = (value: string | undefined) =>
value !== undefined ? toNumber(value) : undefined;

const toNumber = (str: string): number | string => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpParameterReadBigint = (value: string) =>
export const _httpParameterReadBigint = (value: string) =>
value !== "null" ? toBigint(value) : null;

const toBigint = (str: string): bigint | string => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpParameterReadBoolean = (value: string) =>
export const _httpParameterReadBoolean = (value: string) =>
value !== "null"
? value === "true" || value === "1"
? true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpParameterReadNumber = (value: string) =>
export const _httpParameterReadNumber = (value: string) =>
value !== "null" ? toNumber(value) : null;

const toNumber = (str: string): number | string => {
Expand Down
2 changes: 2 additions & 0 deletions src/internal/_httpParameterReadString.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const _httpParameterReadString = (value: string) =>
value !== "null" ? value : null;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpQueryParseURLSearchParams = (
export const _httpQueryParseURLSearchParams = (
input: string | URLSearchParams,
) => {
if (typeof input === "string") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpQueryReadArray = (
export const _httpQueryReadArray = (
input: any[],
alternative: null | undefined,
) => (input.length ? input : alternative);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpQueryReadBigint = (
export const _httpQueryReadBigint = (
str: string | null,
): bigint | null | undefined =>
!!str?.length ? (str === "null" ? null : (toBigint(str) as any)) : undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpQueryReadBoolean = (
export const _httpQueryReadBoolean = (
str: string | null,
): boolean | null | undefined =>
str === null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpQueryReadNumber = (
export const _httpQueryReadNumber = (
str: string | null,
): number | null | undefined =>
!!str?.length ? (str === "null" ? null : (toNumber(str) as any)) : undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $httpQueryReadString = (
export const _httpQueryReadString = (
str: string | null,
): string | null | undefined =>
str === null ? undefined : str === "null" ? null : str;
2 changes: 2 additions & 0 deletions src/internal/_isBetween.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const _isBetween = (value: number, minimum: number, maximum: number) =>
minimum <= value && value <= maximum;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const $isBigintString = (str: string): boolean => {
export const _isBigintString = (str: string): boolean => {
try {
BigInt(str);
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TypeGuardError } from "../TypeGuardError";

export const $jsonStringifyNumber = (value: number): number => {
export const _jsonStringifyNumber = (value: number): number => {
if (isFinite(value) === false)
throw new TypeGuardError({
method: "typia.json.stringify",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const $jsonStringifyRest = (str: string): string => {
export const _jsonStringifyRest = (str: string): string => {
return str.length === 2 ? "" : "," + str.substring(1, str.length - 1);
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @reference https://github.com/fastify/fast-json-stringify/blob/master/lib/serializer.js
* @blog https://dev.to/samchon/good-bye-typescript-is-ancestor-of-typia-20000x-faster-validator-49fi
*/
export const $jsonStringifyString = (str: string): string => {
export const _jsonStringifyString = (str: string): string => {
const len = str.length;
let result = "";
let last = -1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const $jsonStringifyTail = (str: string): string =>
export const _jsonStringifyTail = (str: string): string =>
str[str.length - 1] === "," ? str.substring(0, str.length - 1) : str;
Loading

0 comments on commit 513b92a

Please sign in to comment.