1 | var $;
|
2 |
|
3 | $ = {};
|
4 |
|
5 | $.normalizePathToArray = require('../dist/normalizePathToArray');
|
6 |
|
7 | $.stat_ = require('../dist/stat_');
|
8 |
|
9 | $.info = require('../dist/info');
|
10 |
|
11 | $.read_ = require('../dist/read_');
|
12 |
|
13 | $.parseString = require('../dist/parseString');
|
14 |
|
15 | module.exports = async function(source) {
|
16 | var cache, cont, i, j, len, len1, listSource, size, stat;
|
17 |
|
18 |
|
19 | listSource = $.normalizePathToArray(source);
|
20 | if (!listSource.length) {
|
21 | return false;
|
22 | }
|
23 |
|
24 | cache = null;
|
25 | for (i = 0, len = listSource.length; i < len; i++) {
|
26 | source = listSource[i];
|
27 | stat = (await $.stat_(source));
|
28 | if (!stat) {
|
29 | return false;
|
30 | }
|
31 | ({size} = stat);
|
32 | if (!cache) {
|
33 | cache = size;
|
34 | continue;
|
35 | }
|
36 | if (size !== cache) {
|
37 | return false;
|
38 | }
|
39 | }
|
40 |
|
41 | cache = null;
|
42 | for (j = 0, len1 = listSource.length; j < len1; j++) {
|
43 | source = listSource[j];
|
44 | cont = (await $.info().silence_(async function() {
|
45 | return (await $.read_(source));
|
46 | }));
|
47 | if (!cont) {
|
48 | return false;
|
49 | }
|
50 | cont = $.parseString(cont);
|
51 | if (!cache) {
|
52 | cache = cont;
|
53 | continue;
|
54 | }
|
55 | if (cont !== cache) {
|
56 | return false;
|
57 | }
|
58 | }
|
59 | return true;
|
60 | };
|