Skip to content

Commit

Permalink
support for older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Snowflake107 committed Feb 3, 2021
1 parent ce0f253 commit 814d7c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devsnowflake/quick.db",
"version": "1.0.0",
"version": "1.0.1",
"description": "The hackable quick.db",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/Database.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class Database {
this.prepareTable(table);

const data = this.database.prepare(`SELECT * FROM ${table} WHERE ID = (?)`).get(id);
if (!data || data?.json === "{}") return null;
if (!data || data.json === "{}") return null;

let parsed = JSON.parse(data.json);
try { parsed = JSON.parse(parsed) } catch {}
Expand Down Expand Up @@ -325,7 +325,7 @@ class Database {

startsWith(key, options = {}) {
let data = this.filter(i => i.ID.startsWith(key), options);
if (typeof ops?.sort === "string") {
if (ops && typeof ops.sort === "string") {
if (ops.sort.startsWith(".")) ops.sort = ops.sort.slice(1);
ops.sort = ops.sort.split(".");
data = lodash.sortBy(data, ops.sort).reverse();
Expand Down

0 comments on commit 814d7c3

Please sign in to comment.