Socket
Socket
Sign inDemoInstall

yoty

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    yoty

This package was created while working on another project and is designed to make things a little easier when you need to find something and return what you found.


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

YOTY

This package was created while working on another project and is designed to make things a little easier when you need to find something and return what you found.

Install

npm install yoty

Examination

This class can help when you need to find and return a value.

Using

Import:

const {Examination} = require("./yoty")

There are three static methods in Examination:

add(id, examination)

This method adds a new examinatio with the name specified in the id, examinatio is a callback function that should always return something, note that examinatio can not always be a callback function, it can also be a regular expression like /test/gm . Also, the examination callback function must have at least one parameter.

test(id, value)

This method performs an examination with the name specified in the id and returns the result of the examination, value is passed as a parameter to the callback function.

delete(id, callback)

Deletes the examination with the name specified in the id, and the callback is a function that will be executed in case of an error, it must have at least one.parameter.

Generation

Generates a token following the specified parameters.

Using

Import:

const {Generation} = require("./yoty")

There are three static methods in Generation:

token(max, block)

Returns a token with the length specified in the max parameter and blocks those values that were specified in the block array.

Textarea

I recommend not to use

More about Examination

If with Generation and Textarea everything plus or minus is clear, then with Examination you need a little bit of reverse engineering.

Let's create a simple examination that will look at the array and check if there is a value "examination":

// import Examination
const {Examination} = require("./yoty");

// Adding an Examination named "exa" based on a regular expression
Examination.add("exa", /exa/gm);
// Testing a new examination , I highly recommend that when adding a new examination, make a try-catch block in which the check should pass correctly.
try{
    console.log(Examination.test("exa", "exa"));
} catch(err){
    console.log(err);
}
// Adding a main examination
Examination.add("hasExa", (value)=>{
    return value.filter((value)=>{
        // We use the already added examination with the name "exa"
        return Examination.test("exa", value);
    })
})
// Testing a new examination
try{
    console.log(Examination.test("hasExa", ["exa", 1, "axe"]));
} catch(err){
    console.log(err);
}

I think it's more clear now

Keywords

FAQs

Last updated on 28 May 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc