Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to esm #305

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
266 changes: 133 additions & 133 deletions build/collect.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/collect.min.js

Large diffs are not rendered by default.

27 changes: 16 additions & 11 deletions dist/helpers/clone.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
'use strict';
/**
* Clone helper
*
* Clone an array or object
*
* @param items
* @returns {*}
*/
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = clone;

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }

Expand All @@ -20,7 +17,15 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

module.exports = function clone(items) {
/**
* Clone helper
*
* Clone an array or object
*
* @param items
* @returns {*}
*/
function clone(items) {
var cloned;

if (Array.isArray(items)) {
Expand All @@ -37,4 +42,4 @@ module.exports = function clone(items) {
}

return cloned;
};
}
20 changes: 13 additions & 7 deletions dist/helpers/deleteKeys.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = deleteKeys;

var _variadic = _interopRequireDefault(require("./variadic"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var variadic = require('./variadic');
/**
* Delete keys helper
*
Expand All @@ -10,15 +18,13 @@ var variadic = require('./variadic');
* @param keys
* @returns {void}
*/


module.exports = function deleteKeys(obj) {
function deleteKeys(obj) {
for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
keys[_key - 1] = arguments[_key];
}

variadic(keys).forEach(function (key) {
(0, _variadic["default"])(keys).forEach(function (key) {
// eslint-disable-next-line
delete obj[key];
});
};
}
57 changes: 34 additions & 23 deletions dist/helpers/is.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isObject = exports.isFunction = exports.isArray = void 0;

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

module.exports = {
/**
* @returns {boolean}
*/
isArray: function isArray(item) {
return Array.isArray(item);
},

/**
* @returns {boolean}
*/
isObject: function isObject(item) {
return _typeof(item) === 'object' && Array.isArray(item) === false && item !== null;
},

/**
* @returns {boolean}
*/
isFunction: function isFunction(item) {
return typeof item === 'function';
}
};
/**
* @returns {boolean}
*/
var isArray = function isArray(item) {
return Array.isArray(item);
};
/**
* @returns {boolean}
*/


exports.isArray = isArray;

var isObject = function isObject(item) {
return _typeof(item) === 'object' && Array.isArray(item) === false && item !== null;
};
/**
* @returns {boolean}
*/


exports.isObject = isObject;

var isFunction = function isFunction(item) {
return typeof item === 'function';
};

exports.isFunction = isFunction;
13 changes: 9 additions & 4 deletions dist/helpers/nestedValue.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = nestedValue;

/**
* Get value of a nested property
*
* @param mainObject
* @param key
* @returns {*}
*/

module.exports = function nestedValue(mainObject, key) {
function nestedValue(mainObject, key) {
try {
return key.split('.').reduce(function (obj, property) {
return obj[property];
Expand All @@ -16,4 +21,4 @@ module.exports = function nestedValue(mainObject, key) {
// If we end up here, we're not working with an object, and @var mainObject is the value itself
return mainObject;
}
};
}
27 changes: 16 additions & 11 deletions dist/helpers/values.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
'use strict';
/**
* Values helper
*
* Retrieve values from [this.items] when it is an array, object or Collection
*
* @param items
* @returns {*}
*/
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = values;

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }

Expand All @@ -20,7 +17,15 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

module.exports = function values(items) {
/**
* Values helper
*
* Retrieve values from [this.items] when it is an array, object or Collection
*
* @param items
* @returns {*}
*/
function values(items) {
var valuesArray = [];

if (Array.isArray(items)) {
Expand All @@ -34,4 +39,4 @@ module.exports = function values(items) {
}

return valuesArray;
};
}
13 changes: 9 additions & 4 deletions dist/helpers/variadic.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = variadic;

/**
* Variadic helper function
*
* @param args
* @returns {Array}
*/

module.exports = function variadic(args) {
function variadic(args) {
if (Array.isArray(args[0])) {
return args[0];
}

return args;
};
}