stargaze-studio/utils/compareFileArrays.ts
Serkan Reis 0f0e68a285
Fixes and improvements (#28)
* Update collection creation error messages

* Update minimum unit price

* Update .env.example

* Fix double ustars conversion for whitelist & minter unit_price

* Add minimum unit price for whitelisted addresses

* Fix: Invalid baseTokenURI error during collection instantiation

* Collection cover image URI update

* Minimum unit price update - 2

* Fix: nonfunctional existing whitelist option

* Check matching asset and metadata file arrays before creating a collection

* Mark minting detail inputs as required

* Fix: collection creation with the specified royalty preference

* Fix: whitelistType change problem

* Fix creation logic

* Automate number of tokens input & check per address limit

* Automate number of tokens input & check per address limit - 2

* Metadata files should have .json extensions

* Check royalty percentage

* Upload service related changes now trigger state updates

Co-authored-by: findolor <anakisci@gmail.com>
2022-08-09 14:42:55 +03:00

10 lines
565 B
TypeScript

export const compareFileArrays = (assetFilesArray: File[], metadataFilesArray: File[]) => {
const metadataFileNames = metadataFilesArray.map((file) => file.name.substring(0, file.name.lastIndexOf('.')))
const assetFileNames = assetFilesArray.map((file) => file.name.substring(0, file.name.lastIndexOf('.')))
// Compare the two arrays to make sure they are the same
const areArraysEqual = metadataFileNames.every((val, index) => val === assetFileNames[index])
if (!areArraysEqual) {
throw new Error('Asset and metadata file names do not match.')
}
}