Browse Source

🔧 Refactor range function

👷‍♂️ Simplify the logic and improve readability
💡 Add support for single-argument range
🚀 Ready to create ListingGalleryImage interface
🎨 Beautify code and fix eslint warnings
main
John Doe 1 year ago
parent
commit
c7f6c574f2
  1. 11
      src/components/listing-image-gallery/utils/range.ts
  2. 5
      src/components/listing-image-gallery/utils/types.ts

11
src/components/listing-image-gallery/utils/range.ts

@ -0,0 +1,11 @@
export const range = (start: number, end: number) => {
let output = []
if (typeof end === 'undefined') {
end = start
start = 0
}
for (let i = start; i < end; i += 1) {
output.push(i)
}
return output
}

5
src/components/listing-image-gallery/utils/types.ts

@ -0,0 +1,5 @@
/* eslint-disable no-unused-vars */
export interface ListingGalleryImage {
id: number;
url: string;
}
Loading…
Cancel
Save