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 1.0.0 to 2.0.0

.babelrc

43

index.js

@@ -1,13 +0,22 @@

const path = require('path');
const fs = require('fs');
const endWith = require('end-with');
'use strict';
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var path = require('path');
var fs = require('fs');
var endWith = require('end-with');
module.exports = function (config) {
let env, featuresFile, baseFeatures, overrides, locationBase = './features/';
var env = void 0,
featuresFile = void 0,
baseFeatures = void 0,
overrides = void 0,
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
if (typeof config === 'string') {
env = config;
} else {
//config is believed to be an object
env = config.env ? config.env : process.env.NODE_ENV;

@@ -22,12 +31,12 @@ overrides = config;

featuresFile = `${locationBase}${env}.json`;
baseFeatures = `${locationBase}default.json`;
featuresFile = '' + locationBase + env + '.json';
baseFeatures = locationBase + 'default.json';
const featuresFiles = [baseFeatures, featuresFile];
var featuresFiles = [baseFeatures, featuresFile];
if (env === 'development') {
// look for a "named" development file
const files = fs.readdirSync(path.join( process.cwd(), './features'));
var 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]);
if (files[i].indexOf('development.') > -1 && files[i] !== 'development.json') {
featuresFiles.push('./features/' + files[i]);
}

@@ -37,5 +46,7 @@ };

const requiredFeatures = featuresFiles.map((file) => require(file));
var requiredFeatures = featuresFiles.map(function (file) {
return require(file);
});
return Object.assign(...requiredFeatures);
}
return Object.assign.apply(Object, _toConsumableArray(requiredFeatures));
};
{
"name": "creature-features",
"version": "1.0.0",
"version": "2.0.0",
"description": "Feature flags for node.js",
"main": "index.js",
"scripts": {
"build": "babel src -d .",
"pretest": "npm run build",
"test": "cross-env NODE_ENV=test ava test/*.js",

@@ -32,2 +34,4 @@ "cov": "cross-env NODE_ENV=test nyc ava test/*.js"

"ava": "^0.17.0",
"babel-cli": "^6.22.2",
"babel-preset-env": "^1.1.8",
"cross-env": "^3.1.3",

@@ -34,0 +38,0 @@ "nyc": "^10.0.0",

# Creature Features
## Dead simple feature flags
## Dead simple feature flags for node.js
### Install

@@ -48,2 +48,2 @@ ```bash

```
```
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