New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

counterapi

Package Overview
Dependencies
Maintainers
0
Versions
435
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

counterapi

Counter API for your application

  • 1.113.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
40
decreased by-94.61%
Maintainers
0
Weekly downloads
 
Created
Source

logo

Downloads Check Version License

Documentation

Counter API Javascript Library

Check out our docs at https://counterapi.dev/.

How to use

Increase by Name

import {CounterAPI} from "counterapi";

const counter = new CounterAPI();

counter.up("test", "test").then((res) => {
    console.log(res)
})

Output

Counter {
  ID: 1,
  Name: 'test',
  Count: 15,
  UpdatedAt: '2023-03-27T13:33:51.315934+01:00',
  CreatedAt: '2023-03-26T21:46:18.624369+08:00'
}

Decrease by Name

import {CounterAPI} from "counterapi";

const counter = new CounterAPI();

counter.down("test", "test").then((res) => {
    console.log(res)
})

Output

Counter {
  ID: 1,
  Name: 'test',
  Count: 14,
  UpdatedAt: '2023-03-27T13:33:51.315934+01:00',
  CreatedAt: '2023-03-26T21:46:18.624369+08:00'
}

Get by Name

import {CounterAPI} from "counterapi";

const counter = new CounterAPI();

counter.get("test", "test").then((res) => {
    console.log(res)
})

Output

Counter {
  ID: 1,
  Name: 'test',
  Count: 14,
  UpdatedAt: '2023-03-27T13:33:51.315934+01:00',
  CreatedAt: '2023-03-26T21:46:18.624369+08:00'
}

Set by Name

import {CounterAPI} from "counterapi";

const counter = new CounterAPI();

counter.set("test", "test", 10).then((res) => {
    console.log(res)
})

Output

Counter {
  ID: 1,
  Name: 'test',
  Count: 10,
  UpdatedAt: '2023-03-27T13:33:51.315934+01:00',
  CreatedAt: '2023-03-26T21:46:18.624369+08:00'
}

Get Count List by Name

import {CounterAPI, GroupByTypes, OrderByTypes} from "counterapi";

const counter = new CounterAPI();

const q = {
    group_by: GroupByTypes.Day,
    order_by: OrderByTypes.ASC,
};

counter.counts("test", "test", q).then((res) => {
    console.log(res);
});

Output

[
  Count { Count: 2, Date: '2023-03-07T00:00:00+08:00' },
  Count { Count: 14, Date: '2023-03-26T00:00:00+08:00' },
  Count { Count: 40, Date: '2023-03-27T00:00:00+08:00' }
]

License

MIT

FAQs

Package last updated on 20 Jan 2025

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