@cypress/env-or-json-file
Advanced tools
Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "@cypress/env-or-json-file", | ||
"description": "Loads JSON object from environment string or local file", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"author": "Gleb Bahmutov <gleb.bahmutov@gmail.com>", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/cypress-io/env-or-json-file/issues", |
@@ -50,2 +50,13 @@ # @cypress/env-or-json-file | ||
## Filename | ||
Given a filename with path, function `filenameToShellVariable` converts it to | ||
environment key name, normalizing slashes and dots. | ||
```js | ||
const {filenameToShellVariable} = require('@cypress/env-or-json-file') | ||
filenameToShellVariable('foo/bar/.me.json') | ||
// foo_bar__me_json | ||
``` | ||
## Tips | ||
@@ -52,0 +63,0 @@ |
@@ -13,3 +13,6 @@ const path = require('path') | ||
const rep = '_' | ||
return filename.replace(/\//g, rep).replace(/\./g, rep).replace(/-/g, rep) | ||
return filename | ||
.replace(/\//g, rep) | ||
.replace(/\./g, rep) | ||
.replace(/-/g, rep) | ||
} | ||
@@ -52,3 +55,4 @@ | ||
module.exports = { | ||
configFromEnvOrJsonFile | ||
configFromEnvOrJsonFile, | ||
filenameToShellVariable | ||
} |
7743
49
110