@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1 lines • 1.01 kB
Source Map (JSON)
{"version":3,"file":"check-duplicate-field-keys.mjs","names":[],"sources":["../../../../src/libs/config/checks/check-duplicate-field-keys.ts"],"sourcesContent":["import { translate } from \"../../i18n/index.js\";\n\nconst checkDuplicateFieldKeys = (\n\ttype: \"brick\" | \"collection\",\n\ttypeKey: string,\n\tfieldsKeys: string[],\n) => {\n\tconst duplicateKeys = fieldsKeys.filter((key, index, array) => {\n\t\treturn array.indexOf(key) !== index;\n\t});\n\n\tif (duplicateKeys.length > 0) {\n\t\tthrow new Error(\n\t\t\ttranslate(\"server:core.collections.fields.duplicates\", {\n\t\t\t\tdata: {\n\t\t\t\t\ttype: type,\n\t\t\t\t\tkeys: duplicateKeys.join(\", \"),\n\t\t\t\t\ttypeKey: typeKey,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t}\n};\n\nexport default checkDuplicateFieldKeys;\n"],"mappings":"qDAEA,MAAM,GACL,EACA,EACA,IACI,CACJ,IAAM,EAAgB,EAAW,QAAQ,EAAK,EAAO,IAC7C,EAAM,QAAQ,CAAG,IAAM,CAC9B,EAED,GAAI,EAAc,OAAS,EAC1B,MAAU,MACT,EAAU,4CAA6C,CACtD,KAAM,CACC,OACN,KAAM,EAAc,KAAK,IAAI,EACpB,SACV,CACD,CAAC,CACF,CAEF"}