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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ai-daily

v1.0.10

Published

Just making our development easier :)

Readme

About ai-daily Library

Various utilities of use to both the front-end and back-end modules by AI-DAILY Team for AI-DAILY Team

Breakdown of the Library

Method

A type that defines HTTP request methods, including:

  • get
  • post,
  • put,
  • delete.

Usage:

import { Method } from 'ai-daily';

const method: Method = 'get';

ErrorType

A type that defines the types of errors that can be returned from a query, such as:

  • QueryError
  • ServerError
  • DatabaseError
  • UnhandledError
  • TokenError

Usage:

import { ErrorType } from 'ai-daily';

// Simulating the error
const errorType: ErrorType = 'ServerError';

switch (errorType) {
    case "QueryError":
        console.error("Query error: Your query is malformed or invalid");
        break;
    case "ServerError":
        console.error("Server error: The server is down or unreachable");
        break;
    // rest of the errors
    default:
        console.error("Unhandled error: Oops, something went wrong");
        break;
}

ResultError

A type that represents an error returned from a query, including a message and error type

Usage:

import { ResultError } from 'ai-daily';

const error: ResultError = {
  message: 'Oops, something went wrong!',
  type: 'QueryError'
};

ListQueryParams

A type that defines parameters for list or get queries, including:

  • filter,
  • for,
  • sort,
  • order (asc or desc),

Usage:

import { ResultError } from 'ai-daily';

const queryParameters: ListQueryParams = {
  filter: 'keyword',
  for: 'user',
  sort: 'name',
  order: 'asc',
};

Result

A type that represents the result of a query of type T. It includes:

  • data
  • error
  • success properties

Usage:

import { ResultError } from 'ai-daily';

const result: Result<number> = {
  data: 69,
  error: null,
  success: true
};

Article

A type that defines a full article scrapped from the news outlets (we use BBC), including various properties like:

  • id
  • name
  • author
  • category
  • body
  • source_url
  • cover_url
  • retrieved_date
  • publication_date
  • image_gen

Usage:

import { Article } from 'ai-daily';

const article: Article = {
  id: 1,
  name: 'Can music help to deal with depression?',
  author: 'Mr Cat',
  category: 'Health',
  body: ['Music is a great way to deal with depression!'],
  source_url: 'https://youtu.be/fMLGmcv7ALI?si=1Qt61N6uPzWJBGf6',
  cover_url: 'https://external-preview.redd.it/xgJatj45MR6abvnjnpstnOp5XUDcsEd8D3R_zOLuAVc.jpg?width=640&crop=smart&auto=webp&s=c64edcde5c4384279a53d9b7afdfe75fc27f2230',
  retrieved_date: '2023-10-23T04:31:18Z',
  publication_date: '2023-10-23T04:31:18Z',
  image_gen: true
};

ArticleResult

A type that represents the result of a full article query, including:

  • data
  • error
  • success properties.

Usage:

import { ArticleResult } from 'ai-daily';

const articleResult: ArticleResult = {
  data: article,
  error: null,
  success: true
};

ListedArticle

A type that defines an article returned in a list query, omitting the body property.

import { ListedArticle } from 'ai-daily';

const listedArticle: ListedArticle = {
  id: 1,
  name: 'Ia d-aici ca n-ai servici',
  author: 'Sandu Ciorba',
  category: 'Music',
  source_url: 'https://youtu.be/A3g-lPWvXDI?si=s4AScrEiLz7AOa1k',
  retrieved_date: '2023-10-23T04:31:18Z',
  image_gen: true
};

ListedArticleResult

A type that represents the result of a listed article query, including:

  • data
  • error
  • success properties.
import { ListedArticleResult } from 'ai-daily';

const listedArticleResult: ListedArticleResult = {
  data: listedArticle,
  error: null,
  success: true
};

ArticleSummary

A type that defines a summary of the latest articles in each category.

import { ArticleSummary } from 'ai-daily';

const articleSummary: ArticleSummary = {
  Technology: [article], 
  Science: [article]
};

ArticleSummaryResult

A type that represents the result of an article summary query, including:

  • data
  • error
  • success properties.
import { ArticleSummary } from 'ai-daily';

const articleSummaryResult: ArticleSummaryResult = {
  data: articleSummary,
  error: null,
  success: true
};

Category

A type that defines a category of articles, including:

  • category's name
  • description

CategoryResult

A type that represents the result of a category query, including: data error success properties.

Usage:

import { Category, CategoryResult } from 'ai-daily';

const technologyCategory: Category = {
  category: 'Technology',
  description: 'News about technologies'
};

const successCategoryResult: CategoryResult = {
  data: technologyCategory,
  error: null,
  success: true
};

const errorCategoryResult: CategoryResult = {
  data: null,
  error: {
    message: 'Oops, category not found!',
    type: 'QueryError'
  },
  success: false
};

fromSnakeCase

Converts a string from snake_case to readable format

Usage:

import { fromSnakeCase } from 'ai-daily';

const readableString = fromSnakeCase('hello_world_this_is_a_test_string');

console.log(readableString); // hello world this is a test string

toSentenceCase

Just capitalizes the first letter of a string

Usage:

import { toSentenceCase } from 'ai-daily';

const sentence = toSentenceCase('hello world');

console.log(sentence); // Hello world

timestamp

It returns timestamp in "ISO 8601" format ("YYYY-MM-DDTHH:mm:ss.sssZ")

Usage:

import { timestamp } from 'ai-daily';

const currentTimestamp = timestamp();

console.log('Current Timestamp:', currentTimestamp); // 2023-10-23T12:34:56.789Z