npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yask

v1.0.1

Published

Best Cache.

Downloads

7

Readme

yask ~ Your Accessible Storage Knowledge

Documentation: yask Docs

License

Typescript Node Yarn Pnpm NPM

Information

  • 💻 Efficient and fast cache.
  • 🦋 Simple and easy to use.
  • :wrench: Yask CLI.

Important!

This package is in the test and debug phase, its use is recommended as long as you know what you are using, for people with no knowledge about caches its use is not recommended in this phase.

:wrench: Installation & Use CLI

npm i yask --save
pnpm add yask --save
yarn add yask --save

npx yask-cli init <folder-to-init-cache>

Why use YASK

:pushpin: Structure

Proximamente!

A simple structure but functional from any side you look at it.

:zap: Flexibility & Scalability

This cache is flexible, non-scalable and is specifically developed for large data management and can be used in any context.

:package: Cache

Its operation is based on an array that manages data within it, using methods as simple as Push, Delete, ForEach and more.

:clipboard: Important Notes:

Read the documentation please!

The errors and/or warnings shown in this documentation are errors/warns that can occur when running yask, they are only informative, a solution can be reached by reading the description of each error/warn.

Methods

Start cache

// Create the cache/ directory and create a file with any name and put the following
import { Cache } from 'yask';

export default new Cache();

// In another file you can import and use the cache without problem
import MyCache from 'path/to/cache/file'

MyCache.Add("Awesome yask cache", "Pointer Reference");

Note:

  • Cache: It is not necessary to create folders or files, you can use them within the same file, it is recommended only if you want to move it throughout the project.

Add

/**
 * @public
 * @param {ResolvableType} value - Value to add in to cache
 * @param {string} reference - Reference to find the pointer
 * @description Add value to cache
 * @returns {number}
 */

MyCache.Add("This value can be of several types", "Pointer Reference");

Note:

  • Pointer Reference: The reference of the pointer is necessary when searching for it, both in Predicates and in other methods, when doing push it is specified to create the pointer with its reference.

Delete

/**
 * @public
 * @param {string} Reference - Reference to find the pointer
 * @description Remove cache table
 * @returns {this}
 */

MyCache.Delete("Pointer Reference");

Edit

/**
 * @public
 * @param {ResolvableType} value - new value
 * @param {PredicateType<ResolvableType>} predicate 
 * @description Edit cached value
 */

MyCache.Edit("New value", (x) => x?.Reference === "Pointer Reference");

Note:

  • New value: It is necessary that the new value to be set coincides with the value to be edited.

Clear

/**
 * @public
 * @description clear cache
 * @returns {number}
 */

MyCache.Clear();

ForEach

/**
 * @public
 * @param {PredicateType<ResolvableType>} predicate 
 * @returns {void}
 */

MyCache.ForEach((x) => {
    if (x?.Reference === "Pointer Reference")
        x?.value = "Hello World!";
});

Find

/**
 * @public
 * @param {PredicateType<ResolvableType>} predicate 
 * @description Search for a value in the cache
 * @returns {ResolvableType}
 */

MyCache.Find((x) => x?.value === "Hello World!");

Exist

/**
 * @public
 * @param {PredicateType<ResolvableType>} predicate 
 * @description Check element exists in to cache by predicate
 * @returns {boolean}
 */

MyCache.Exist((x) => x?.value === "Hello World!");

All

/**
 * @public
 * @description Get all cache
 * @returns {StructureType[]}
 */

MyCache.All();

Size

/**
 * @public
 * @description Get size cache
 * @returns {number}
 */

MyCache.Size();

Check

/**
 * @public
 * @param predicate 
 * @description Check a condition for all tables in the cache
 * @returns {boolean}
 */

MyCache.Check((x) => x?.value != "Hello World!")

Note:

  • Use: The 'Check()' method is used to see if the 'predicate' is true in all tables in the cache.

:exclamation: Possible Errors:

  • (yask-01) The type of the value does not correspond to the new value. This error is because when you edit a value the types of both values (new, old) are not the same.
  • (yask-02) Two pointers cannot have the same reference. This error occurs because two pointers contain the same reference.
  • (yask-03) This pointer does not exist. This is because the pointer, value or reference was not found or not exist.
  • (yask-99) Unknown error. This error is unknown, it may be an unhandled error.

See more

Discord Documentation