Created
May 4, 2018 13:21
-
-
Save vinicius73/95c502b0d64e28292eefea50d8fcef1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { curry } = require('ramda') | |
const { readdirSync, readFileSync } = require('fs') | |
const path = require('path') | |
const isGraphQLFile = fileName => fileName.endsWith('.graphql') | |
const readFile = curry((dirname, fileName) => readFileSync(path.join(dirname, fileName), 'utf8')) | |
/** | |
* @method loadGraphQLFiles | |
* @param {String} dirname | |
* @return {Array<String>} | |
*/ | |
const loadGraphQLFiles = dirname => readdirSync(dirname) | |
.filter(isGraphQLFile) | |
.map(readFile(dirname)) | |
module.exports = loadGraphQLFiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment