diff --git a/CHANGELOG.md b/CHANGELOG.md index 80efd45..3e5120d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# version 2.0.2 + +## 11/07/2023 + +- fix grammatical + # version 2.0.1 ## 11/06/2023 diff --git a/__tests__/parsEnvironmentFileString.test.js b/__tests__/parsEnvironmentFileString.test.js index 5e9da80..17c5c1c 100644 --- a/__tests__/parsEnvironmentFileString.test.js +++ b/__tests__/parsEnvironmentFileString.test.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); -const { parsEnvironmentFileString } = require('../lib/parsEnvironmentFileString'); +const { parseEnvironmentFileString } = require('../lib/parseEnvironmentFileString'); describe('test filterEmptyLines', () => { test('test filter empty values', () => { @@ -11,7 +11,7 @@ describe('test filterEmptyLines', () => { .readFileSync(path.join(__dirname, '.env.test'), 'utf-8') .trim(); - const array = parsEnvironmentFileString(readEnvironmentFile); + const array = parseEnvironmentFileString(readEnvironmentFile); expect(typeof array).toEqual('object'); }); }); diff --git a/docs/DOCUMENTATION.md b/docs/DOCUMENTATION.md index d75c3ed..b89ff8f 100644 --- a/docs/DOCUMENTATION.md +++ b/docs/DOCUMENTATION.md @@ -13,7 +13,7 @@ * [parseValue][9] * [Parameters][10] * [getProcessEnv][11] -* [parsEnvironmentFileString][12] +* [parseEnvironmentFileString][12] * [Parameters][13] * [replaceNestedChars][14] * [Parameters][15] @@ -74,11 +74,11 @@ Returns **([object][21] | [string][19])** **value** ## getProcessEnv This function parse the Global Super process.env -The values in process.env will be parsed by [parsValue][22] +The values in process.env will be parsed by [parseValue][9] Returns **[object][21]** **env** -## parsEnvironmentFileString +## parseEnvironmentFileString This function parse the environment file to an Object @@ -123,7 +123,7 @@ You can use inline comments and masked hashtags (\\#) * `key` **[string][19]?** * `defaultValue` **any?** -Returns **([string][19] | [object][21] | [array][20] | [function][23] | [undefined][24])** **value** +Returns **([string][19] | [object][21] | [array][20] | [function][22] | [undefined][23])** **value** [1]: #filtercommentinlines @@ -147,7 +147,7 @@ Returns **([string][19] | [object][21] | [array][20] | [function][23] | [undefin [11]: #getprocessenv -[12]: #parsenvironmentfilestring +[12]: #parseenvironmentfilestring [13]: #parameters-5 @@ -167,8 +167,6 @@ Returns **([string][19] | [object][21] | [array][20] | [function][23] | [undefin [21]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[22]: parsValue +[22]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function -[23]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function - -[24]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined +[23]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined diff --git a/docs/index.html b/docs/index.html index 4b483d7..1d79055 100644 --- a/docs/index.html +++ b/docs/index.html @@ -79,9 +79,9 @@

processenv2

  • - parsEnvironmentFileString + parseEnvironmentFileString @@ -137,7 +137,7 @@

    - + lib/filter/filterCommentInLines.js @@ -213,7 +213,7 @@

    - + lib/filter/filterCommentLines.js @@ -289,7 +289,7 @@

    - + lib/filter/filterEmptyLines.js @@ -365,7 +365,7 @@

    - + lib/filter/removeQuotationMarks.js @@ -441,7 +441,7 @@

    - + lib/getProcessEnv.js @@ -449,7 +449,7 @@

    This function parse the Global Super process.env -The values in process.env will be parsed by parsValue

    +The values in process.env will be parsed by parseValue

    getProcessEnv(): object
    @@ -499,13 +499,13 @@

    -

    - parsEnvironmentFileString +

    + parseEnvironmentFileString

    - - lib/parsEnvironmentFileString.js + + lib/parseEnvironmentFileString.js
    @@ -513,7 +513,7 @@

    This function parse the environment file to an Object

    -
    parsEnvironmentFileString(environmentString: string): object
    +
    parseEnvironmentFileString(environmentString: string): object
    @@ -579,8 +579,8 @@

    - - lib/parsValue.js + + lib/parseValue.js @@ -654,7 +654,7 @@

    - + lib/processenv2.js @@ -742,7 +742,7 @@

    - + lib/replaceNestedChars.js diff --git a/lib/getProcessEnv.js b/lib/getProcessEnv.js index 0cdb7d6..8d8dec2 100644 --- a/lib/getProcessEnv.js +++ b/lib/getProcessEnv.js @@ -1,9 +1,9 @@ 'use strict'; -const { parsValue } = require('./parsValue'); +const { parseValue } = require('./parseValue'); /** * This function parse the Global Super process.env - * The values in process.env will be parsed by {@link parsValue} + * The values in process.env will be parsed by {@link parseValue} * * @function getProcessEnv * @@ -15,7 +15,7 @@ const getProcessEnv = () => { // eslint-disable-next-line no-undef Object.keys(process.env).forEach((name) => { // eslint-disable-next-line no-undef - env[name] = parsValue(process.env[name]); + env[name] = parseValue(process.env[name]); }); return env; diff --git a/lib/parsEnvironmentFileString.js b/lib/parseEnvironmentFileString.js similarity index 77% rename from lib/parsEnvironmentFileString.js rename to lib/parseEnvironmentFileString.js index d535e8c..34d6f74 100644 --- a/lib/parsEnvironmentFileString.js +++ b/lib/parseEnvironmentFileString.js @@ -3,25 +3,25 @@ const os = require('os'); const { filterCommentInLines } = require('./filter/filterCommentInLines'); const { filterCommentLines } = require('./filter/filterCommentLines'); const { filterEmptyLines } = require('./filter/filterEmptyLines'); -const { parsValue } = require('./parsValue'); +const { parseValue } = require('./parseValue'); const { removeQuotationMarks } = require('./filter/removeQuotationMarks'); const { replaceNestedChars } = require('./replaceNestedChars'); /** * This function parse the environment file to an Object * - * @function parsEnvironmentFileString + * @function parseEnvironmentFileString * * @param {string} environmentString * @returns {object} **parsed environment variables** */ -const parsEnvironmentFileString = (environmentString) => { +const parseEnvironmentFileString = (environmentString) => { const env = {}; const environmentFileArray = environmentString.split(os.EOL); - const parsFilterEmptyLines = filterEmptyLines(environmentFileArray); - const parsFilterCommentLines = filterCommentLines(parsFilterEmptyLines); + const parseFilterEmptyLines = filterEmptyLines(environmentFileArray); + const parseFilterCommentLines = filterCommentLines(parseFilterEmptyLines); - parsFilterCommentLines.filter((val) => { + parseFilterCommentLines.filter((val) => { const splitVal = val.split('='); splitVal[0] = removeQuotationMarks(splitVal[0]); splitVal[1] = removeQuotationMarks(splitVal[1]); @@ -38,7 +38,7 @@ const parsEnvironmentFileString = (environmentString) => { } } - splitVal[1] = parsValue(splitVal[1]); + splitVal[1] = parseValue(splitVal[1]); splitVal[1] = filterCommentInLines(splitVal[1]); splitVal[0] = splitVal[0].trim(); if (typeof splitVal[1] === 'string') { @@ -51,4 +51,4 @@ const parsEnvironmentFileString = (environmentString) => { return env; }; -module.exports = { parsEnvironmentFileString }; +module.exports = { parseEnvironmentFileString }; diff --git a/lib/parsValue.js b/lib/parseValue.js similarity index 79% rename from lib/parsValue.js rename to lib/parseValue.js index 6f42463..131bcb5 100644 --- a/lib/parsValue.js +++ b/lib/parseValue.js @@ -7,7 +7,7 @@ * @param {(object|string)} value * @returns {(object|string)} **value** */ -const parsValue = (value) => { +const parseValue = (value) => { try { return JSON.parse(value); } catch (exception) { @@ -15,4 +15,4 @@ const parsValue = (value) => { } }; -module.exports = { parsValue }; +module.exports = { parseValue }; diff --git a/lib/processenv2.js b/lib/processenv2.js index 2109d7f..42cfd7a 100644 --- a/lib/processenv2.js +++ b/lib/processenv2.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const { getProcessEnv } = require('./getProcessEnv'); -const { parsEnvironmentFileString } = require('./parsEnvironmentFileString'); +const { parseEnvironmentFileString } = require('./parseEnvironmentFileString'); /** * With **processenv2** you have the opportunity to use environment variables directly in your project. @@ -26,7 +26,7 @@ const processenv = (key, defaultValue) => { if (fs.existsSync(environmentFile)) { const readEnvironmentFile = fs.readFileSync(environmentFile, 'utf-8').trim(); - const parsedEnvironmentFile = parsEnvironmentFileString(readEnvironmentFile); + const parsedEnvironmentFile = parseEnvironmentFileString(readEnvironmentFile); env = { ...env, ...parsedEnvironmentFile }; // eslint-disable-next-line no-undef diff --git a/package.json b/package.json index 0155fc2..a99d8ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "processenv2", - "version": "2.0.1", + "version": "2.0.2", "description": "parse .env files to load variables to the process.env property automatically", "main": "lib/processenv2.js", "scripts": {