creature-features
Advanced tools
Comparing version 0.0.1 to 1.0.0
40
index.js
@@ -1,1 +0,39 @@ | ||
throw new Error('This does not do anything -- Yet'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const endWith = require('end-with'); | ||
module.exports = function (config) { | ||
let env, featuresFile, baseFeatures, overrides, locationBase = './features/'; | ||
if (arguments.length === 0) { | ||
env = process.env.NODE_ENV || 'development'; | ||
} else { | ||
if (typeof config ==='string'){ | ||
env = config | ||
} else { //config is believed to be an object | ||
env = config.env ? config.env : process.env.NODE_ENV; | ||
overrides = config; | ||
delete overrides.env; | ||
if (overrides.location) { | ||
locationBase = endWith(overrides.location, '/') ? overrides.location : overrides.location + '/'; | ||
} | ||
} | ||
} | ||
featuresFile = `${locationBase}${env}.json`; | ||
baseFeatures = `${locationBase}default.json`; | ||
const featuresFiles = [baseFeatures, featuresFile]; | ||
if (env === 'development') { | ||
// look for a "named" development file | ||
const files = fs.readdirSync(path.join( process.cwd(), './features')); | ||
for (var i = 0; i < files.length; i++) { | ||
if(files[i].indexOf('development.') > -1 && files[i] !== 'development.json') { | ||
featuresFiles.push('./features/'+ files[i]); | ||
} | ||
}; | ||
} | ||
const requiredFeatures = featuresFiles.map((file) => require(file)); | ||
return Object.assign(...requiredFeatures); | ||
} |
{ | ||
"name": "creature-features", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "Feature flags for node.js", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "tape test/*.js" | ||
"test": "cross-env NODE_ENV=test ava test/*.js", | ||
"cov": "cross-env NODE_ENV=test nyc ava test/*.js" | ||
}, | ||
@@ -30,4 +31,10 @@ "repository": { | ||
"devDependencies": { | ||
"ava": "^0.17.0", | ||
"cross-env": "^3.1.3", | ||
"nyc": "^10.0.0", | ||
"tape": "^4.6.3" | ||
}, | ||
"dependencies": { | ||
"end-with": "^1.0.2" | ||
} | ||
} |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
7354
13
127
0
0
48
0
1
4
4
+ Addedend-with@^1.0.2
+ Addedend-with@1.0.2(transitive)