Skip to content

Commit

Permalink
upd lint config
Browse files Browse the repository at this point in the history
  • Loading branch information
pasupulaphani committed May 23, 2020
1 parent e40c377 commit 4973fce
Show file tree
Hide file tree
Showing 8 changed files with 315 additions and 293 deletions.
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"extends": ["airbnb-base", "prettier"],
"plugins": ["prettier"],
"extends": ["airbnb-base", "plugin:prettier/recommended"],
"env": {
"browser": false,
"node": true,
Expand Down
5 changes: 4 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ <h2>Featuring</h2>
<li>Statistics / Counters: Gather statistical information.</li>
<li>Modular Design</li>
</ul>
<h2>Migration</h2>
<p><a href="https://github.com/pasupulaphani/node-cache-redis/releases/tag/v4.0.0">4.0.0</a> contains braking change. See
<a href="https://github.com/pasupulaphani/node-cache-redis/blob/master/CHANGELOG.md">CHANGELOG.md</a></p>
<h3>Getting started</h3>
<pre class="prettyprint source"><code> npm install node-cache-redis
</code></pre>
Expand All @@ -159,7 +162,7 @@ <h4>Usage</h4>
</code></pre>
<h4>API</h4>
<ul>
<li>init([options]) <a href="https://pasupulaphani.github.io/node-cache-redis/">JSDOC pages</a></li>
<li>init([options]) <a href="https://pasupulaphani.github.io/node-cache-redis/global.html#init">JSDOC init</a></li>
</ul>
<h4><code>options</code> object properties</h4>
<table class="params">
Expand Down
4 changes: 2 additions & 2 deletions lib/NotInitialisedError.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = class NotInitialisedError extends Error {
constructor(message) {
super(message);
this.name = "NotInitialisedError";
super(message)
this.name = 'NotInitialisedError'
}
}
10 changes: 4 additions & 6 deletions lib/redisCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const NotInitialisedError = require('./NotInitialisedError')
let options = {}
let store = null

const getNumber = num => !Number.isNaN(num) && num >= 0 ? num : null
const getNumber = (num) => (!Number.isNaN(num) && num >= 0 ? num : null)

/**
* @param {object} options
Expand Down Expand Up @@ -77,7 +77,7 @@ exports.getTtlInSeconds = () => options.ttlInSeconds
* Sets the ttlInSeconds
* @returns {number} ttl
*/
exports.setTtlInSeconds = ttl => {
exports.setTtlInSeconds = (ttl) => {
options.ttlInSeconds = getNumber(ttl)
return options.ttlInSeconds
}
Expand Down Expand Up @@ -111,7 +111,7 @@ exports.getset = async (key, value, ttlInSeconds) => {
* @param {string} key - key for the value stored
* @returns {any} value or null when the key is missing
*/
exports.get = key => this.getStore().get(key)
exports.get = (key) => this.getStore().get(key)

/**
* Returns all keys matching pattern
Expand Down Expand Up @@ -142,9 +142,7 @@ exports.deleteAll = (pattern = '*') => this.getStore().deleteAll(pattern)
* @property {number} opts.ttlInSeconds - time to live in seconds
* @returns {string} 'OK' if successful
*/
exports.wrap = async (key, fn, {
ttlInSeconds
} = {}) => {
exports.wrap = async (key, fn, { ttlInSeconds } = {}) => {
const ttl = getNumber(ttlInSeconds) || options.ttlInSeconds

if (ttl && ttl === 0) {
Expand Down
Loading

0 comments on commit 4973fce

Please sign in to comment.