@builttocreate/engine-utils 2.9.0-beta.5 → 2.9.0-beta.845

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.
@@ -4,23 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.normalizeArray = exports["default"] = void 0;
7
- /**
8
- * Normalize an array of objects
9
- *
10
- * @param {String|Func} key
11
- * @param {Array} array
12
- * @param {Function} keyExtractor //optional
13
- *
14
- * Example Input:
15
- * param key = 'name';
16
- * param array = [{name: 'frank', age: 19}, {name: 'joe', age: 22}, {name: 'bob', age: 44}]
17
- *
18
- * Example return:
19
- * {
20
- * 'frank': {name: 'frank', age: 19} ,
21
- * 'joe': {name: 'joe', age: 22} ,
22
- * 'bob': {name: 'bob', age: 44} ,
23
- * }
7
+ /**
8
+ * Normalize an array of objects
9
+ *
10
+ * @param {String|Func} key
11
+ * @param {Array} array
12
+ * @param {Function} keyExtractor //optional
13
+ *
14
+ * Example Input:
15
+ * param key = 'name';
16
+ * param array = [{name: 'frank', age: 19}, {name: 'joe', age: 22}, {name: 'bob', age: 44}]
17
+ *
18
+ * Example return:
19
+ * {
20
+ * 'frank': {name: 'frank', age: 19} ,
21
+ * 'joe': {name: 'joe', age: 22} ,
22
+ * 'bob': {name: 'bob', age: 44} ,
23
+ * }
24
24
  */
25
25
  var normalizeArray = exports.normalizeArray = function normalizeArray(key, array) {
26
26
  var obj = {};
@@ -13,18 +13,18 @@ var CALL_API = exports.CALL_API = 'CALL API';
13
13
  var callApiMiddleware = function callApiMiddleware(_ref) {
14
14
  var dispatch = _ref.dispatch,
15
15
  getState = _ref.getState;
16
- /**
17
- * @param next //Callback for the action
18
- * @param action //Action object
19
- *
20
- * async action example: {
21
- * CALL_API: {
22
- * types: [ACTION_REQUEST, ACTION_SUCCESS, ACTION_FAILURE],
23
- * apiCall: apiMethodCall, //apiMethodCall should return a promise
24
- * success: callbackFunction,
25
- * error: callbackFunction
26
- * }
27
- * }
16
+ /**
17
+ * @param next //Callback for the action
18
+ * @param action //Action object
19
+ *
20
+ * async action example: {
21
+ * CALL_API: {
22
+ * types: [ACTION_REQUEST, ACTION_SUCCESS, ACTION_FAILURE],
23
+ * apiCall: apiMethodCall, //apiMethodCall should return a promise
24
+ * success: callbackFunction,
25
+ * error: callbackFunction
26
+ * }
27
+ * }
28
28
  */
29
29
  return function (next) {
30
30
  return function (action) {
@@ -37,15 +37,15 @@ var callApiMiddleware = function callApiMiddleware(_ref) {
37
37
  var successCallback = callApi.success;
38
38
  var errorCallback = callApi.error;
39
39
 
40
- /**
41
- * Action validation
42
- *
43
- * Types:
44
- * All async actions should have three action types: requested, success, & failure
45
- * All actions should be strings.
46
- *
47
- * apiCall:
48
- * All aysnc actions should have an apiCall function
40
+ /**
41
+ * Action validation
42
+ *
43
+ * Types:
44
+ * All async actions should have three action types: requested, success, & failure
45
+ * All actions should be strings.
46
+ *
47
+ * apiCall:
48
+ * All aysnc actions should have an apiCall function
49
49
  */
50
50
 
51
51
  if (!Array.isArray(types) || types.length !== 3) {
@@ -10,9 +10,9 @@ var hasAdminRole = exports.hasAdminRole = function hasAdminRole(permissions) {
10
10
  return hasRoles([_Roles["default"].admin.value], permissions);
11
11
  };
12
12
  var hasRoles = exports.hasRoles = function hasRoles(roles, permissions) {
13
- /**
14
- * If one of users permissions has a role inside of the
15
- * roles property then return true
13
+ /**
14
+ * If one of users permissions has a role inside of the
15
+ * roles property then return true
16
16
  */
17
17
  return !permissions || permissions.length < 1 ? false : permissions.find(function (perm) {
18
18
  return roles.indexOf(perm.role) !== -1;