Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

creature-features

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

creature-features - npm Package Compare versions

Comparing version 0.0.1 to 1.0.0

features/default.json

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"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc