Skip to content

Commit

Permalink
add README.md, npmignore, and travis.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
zlargon committed Jan 8, 2020
1 parent 353bacb commit 00b59b8
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test
coverage
.travis.yml
.mocharc.yml
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: node_js
sudo: false
node_js:
- "10"
- "12"
- "node"

before_script:
- "npm -g install npm@latest"

script:
- "npm run cover"

after_script:
- "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# EventCounter

This is a JavaScript library that helps record (any kind of) incremental events, and query the number of events during the specific spantime.

## Install

```bash
npm install event-counter
```

## Example

```js
const EventCounter = require('event-counter');

const eventCounter = EventCounter();
eventCounter.increment();
eventCounter.increment();
eventCounter.increment();

// query the number of the events ocurred in last 1 sec
eventCounter.query(1000); // return 3

// after 10 seconds ...
eventCounter.increment();
eventCounter.increment();

// query the number of the events ocurred in last 1 sec
eventCounter.query(1000); // retrun 2
```

## Test

```bash
git clone https://github.com/zlargon/EventCounter.git

# npm
npm install
npm test # unit test
npm run cover # generate code coverage report to ./coverage/lcov-report/index.html
```

## Licence

MIT
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"name": "event-counter",
"description": "Event Counter for node.js",
"version": "0.0.1",
"main": "index.js",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/zlargon/EventCounter.git"
},
"devDependencies": {
"chai": "^4.2.0",
"coveralls": "^3.0.9",
Expand Down

0 comments on commit 00b59b8

Please sign in to comment.