-
-
Notifications
You must be signed in to change notification settings - Fork 503
Expand file tree
/
Copy pathutils.js
More file actions
32 lines (29 loc) · 809 Bytes
/
utils.js
File metadata and controls
32 lines (29 loc) · 809 Bytes
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
/**
* @param {Chunk} chunk chunk
* @returns {boolean} true when chunk is parser, otherwise false
*/
export function isChunkParsed(chunk) {
return typeof chunk.parsedSize === "number";
}
/**
* @param {Module[]} modules modules
* @param {(module: Module) => boolean} cb callback
* @returns {boolean} state
*/
export function walkModules(modules, cb) {
for (const module of modules) {
if (cb(module) === false) return false;
if (module.groups && walkModules(module.groups, cb) === false) {
return false;
}
}
}
/**
* @template T
* @param {T} elem element
* @param {T[]} container container
* @returns {boolean} true when element is outside, otherwise false
*/
export function elementIsOutside(elem, container) {
return !(elem === container || container.contains(elem));
}