ichigoo
Version:
Static site generator with React and GraphQL
29 lines (23 loc) • 696 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _default = function _default() {
var entityData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
return function (_, _ref) {
var id = _ref.id;
var removedEntity = undefined;
if (id != null) {
var stringId = id.toString();
var indexOfEntity = entityData.findIndex(function (e) {
return e.id != null && e.id.toString() === stringId;
});
if (indexOfEntity !== -1) {
removedEntity = entityData.splice(indexOfEntity, 1)[0];
}
}
return removedEntity;
};
};
exports["default"] = _default;