/// <summary> /// Returns all projects with the given package name and script command included in the list of script commands /// </summary> /// <remarks> /// If the selector commands is null, any script command is matched /// </remarks> public IReadOnlyCollection <JavaScriptProject> GetMatches(IJavaScriptProjectSimpleSelector simpleSelector) { Contract.AssertNotNull(simpleSelector); if (!m_nameToProjects.TryGetValue(simpleSelector.PackageName, out var values)) { return(CollectionUtilities.EmptyArray <JavaScriptProject>()); } // If commands is not specified, all commands are returned if (simpleSelector.Commands == null) { return(values); } // Otherwise, all script commands that match verbatim return(values.Where(js => simpleSelector.Commands.Contains(js.ScriptCommandName)).ToArray()); }
/// <nodoc /> public JavaScriptProjectSimpleSelector(IJavaScriptProjectSimpleSelector template) { PackageName = template.PackageName; Commands = template.Commands ?? new List <string>(); }