From 9e8b07048977ef662315d070eac729fcaee61522 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Mon, 5 Jun 2017 16:19:36 +0200 Subject: [PATCH] Export schemas as module --- index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 index.js diff --git a/index.js b/index.js new file mode 100644 index 0000000..3675d2d --- /dev/null +++ b/index.js @@ -0,0 +1,15 @@ +const fs = require('fs'); +const path = require('path'); + +let collection = {}; +let schemas = [ + "contributor", + "contribution" +]; + +schemas.forEach((schema) => { + let filePath = path.join(__dirname, 'schemas', `${schema}.json`); + collection[schema] = JSON.parse(fs.readFileSync(filePath)); +}); + +module.exports = collection;