@dillonkearns/elm-graphql
Version:
<img src="https://cdn.jsdelivr.net/gh/martimatix/logo-graphqelm/logo.svg" alt="dillonearns/elm-graphql logo" width="40%" align="right">
40 lines (29 loc) • 1.15 kB
JavaScript
import _Object$keys from 'babel-runtime/core-js/object/keys';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _newArrowCheck from 'babel-runtime/helpers/newArrowCheck';
import _Number$isInteger from 'babel-runtime/core-js/number/is-integer';
var _this$1 = undefined;
var isIntGreaterThan = function (number, other) {
_newArrowCheck(this, _this$1);
return _Number$isInteger(number) && number >= other;
}.bind(undefined);
/**
* Returns true if the given string is an Array key or false otherwise.
*/
var isKey = function (string) {
_newArrowCheck(this, _this$1);
return isIntGreaterThan(Number(string), 0);
}.bind(undefined);
var _this = undefined;
/**
* Returns true if an Array can be created from the given Object, or in other
* words, if it has or not a length property, and the rest of its keys are Array
* ones.
*/
var isPossibleFromObject = function (_ref) {
var length = _ref.length,
rest = _objectWithoutProperties(_ref, ["length"]);
_newArrowCheck(this, _this);
return _Object$keys(rest).every(isKey);
}.bind(undefined);
export default isPossibleFromObject;