MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / isValidAlias

Function isValidAlias

lib/models/command.js:686–707  ·  view source on GitHub ↗
(alias, expectedType)

Source from the content-addressed store, hash-verified

684 Validates alias. Must be a string or single key object
685*/
686function isValidAlias(alias, expectedType) {
687 let type = typeof alias;
688 let value, valueType;
689 if (type === 'string') {
690 return true;
691 } else if (type === 'object') {
692 // no arrays, no multi-key objects
693 if (!Array.isArray(alias) && Object.keys(alias).length === 1) {
694 value = alias[Object.keys(alias)[0]];
695 valueType = typeof value;
696 if (!Array.isArray(expectedType)) {
697 if (valueType === expectedType.name.toLowerCase()) {
698 return true;
699 }
700 } else if (expectedType.indexOf(value) > -1) {
701 return true;
702 }
703 }
704 }
705
706 return false;
707}
708
709module.exports = Command;

Callers 1

parseAliasFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…