Socket
Socket
Sign inDemoInstall

feature-flagger

Package Overview
Dependencies
43
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.0.4

4

dist/index.js

@@ -20,3 +20,3 @@ 'use strict';

headers: {
'FFVERSIONKEY': 'dd945370f0fd4eaeab6f580dca4bf546'
'FFVERSIONKEY': projectId
},

@@ -56,3 +56,3 @@ body: '{}'

this.onError = onError;
this.flags = {};
this.flags = (global || window).default_flags || {};
getData();

@@ -59,0 +59,0 @@ }

@@ -24,3 +24,4 @@ var path = require('path');

console.log('Listening at http://localhost:3000/');
});
import React, {Component} from 'react';
import featureFlagger from 'feature-flagger';
import featureFlagger from './feature-flagger';
//Define default flags
(window || global).default_flags = {
default_feature: true
};
export default class App extends Component {

@@ -12,9 +18,12 @@ constructor(props, context) {

featureFlagger.init('dd945370f0fd4eaeab6f580dca4bf546', handleFlags, handleFlagsError);
featureFlagger.startListening();
}
render() {
const {display_ads} = featureFlagger.flags;
const {display_ads, default_feature} = featureFlagger.flags;
return (
<div>
{JSON.stringify(featureFlagger.flags)}
Hi
{display_ads && (

@@ -25,2 +34,6 @@ <div>

)}
{default_feature && (
<div>div</div>
)}
</div>

@@ -27,0 +40,0 @@ );

@@ -10,3 +10,3 @@ import 'whatwg-fetch';

headers: {
'FFVERSIONKEY': 'dd945370f0fd4eaeab6f580dca4bf546'
'FFVERSIONKEY': projectId
},

@@ -13,0 +13,0 @@ body: '{}'

@@ -10,3 +10,3 @@ import 'whatwg-fetch';

headers: {
'FFVERSIONKEY': 'dd945370f0fd4eaeab6f580dca4bf546'
'FFVERSIONKEY': projectId
},

@@ -19,5 +19,5 @@ body: '{}'

if (accountfeatures) {
for (var i = 0;i<accountfeatures.length;i++){
for (var i = 0; i < accountfeatures.length; i++) {
const feature = accountfeatures[i];
res[feature.feature.name.toLowerCase().replace(/ /g,'_')] = feature.enabled;
res[feature.feature.name.toLowerCase().replace(/ /g, '_')] = feature.enabled;
}

@@ -38,3 +38,3 @@ }

this.onError = onError;
this.flags = {};
this.flags = (global||window).default_flags || {};
getData();

@@ -41,0 +41,0 @@ }

{
"name": "feature-flagger",
"version": "0.0.1",
"version": "0.0.4",
"description": "Feature flagging to support continuous development",
"main": "./dist/index.js",
"scripts": {
"postinstall":"npm run build",
"prepublish":"npm run build",
"refresh": "cd ./example && rm -rf ./node_modules/feature-flagger && npm i",
"start": "cd ./example && npm start",
"build": "babel ./index.js --presets babel-preset-es2015 --out-dir dist"
"build": "babel ./index.js --presets babel-preset-es2015 --out-dir dist",
"watch": "nodemon --watch index.js --exec 'npm run build & npm run refresh'"
},

@@ -12,0 +13,0 @@ "repository": {

@@ -29,7 +29,5 @@ Feature Flagger

#Developing
Edit ``index.js`` and run the following to see the changes in the example app
Watches index changes and npm installs on example
```
npm run refresh
npm run watch
```
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc