UNPKG

@bscotch/stitch-config

Version:

Schemas and utilities for the stitch.config.json file.

29 lines 933 B
export function isValidSoundName(name, config) { const allowedNames = config?.newSoundRules?.allowedNames; if (!allowedNames?.length) return true; if (allowedNames.some((pattern) => name.match(new RegExp(pattern)))) return true; return false; } export function isValidSpriteName(name, config) { const allowedNames = config?.newSpriteRules?.allowedNames; if (!allowedNames?.length) return true; if (allowedNames.some((pattern) => name.match(new RegExp(pattern)))) return true; return false; } export function getDefaultsForNewSound(name, config) { const defaults = config?.newSoundRules?.defaults; if (!defaults) return; const patterns = Object.keys(defaults); for (const pattern of patterns) { if (name.match(new RegExp(pattern))) { return defaults[pattern]; } } return {}; } //# sourceMappingURL=utils.js.map