Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | const sdsNamespaces = require('@salesforce-ux/sds-namespaces'); /** * Validate namespace * @param {String} ns Namespace to be validated against the sds-namespace definitions * @returns {Object} Validation object */ const validateNs = (ns, privateSyntax) => { for (const team of sdsNamespaces) { if (ns.startsWith(privateSyntax) && ns === `${privateSyntax}${team.name}`) { return { valid: true, received: ns, private: true }; } else if (ns === team.name) { return { valid: true, received: ns }; } } return { valid: false, expected: sdsNamespaces.map((team) => team.name), received: ns }; }; module.exports = validateNs; |