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

design.email-db

v1.0.6

Published

<dl> <dt><a href="#getTemplates">getTemplates([page], [limit])</a> ⇒ <code>Promise.&lt;Object&gt;</code></dt> <dd><p>Retrieves a paginated list of templates from the database.</p> <p>This function connects to the database and fetches a specific page of te

Downloads

12

Readme

Functions

getTemplates([page], [limit]) ⇒ Promise.<Object>

Retrieves a paginated list of templates from the database.

This function connects to the database and fetches a specific page of templates, excluding their HTML content. It also returns the total count of templates available for pagination purposes. If there's an error during the database operation, the function throws an error with the relevant message.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to an object containing the pagination data and a list of templates. The returned object has the structure { page, limit, count, templates }.
Throws:

  • Error If there is an issue during the database operation, an error is thrown with the specific error message.

| Param | Type | Default | Description | | --- | --- | --- | --- | | [page] | number | 1 | The page number of the templates to retrieve. | | [limit] | number | 10 | The maximum number of templates to retrieve per page. |

getTemplatesByQuery(condition, [select], [limit]) ⇒ Promise.<Array>

Retrieves templates based on the specified query conditions.

Kind: global function
Returns: Promise.<Array> - A promise that resolves to an array of templates matching the conditions.
Throws:

  • Error If there is an error during database operation.

| Param | Type | Default | Description | | --- | --- | --- | --- | | condition | Object | | The query conditions to filter the templates. | | [select] | Object | null | | Specific fields to select in the returned documents. | | [limit] | number | null | | Limit on the number of templates to retrieve. |

getTemplate(id) ⇒ Promise.<Object>

Retrieves a specific template by its ID.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to an object containing the template data. Returns success status and data, or failure status and error message.

| Param | Type | Description | | --- | --- | --- | | id | string | The unique identifier of the template. |

deleteTemplate(id) ⇒ Promise.<Object>

Deletes a specific template by its ID.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to the deletion result. Returns the deleted data or an error message if failed.

| Param | Type | Description | | --- | --- | --- | | id | string | The unique identifier of the template to delete. |

deleteTemplates(ids) ⇒ Promise.<Object>

Deletes multiple templates based on their IDs.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to the result of the deletion operation. Indicates success or failure and includes data or error message.

| Param | Type | Description | | --- | --- | --- | | ids | Array.<string> | An array of template IDs to delete. |

updateTemplate(condition, data) ⇒ Promise.<Object>

Updates a template based on the given condition.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to the updated template document.
Throws:

  • Error If there is an error during the update operation.

| Param | Type | Description | | --- | --- | --- | | condition | Object | The conditions to find the template to update. | | data | Object | The data to be updated in the template. |

updateTemplateById(condition, data) ⇒ Promise.<Object>

Updates a specific template by its ID.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to the updated template document.
Throws:

  • Error If there is an error during the update operation.

| Param | Type | Description | | --- | --- | --- | | condition | Object | The condition to find the template (usually the ID). | | data | Object | The data to update in the template. |

updateManyTemplates(condition, updateData) ⇒ Promise.<Object>

Updates multiple templates based on the given condition.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to the result of the update operation.
Throws:

  • Error If there is an error during the update operation.

| Param | Type | Description | | --- | --- | --- | | condition | Object | The conditions to find the templates to update. | | updateData | Object | The data to be updated in the templates. |