UNPKG

@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">

28 lines (21 loc) 894 B
import _extends from 'babel-runtime/helpers/extends'; import _Array$from from 'babel-runtime/core-js/array/from'; import _Object$keys from 'babel-runtime/core-js/object/keys'; import _toConsumableArray from 'babel-runtime/helpers/toConsumableArray'; import _newArrowCheck from 'babel-runtime/helpers/newArrowCheck'; var _this = undefined; var getObjectLength = function (object) { _newArrowCheck(this, _this); return Math.max.apply(Math, _toConsumableArray(_Object$keys(object))) + 1; }.bind(undefined); /** * Creates a new array using the given object * If all of its entries are array keys. * * (it could also have a property length with its size) */ var fromObject = function (object) { _newArrowCheck(this, _this); return _Array$from("length" in object ? object : _extends({}, object, { length: getObjectLength(object) })); }.bind(undefined); export default fromObject;