node-logs-sqlite
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -13,3 +13,2 @@ | ||
// tests | ||
const eslint = require("gulp-eslint"); | ||
const mocha = require("gulp-mocha"); | ||
@@ -26,28 +25,6 @@ | ||
const ALL_FILES = [ path.join(__dirname, "gulpfile.js") ] | ||
.concat(APP_FILES) | ||
.concat(UNITTESTS_FILES); | ||
// tasks | ||
gulp.task("eslint", () => { | ||
gulp.task("istanbul", () => { | ||
return gulp.src(ALL_FILES) | ||
.pipe(plumber()) | ||
.pipe(eslint({ | ||
"env": require(path.join(__dirname, "gulpfile", "eslint", "env.json")), | ||
"globals": require(path.join(__dirname, "gulpfile", "eslint", "globals.json")), | ||
"parserOptions": { | ||
"ecmaVersion": 6 | ||
}, | ||
// http://eslint.org/docs/rules/ | ||
"rules": require(path.join(__dirname, "gulpfile", "eslint", "rules.json")) | ||
})) | ||
.pipe(eslint.format()) | ||
.pipe(eslint.failAfterError()); | ||
}); | ||
gulp.task("istanbul", gulp.series("eslint", () => { | ||
return gulp.src(APP_FILES) | ||
@@ -58,3 +35,3 @@ .pipe(plumber()) | ||
})); | ||
}); | ||
@@ -79,11 +56,4 @@ gulp.task("mocha", gulp.series("istanbul", () => { | ||
// watcher | ||
gulp.task("watch", () => { | ||
gulp.watch(ALL_FILES, [ "eslint" ]); | ||
}); | ||
// default | ||
gulp.task("default", gulp.series("mocha")); |
@@ -6,2 +6,3 @@ | ||
// natives | ||
const { writeFile } = require("fs"); | ||
@@ -8,0 +9,0 @@ |
@@ -6,2 +6,3 @@ | ||
// natives | ||
const { lstat } = require("fs"); | ||
@@ -8,0 +9,0 @@ |
@@ -6,4 +6,6 @@ | ||
// natives | ||
const { join } = require("path"); | ||
// externals | ||
const sqlite3 = require("sqlite3"); | ||
@@ -15,2 +17,6 @@ | ||
const _checkNumberParameter = require(join(__dirname, "checkNumberParameter.js")); | ||
const _checkStringParameter = require(join(__dirname, "checkStringParameter.js")); | ||
const _checkNumberOrStringParameter = require(join(__dirname, "checkNumberOrStringParameter.js")); | ||
const _createFile = require(join(__dirname, "createFile.js")); | ||
@@ -77,36 +83,6 @@ const _fileExists = require(join(__dirname, "fileExists.js")); | ||
// check deleteLogsAfterXDays attribute | ||
return Promise.resolve().then(() => { | ||
if ("undefined" === typeof this._deleteLogsAfterXDays) { | ||
return Promise.reject(new ReferenceError("Missing \"deleteLogsAfterXDays\" data")); | ||
} | ||
else if ("number" !== typeof this._deleteLogsAfterXDays) { | ||
return Promise.reject(new TypeError("\"deleteLogsAfterXDays\" data is not a number")); | ||
} | ||
else if (0 >= this._deleteLogsAfterXDays) { | ||
return Promise.reject(new Error("\"deleteLogsAfterXDays\" data must be higher than 0")); | ||
} | ||
else { | ||
return Promise.resolve(); | ||
} | ||
// check localStorageDatabase attribute | ||
return _checkNumberParameter("this._deleteLogsAfterXDays", this._deleteLogsAfterXDays); | ||
}).then(() => { | ||
if ("undefined" === typeof this._localStorageDatabase) { | ||
return Promise.reject(new ReferenceError("Missing \"localStorageDatabase\" data")); | ||
} | ||
else if ("string" !== typeof this._localStorageDatabase) { | ||
return Promise.reject(new TypeError("\"localStorageDatabase\" data is not a string")); | ||
} | ||
else if ("" === this._localStorageDatabase.trim()) { | ||
return Promise.reject(new Error("\"localStorageDatabase\" data is empty")); | ||
} | ||
else { | ||
return Promise.resolve(); | ||
} | ||
return _checkStringParameter("this._localStorageDatabase", this._localStorageDatabase); | ||
}); | ||
@@ -257,34 +233,10 @@ | ||
if ("undefined" === typeof year) { | ||
return Promise.reject(new ReferenceError("Missing \"year\" data")); | ||
} | ||
else if ("string" !== typeof year && "number" !== typeof year) { | ||
return Promise.reject(new TypeError("\"year\" data is not a string or a number")); | ||
} | ||
else if ("string" === typeof year && "" === year) { | ||
return Promise.reject(new Error("\"year\" data is empty")); | ||
} | ||
return Promise.resolve().then(() => { | ||
return _checkNumberOrStringParameter("year", year); | ||
}).then(() => { | ||
return _checkNumberOrStringParameter("month", month); | ||
}).then(() => { | ||
return _checkNumberOrStringParameter("day", day); | ||
}).then(() => { | ||
else if ("undefined" === typeof month) { | ||
return Promise.reject(new ReferenceError("Missing \"month\" data")); | ||
} | ||
else if ("string" !== typeof month && "number" !== typeof month) { | ||
return Promise.reject(new TypeError("\"month\" data is not a string")); | ||
} | ||
else if ("string" === typeof month && "" === month) { | ||
return Promise.reject(new Error("\"month\" data is empty")); | ||
} | ||
else if ("undefined" === typeof day) { | ||
return Promise.reject(new ReferenceError("Missing \"day\" data")); | ||
} | ||
else if ("string" !== typeof day && "number" !== typeof day) { | ||
return Promise.reject(new TypeError("\"day\" data is not a string")); | ||
} | ||
else if ("string" === typeof day && "" === day) { | ||
return Promise.reject(new Error("\"day\" data is empty")); | ||
} | ||
else { | ||
return new Promise((resolve, reject) => { | ||
@@ -328,3 +280,3 @@ | ||
} | ||
}); | ||
@@ -331,0 +283,0 @@ } |
{ | ||
"name": "node-logs-sqlite", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A class to manage logs with sql base", | ||
@@ -8,3 +8,4 @@ "main": "lib/main.js", | ||
"scripts": { | ||
"start": "node lib/main.js", | ||
"lint": "./node_modules/.bin/eslint ./gulpfile.js ./lib/**/*.js ./tests/**/*.js", | ||
"tests": "npm run-script lint && gulp mocha", | ||
"ci": "gulp coveralls" | ||
@@ -14,4 +15,4 @@ }, | ||
"hooks": { | ||
"pre-commit": "gulp eslint", | ||
"pre-push": "gulp mocha" | ||
"pre-commit": "npm run-script lint", | ||
"pre-push": "npm run-script tests" | ||
} | ||
@@ -42,7 +43,7 @@ }, | ||
"devDependencies": { | ||
"@types/node": "10.5.7", | ||
"@types/node": "10.5.8", | ||
"@types/sqlite3": "3.1.3", | ||
"eslint": "5.9.0", | ||
"gulp": "4.0.0", | ||
"gulp-coveralls": "0.1.4", | ||
"gulp-eslint": "5.0.0", | ||
"gulp-istanbul": "1.1.3", | ||
@@ -49,0 +50,0 @@ "gulp-mocha": "3.0.1", |
@@ -6,2 +6,3 @@ | ||
// natives | ||
const { exec } = require("child_process"); | ||
@@ -8,0 +9,0 @@ const { join } = require("path"); |
@@ -5,5 +5,7 @@ "use strict"; | ||
// natives | ||
const { join } = require("path"); | ||
const assert = require("assert"); | ||
// locals | ||
const NodeLogs = require(join(__dirname, "..", "lib", "main.js")); | ||
@@ -16,2 +18,4 @@ | ||
// tests | ||
describe("accessors", () => { | ||
@@ -18,0 +22,0 @@ |
@@ -5,6 +5,10 @@ "use strict"; | ||
// natives | ||
const { strictEqual } = require("assert"); | ||
// locals | ||
const createFile = require(require("path").join(__dirname, "..", "lib", "createFile.js")); | ||
// tests | ||
describe("createFile", () => { | ||
@@ -11,0 +15,0 @@ |
@@ -5,6 +5,10 @@ "use strict"; | ||
// natives | ||
const { strictEqual } = require("assert"); | ||
// locals | ||
const fileExists = require(require("path").join(__dirname, "..", "lib", "fileExists.js")); | ||
// tests | ||
describe("fileExists", () => { | ||
@@ -11,0 +15,0 @@ |
@@ -5,4 +5,6 @@ "use strict"; | ||
// natives | ||
const assert = require("assert"); | ||
// locals | ||
const formateDate = require(require("path").join(__dirname, "..", "lib", "formateDate.js")); | ||
@@ -14,2 +16,4 @@ | ||
// tests | ||
describe("formateDate", () => { | ||
@@ -16,0 +20,0 @@ |
@@ -5,4 +5,6 @@ "use strict"; | ||
// natives | ||
const assert = require("assert"); | ||
// locals | ||
const formateTime = require(require("path").join(__dirname, "..", "lib", "formateTime.js")); | ||
@@ -14,2 +16,4 @@ | ||
// tests | ||
describe("formateTime", () => { | ||
@@ -16,0 +20,0 @@ |
@@ -5,7 +5,8 @@ "use strict"; | ||
// natives | ||
const { join } = require("path"); | ||
const assert = require("assert"); | ||
// locals | ||
const unlink = require(join(__dirname, "unlink.js")); | ||
const NodeLogs = require(join(__dirname, "..", "lib", "main.js")); | ||
@@ -18,2 +19,4 @@ | ||
// tests | ||
describe("init", () => { | ||
@@ -20,0 +23,0 @@ |
@@ -5,6 +5,7 @@ "use strict"; | ||
// natives | ||
const { join } = require("path"); | ||
// locals | ||
const unlink = require(join(__dirname, "unlink.js")); | ||
const NodeLogs = require(join(__dirname, "..", "lib", "main.js")); | ||
@@ -17,2 +18,4 @@ | ||
// tests | ||
describe("write", () => { | ||
@@ -19,0 +22,0 @@ |
@@ -5,7 +5,8 @@ "use strict"; | ||
// natives | ||
const { join } = require("path"); | ||
const assert = require("assert"); | ||
// locals | ||
const unlink = require(join(__dirname, "unlink.js")); | ||
const NodeLogs = require(join(__dirname, "..", "lib", "main.js")); | ||
@@ -20,2 +21,4 @@ | ||
// tests | ||
describe("read", () => { | ||
@@ -98,2 +101,6 @@ | ||
return Promise.resolve(data); | ||
}).then((data) => { | ||
assert.strictEqual(typeof data[0].date, "string", "first log's date is not a string"); | ||
@@ -100,0 +107,0 @@ assert.strictEqual(typeof data[0].time, "string", "first log's time is not a string"); |
@@ -6,4 +6,6 @@ | ||
// natives | ||
const { unlink } = require("fs"); | ||
// locals | ||
const fileExists = require(require("path").join(__dirname, "..", "lib", "fileExists.js")); | ||
@@ -10,0 +12,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
57431
28
1476
26