Skip to content

Commit 6f4d520

Browse files
author
gabe
committed
tmp
1 parent da9de52 commit 6f4d520

File tree

8 files changed

+1409
-41
lines changed

8 files changed

+1409
-41
lines changed

.eslintrc.cjs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
module.exports = {
2+
'env': {
3+
'browser': true,
4+
'es2021': true,
5+
},
6+
'extends': [
7+
'google',
8+
'plugin:react/recommended',
9+
],
10+
'overrides': [
11+
{
12+
'env': {
13+
'node': true,
14+
},
15+
'files': [
16+
'.eslintrc.{js,cjs}',
17+
],
18+
'parserOptions': {
19+
'sourceType': 'script',
20+
},
21+
},
22+
],
23+
'parserOptions': {
24+
'ecmaVersion': 'latest',
25+
'sourceType': 'module',
26+
},
27+
'plugins': [
28+
'react',
29+
],
30+
'rules': {
31+
"max-len": [
32+
"error",
33+
{
34+
"code": 100,
35+
"tabWidth": 2,
36+
"ignoreComments": true, //"comments": 80
37+
"ignoreUrls": true,
38+
"ignoreStrings": true,
39+
"ignoreTemplateLiterals": true
40+
}
41+
]
42+
},
43+
};

implementations/index.js

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
11
import fs from 'fs';
22
import path from 'path';
33

4-
const jsonsInDir = fs.readdirSync('./').filter(file => path.extname(file) === '.json');
4+
const jsonsInDir = fs.readdirSync('./').filter((file) => path.extname(file) === '.json');
55

6-
const implementations = jsonsInDir.map(file => {
7-
const fileData = fs.readFileSync(path.join('./', file));
8-
return JSON.parse(fileData.toString());
6+
export const implementations = jsonsInDir.map((file) => {
7+
const fileData = fs.readFileSync(path.join('./', file));
8+
return JSON.parse(fileData.toString());
99
});
10+
11+
export const JsonSchemaVersions = {
12+
202012: '2020-12',
13+
201909: '2019-09',
14+
Draft7: 'Draft-7',
15+
};
16+
17+
export const VcJsonSchemaTypes = {
18+
JsonSchema: 'JsonSchema',
19+
JsonSchemaCredential: 'JsonSchemaCredential',
20+
};
21+
22+
export const implementationsWhichSupportVersionAndType = (
23+
{
24+
impls = implementations,
25+
version,
26+
type,
27+
},
28+
) => {
29+
const matchingImpls = [];
30+
for (const i of impls) {
31+
if (Object.keys(i.specs).includes(version) && i.specs[version].includes(type)) {
32+
matchingImpls.push(i);
33+
}
34+
}
35+
return matchingImpls;
36+
};

implementations/sample.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "test impl",
3+
"docker_image": "test-image:latest",
34
"specs": {
45
"2020-12": [
56
"JsonSchema",

0 commit comments

Comments
 (0)