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

@d3vtool/utils

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@d3vtool/utils

A collection of utility functions designed to simplify common tasks in your application.

  • 4.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

DevTool Utils

A collection of utility functions designed to simplify common tasks in your application

Installation

To install, you can use npm or yarn:

npm install @d3vtool/utils
or
yarn add @d3vtool/utils

Usage

  1. String Validation
import { Validator, type VInfer } from "@d3vtool/utils";

const usernameSchema = Validator.string().min(5);

type Username = VInfer<typeof usernameSchema>;

const username: Username = "popHero83";

const errors = usernameSchema.validateSafely(username)

console.log(errors);
  1. Number Validation
import { Validator, type VInfer } from "@d3vtool/utils";

const phoneSchema = Validator.number().min(1).max(10);

type Phone = VInfer<typeof phoneSchema>;

const phone: Phone = 1234567890;

const errors = phoneSchema.validateSafely(phone)

console.log(errors);
  1. Simple Object Validation
import { Validator, type VInfer } from "@d3vtool/utils";

const schema = Validator.object({
  name: Validator.string().min(5),
  email: Validator.string().email(),
});

type schema = VInfer<typeof schema>;

const schemaObj: schema = {
  name: "Sudhanshu",
  email: "email@email.abc"
}

const errors = schema.validateSafely(schemaObj);
console.log(errors);

Keywords

FAQs

Package last updated on 27 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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