groupcore-utils 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/database/crud.js CHANGED
@@ -37,12 +37,12 @@ module.exports = class {
37
37
  /**
38
38
  * @method read()
39
39
  * @description get data from table
40
- * @param {Object} where - if no where, all the data will be returned from db table without any 'where' clause.
40
+ * @param {Object | null} [where] - if no where, all the data will be returned from db table without any 'where' clause.
41
41
  * shape {fields (array of fields {field, value}), condition array ("and" or "or") to correspond with fields}
42
- * @param {Array} orderBy - explicitly specify the order, either asc or desc
42
+ * @param {Array | null} [orderBy] - explicitly specify the order, either asc or desc
43
43
  * @returns {Promise}
44
44
  */
45
- read(where = false, orderBy = []) {
45
+ read(where, orderBy) {
46
46
  if (where && !_.has(where, 'fields')) {
47
47
  return this.readV1(where, orderBy);
48
48
  }
package/database/init.js CHANGED
@@ -3,11 +3,11 @@ const mysql = require('mysql');
3
3
  module.exports = class {
4
4
  /**
5
5
  * @description constructor
6
- * @param {string} host - sql db hostname
6
+ * @param {string | null} host - sql db hostname
7
7
  * @param {string} user - db user username
8
8
  * @param {string} password - db user password
9
9
  * @param {string} db - db name
10
- * @param {string} socket - path to a unix domain socket to connect to. when used host and port are ignored
10
+ * @param {string | null} socket - path to a unix domain socket to connect to. when used host and port are ignored
11
11
  */
12
12
  constructor(host, user, password, db, socket) {
13
13
  this.host = host;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "groupcore-utils",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Utilities for working with some core features",
5
5
  "main": "Utils.js",
6
6
  "scripts": {
package/rest/index.js CHANGED
@@ -8,7 +8,7 @@ module.exports = {
8
8
  * @param {object} headers - headers to be added to request
9
9
  * @returns {Promise<any>}
10
10
  */
11
- async get(url, headers = []) {
11
+ async get(url, headers = {}) {
12
12
  return axios({
13
13
  url,
14
14
  headers,
@@ -24,7 +24,7 @@ module.exports = {
24
24
  * @param {object} headers - headers to be added to request
25
25
  * @returns {Promise<any>}
26
26
  */
27
- async post(url, data, headers = []) {
27
+ async post(url, data, headers = {}) {
28
28
  return axios({
29
29
  url,
30
30
  data,
@@ -41,7 +41,7 @@ module.exports = {
41
41
  * @param {object} headers - headers to be added to request
42
42
  * @returns {Promise<any>}
43
43
  */
44
- async put(url, data, headers = []) {
44
+ async put(url, data, headers = {}) {
45
45
  return axios({
46
46
  url,
47
47
  data,
@@ -58,7 +58,7 @@ module.exports = {
58
58
  * @param {object} headers - headers to be added to request
59
59
  * @returns {Promise<any>}
60
60
  */
61
- async patch(url, data, headers = []) {
61
+ async patch(url, data, headers = {}) {
62
62
  return axios({
63
63
  url,
64
64
  data,
@@ -74,7 +74,7 @@ module.exports = {
74
74
  * @param {object} headers - headers to be added to request
75
75
  * @returns {Promise<any>}
76
76
  */
77
- async delete(url, headers = []) {
77
+ async delete(url, headers = {}) {
78
78
  return axios({
79
79
  url,
80
80
  headers,
@@ -52,6 +52,10 @@ module.exports = class {
52
52
  return new Date(unix * 1000).setHours(23, 59, 59, 999) / 1000;
53
53
  }
54
54
 
55
+ static unixToStartOfMonth(unix) {}
56
+
57
+ static unixToEndOfMonth(unix) {}
58
+
55
59
  /**
56
60
  * @method toSeconds()
57
61
  * @description convert time (HH:MM) to seconds