1 | 'use strict';
|
2 |
|
3 | const hasInterpolation = require('../utils/hasInterpolation');
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | module.exports = function (value) {
|
12 | let normalizedValue = value;
|
13 |
|
14 |
|
15 | if (/^[-+*/]/.test(value[0])) {
|
16 | normalizedValue = normalizedValue.slice(1);
|
17 | }
|
18 |
|
19 |
|
20 | if (normalizedValue.startsWith('$')) {
|
21 | return false;
|
22 | }
|
23 |
|
24 |
|
25 | if (/^.+\.\$/.test(value)) {
|
26 | return false;
|
27 | }
|
28 |
|
29 |
|
30 | if (normalizedValue.startsWith('@')) {
|
31 | return false;
|
32 | }
|
33 |
|
34 |
|
35 | if (hasInterpolation(normalizedValue)) {
|
36 | return false;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | if (/__MSG_[^\s]+__/.test(value)) {
|
43 | return false;
|
44 | }
|
45 |
|
46 | return true;
|
47 | };
|