@kofile/config-factory
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -5,2 +5,3 @@ const EventEmitter = require('events') | ||
const clone = require('clone') | ||
const Just = require('./Just') | ||
@@ -15,3 +16,5 @@ const INVALID = 'invalid' | ||
if (typeof map[key] === 'string') { | ||
if (map[key].isJust) { | ||
value = map[key].value | ||
} else if (typeof map[key] === 'string') { | ||
value = options.returnSchemata ? undefined : env[map[key]] | ||
@@ -82,2 +85,4 @@ } else if (Array.prototype.isPrototypeOf(map[key])) { | ||
module.exports = map => env => new Config({ map, env }) | ||
exports.Just = Just | ||
module.exports = Object.assign(map => env => new Config({ map, env }), exports) |
@@ -1,1 +0,1 @@ | ||
{"name":"@kofile/config-factory","version":"1.0.2","description":"Config client with optional validation","author":"Evan Sherwood <evan@sherwood.io>","license":"MIT","main":"index.js","files":["index.js"],"devDependencies":{"ava":"^0.22.0","commitizen":"^2.9.6","coveralls":"^2.13.1","cz-cli":"^1.0.0","cz-conventional-changelog":"^2.0.0","husky":"^0.13.4","lint-staged":"^3.6.0","nyc":"^11.1.0","prettier-standard":"^6.0.0","semantic-release":"^8.2.0","sinon":"^4.0.1","snazzy":"^7.0.0","standard":"^10.0.3"},"lint-staged":{"*.js":["prettier-standard","git add"]},"scripts":{"precommit":"lint-staged","commit":"git-cz","lint":"standard | snazzy","test":"nyc ava","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"config":{"commitizen":{"path":"node_modules/cz-conventional-changelog"}},"nyc":{"include":["index.js"]},"repository":{"type":"git","url":"https://github.com/kofile/config-factory.git"},"dependencies":{"clone":"^2.1.1","joi":"^13.0.0"}} | ||
{"name":"@kofile/config-factory","version":"1.1.0","description":"Config client with optional validation","author":"Evan Sherwood <evan@sherwood.io>","license":"MIT","main":"index.js","files":["index.js","Just.js"],"devDependencies":{"ava":"^0.22.0","commitizen":"^2.9.6","coveralls":"^2.13.1","cz-cli":"^1.0.0","cz-conventional-changelog":"^2.0.0","husky":"^0.13.4","lint-staged":"^3.6.0","nyc":"^11.1.0","prettier-standard":"^6.0.0","semantic-release":"^8.2.0","sinon":"^4.0.1","snazzy":"^7.0.0","standard":"^10.0.3"},"lint-staged":{"*.js":["prettier-standard","git add"]},"scripts":{"precommit":"lint-staged","commit":"git-cz","lint":"standard | snazzy","test":"nyc ava","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"config":{"commitizen":{"path":"node_modules/cz-conventional-changelog"}},"nyc":{"include":["index.js","Just.js"]},"repository":{"type":"git","url":"https://github.com/kofile/config-factory.git"},"dependencies":{"clone":"^2.1.1","joi":"^13.0.0"}} |
@@ -87,2 +87,15 @@ # ConfigFactory | ||
Lastly, you can also set hard-coded values by using `Just`: | ||
```js | ||
const makeConfigFactory = require('@kofile/config-factory') | ||
const { Just } = makeConfigFactory | ||
const map = { myCoolNewKey: Just('a boring string') } | ||
const configFactory = makeConfigFactory(map) | ||
const config = configFactory(process.env) | ||
config.get(['myCoolNewKey']) === 'a boring string' | ||
``` | ||
## Why? | ||
@@ -89,0 +102,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7863
4
78
119