Revision 792fbe18
Added by koszko about 2 years ago
common/misc.js | ||
---|---|---|
12 | 12 |
* IMPORT browser |
13 | 13 |
* IMPORT is_chrome |
14 | 14 |
* IMPORT TYPE_NAME |
15 |
* IMPORT TYPE_PREFIX |
|
15 | 16 |
* IMPORTS_END |
16 | 17 |
*/ |
17 | 18 |
|
... | ... | |
154 | 155 |
return gen_unique(time + policy); |
155 | 156 |
} |
156 | 157 |
|
158 |
/* Regexes and objest to use as/in schemas for parse_json_with_schema(). */ |
|
159 |
const nonempty_string_matcher = /.+/; |
|
160 |
|
|
161 |
const matchers = { |
|
162 |
sha256: /^[0-9a-f]{64}$/, |
|
163 |
nonempty_string: nonempty_string_matcher, |
|
164 |
component: [ |
|
165 |
new RegExp(`^[${TYPE_PREFIX.SCRIPT}${TYPE_PREFIX.BAG}]$`), |
|
166 |
nonempty_string_matcher |
|
167 |
] |
|
168 |
}; |
|
169 |
|
|
157 | 170 |
/* |
158 | 171 |
* EXPORTS_START |
159 | 172 |
* EXPORT gen_nonce |
... | ... | |
165 | 178 |
* EXPORT nice_name |
166 | 179 |
* EXPORT open_in_settings |
167 | 180 |
* EXPORT is_privileged_url |
181 |
* EXPORT matchers |
|
168 | 182 |
* EXPORTS_END |
169 | 183 |
*/ |
Also available in: Unified diff
Facilitate installation of scripts from the repository
This commit includes: