UNPKG

react-photoswipe-gallery

Version:
37 lines 1.27 kB
var __rest = this && this.__rest || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; const itemToSlide = (item, itemRef) => { var _a; const { width, height, original, originalSrcset, thumbnail, cropped, content, id: pid } = item, rest = __rest(item, ["width", "height", "original", "originalSrcset", "thumbnail", "cropped", "content", "id"]); return Object.assign(Object.assign(Object.assign({ w: width ? Number(width) : undefined, h: height ? Number(height) : undefined, src: original, srcset: originalSrcset, msrc: thumbnail, element: (_a = itemRef === null || itemRef === void 0 ? void 0 : itemRef.current) !== null && _a !== void 0 ? _a : undefined, thumbCropped: cropped, content }, content !== undefined ? { type: 'html' } : {}), pid !== undefined ? { pid } : {}), rest); }; export default itemToSlide;