Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.
/ Uberdeno Public archive

This repository contains some code snippets I use in every Deno project, with the power of Deno I can import it through the URL!

License

Notifications You must be signed in to change notification settings

Schotsl/Uberdeno

Repository files navigation

Uberdeno

This repository contains some code snippets I use in every Deno project, with the power of Deno I can import it through the URL! Every import works fine within Deno deploy for almost instant deployments.

Validation

Strings string.ts

validateString(input: unknown, label: string, required = true)

Valid input: "This is a test"
Invalid input: true

validateTimestamp(input: unknown, label: string, required = true)

Valid input: "2021-11-29T15:46:12.367Z"
Invalid input: "29/11/2021"

validateEmail(input: unknown, label: string, required = true)

Valid input: "email@example.com"
Invalid input: "email.example.com"

validateTime(input: unknown, label: string, required = true)

Valid input: "23:59"
Invalid input: "24:00"

validateUUID(input: unknown, label: string, required = true)

Valid input: "272e1c01-237a-48e3-b88a-96a6fe9d3edb"
Invalid input: "123"

validateVarchar(input: unknown, label: string, required = true)

Valid input: "This string is longer than 2 characters but shorter than 256"
Invalid input: "Hi"

Numbers number.ts

validateNumber(input: unknown, label: string, required = true)

Valid input: 1
Invalid input: "1"

validateTiny(input: unknown, label: string, required = true)

Valid input: -128, 127
Invalid input: -129, 128

validateSmall(input: unknown, label: string, required = true)

Valid input: -32768, 32767
Invalid input: -32769, 32768

validateInt(input: unknown, label: string, required = true)

Valid input: -2147483648, 2147483647
Invalid input: -2147483649, 2147483648

Booleans boolean.ts

validateBoolean(input: unknown, label: string, required = true)

Valid input: true
Invalid input: "true"

About

This repository contains some code snippets I use in every Deno project, with the power of Deno I can import it through the URL!

Resources

License

Stars

Watchers

Forks

Packages

No packages published