Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Latest commit

 

History

History
History
47 lines (40 loc) · 1.35 KB

File metadata and controls

47 lines (40 loc) · 1.35 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* The AngularJS Material module `ngMaterial` is generated by scanning all Material components
* for valid module definitions. @see gulp-utils.js ::buildNgMaterialDefinition()
*
* angular.module('ngMaterial', [
* "ng","ngAnimate","ngAria",
* "material.core","material.core.gestures","material.core.layout","material.core.theming.palette",
* ...
* ]);
*
*/
// Define patterns for AngularJS Module definitions
const MATERIAL_ONLY = /\.module\(['|"](material\.[a-zA-Z\-.]*)['|"]\s*,(\s*\[([^\]]*)])/;
const ANY = /\.module\(('[^']*'|"[^"]*")\s*,(?:\s*\[([^\]]+)])?/;
/**
* Find module definition s that match the module definition pattern
*/
function buildScanner(pattern) {
return function findPatternIn(content) {
let dependencies;
const match = pattern.exec(content || '');
const moduleName = match ? match[1].replace(/'/gi,'') : null;
const depsMatch = match && match[2] && match[2].trim();
if (depsMatch) {
dependencies = depsMatch.split(/\s*,\s*/).map(function(dep) {
dep = dep.trim().slice(1, -1); // remove quotes
return dep;
});
}
return match ? {
name : moduleName || '',
module : moduleName || '',
dependencies : dependencies || []
} : null;
};
}
module.exports = {
material : buildScanner(MATERIAL_ONLY),
any : buildScanner(ANY)
};
Morty Proxy This is a proxified and sanitized view of the page, visit original site.