MCPcopy Index your code
hub / github.com/SchemaStore/schemastore / assertFileHasCorrectExtensions

Function assertFileHasCorrectExtensions

cli.js:1670–1680  ·  view source on GitHub ↗
(
  /** @type {string} */ pathname,
  /** @type {string[]} */ allowedExtensions,
)

Source from the content-addressed store, hash-verified

1668}
1669
1670function assertFileHasCorrectExtensions(
1671 /** @type {string} */ pathname,
1672 /** @type {string[]} */ allowedExtensions,
1673) {
1674 if (!allowedExtensions.includes(path.parse(pathname).ext)) {
1675 printErrorAndExit(new Error(), [
1676 `Expected schema file "./${pathname}" to have a valid file extension`,
1677 `Valid file extensions: ${JSON.stringify(allowedExtensions, null, 2)}`,
1678 ])
1679 }
1680}
1681
1682function assertFileHasNoBom(/** @type {DataFile} */ file) {
1683 const bomTypes = [

Callers 3

onSchemaFileFunction · 0.85
onPositiveTestFileFunction · 0.85
onNegativeTestFileFunction · 0.85

Calls 1

printErrorAndExitFunction · 0.85

Tested by

no test coverage detected