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

featurama

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

featurama - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

.gitattributes

18

dist/featurama-client-ko.js

@@ -22,8 +22,6 @@ 'use strict';

if (featureList.hasOwnProperty(key)) {
var _enabled = eval(featureList[key]);
if (typeof _enabled === 'function') {
list[key] = _enabled();
if (typeof featureList[key] === 'function') {
list[key] = ko.observable(featureList[key]());
} else {
list[key] = _enabled;
list[key] = ko.observable(featureList[key]);
}

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

function on(featureName) {
list[featureName] = true;
list[featureName](true);
}

@@ -50,3 +48,3 @@

function off(featureName) {
list[featureName] = false;
list[featureName](false);
}

@@ -60,3 +58,7 @@

function enabled(featureName) {
return list[featureName];
if (list[featureName]) {
return list[featureName]();
}
return false;
}

@@ -63,0 +65,0 @@

@@ -22,8 +22,6 @@ 'use strict';

if (featureList.hasOwnProperty(key)) {
var _enabled = eval(featureList[key]);
if (typeof _enabled === 'function') {
list[key] = _enabled();
if (typeof featureList[key] === 'function') {
list[key] = featureList[key]();
} else {
list[key] = _enabled;
list[key] = featureList[key];
}

@@ -58,3 +56,7 @@ }

function enabled(featureName) {
return list[featureName];
if (list[featureName]) {
return list[featureName];
}
return false;
}

@@ -61,0 +63,0 @@

{
"name": "featurama",
"version": "0.1.2",
"version": "0.1.3",
"description": "Enable/Disable features via JS config files.",

@@ -5,0 +5,0 @@ "main": "src/featurama.js",

'use strict';
let proxyquire = require('proxyquire');
let fs = require('fs');

@@ -13,3 +12,2 @@ let path = require('path');

it('will copy runTimeEnabled functions to the `runTimeFlags` file', () => {
// var foo = proxyquire('./foo', { 'path': '../fixtures/bothEnabled.js' });
spyOn(fs, 'writeFile');

@@ -19,4 +17,4 @@ featurama.buildRunTimeConfigFile('spec/');

expect(fs.writeFile).toHaveBeenCalledWith(path.resolve(__dirname, 'runTimeFlags.js'),
'var featuramaRunTimeFlags = {"bothEnabled":true,"buildEnabledRuntimeDisabled":false}');
'var featuramaRunTimeFlags = {"bothEnabled": true,"bothEnabledRuntimeFunc": function () { return true; },"buildEnabledRuntimeDisabled": false}');
});
});

@@ -22,8 +22,6 @@ 'use strict';

if (featureList.hasOwnProperty(key)) {
let enabled = eval(featureList[key]);
if (typeof enabled === 'function') {
list[key] = enabled();
if (typeof featureList[key] === 'function') {
list[key] = ko.observable(featureList[key]());
} else {
list[key] = enabled;
list[key] = ko.observable(featureList[key]);
}

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

function on(featureName) {
list[featureName] = true;
list[featureName](true);
}

@@ -50,3 +48,3 @@

function off(featureName) {
list[featureName] = false;
list[featureName](false);
}

@@ -60,3 +58,7 @@

function enabled(featureName) {
return list[featureName];
if (list[featureName]) {
return list[featureName]();
}
return false;
}

@@ -63,0 +65,0 @@

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

var featurama = (function () {
var featurama = (function() {
let list = {};

@@ -23,8 +23,6 @@

if (featureList.hasOwnProperty(key)) {
let enabled = eval(featureList[key]);
if (typeof enabled === 'function') {
list[key] = enabled();
if (typeof featureList[key] === 'function') {
list[key] = featureList[key]();
} else {
list[key] = enabled;
list[key] = featureList[key];
}

@@ -59,3 +57,7 @@ }

function enabled(featureName) {
return list[featureName];
if (list[featureName]) {
return list[featureName];
}
return false;
}

@@ -62,0 +64,0 @@

@@ -144,4 +144,4 @@ 'use strict';

function buildRunTimeConfigFile(outputFolder) {
const runTimeFlags = {};
const files = _getFeatureFiles();
let runTimeFlags = '{';

@@ -154,13 +154,12 @@ files.forEach((file) => {

const keyName = file.match(/(.*)\.js/)[1].replace('.', '');
let value = data.runTimeEnabled;
const value = data.runTimeEnabled;
if (typeof data.runTimeEnabled === 'function') {
value = `(${data.runTimeEnabled.toString()})`;
if (value) {
runTimeFlags += `"${keyName}": ${value.toString().replace(/\n/g, '')},`;
}
runTimeFlags[keyName] = value;
}
});
fs.writeFile(path.resolve(outputFolder, 'runTimeFlags.js'), 'var featuramaRunTimeFlags = ' + JSON.stringify(runTimeFlags));
runTimeFlags = _.trim(runTimeFlags, ',') + '}';
fs.writeFile(path.resolve(outputFolder, 'runTimeFlags.js'), 'var featuramaRunTimeFlags = ' + runTimeFlags);

@@ -167,0 +166,0 @@ return JSON.stringify(runTimeFlags)

Sorry, the diff of this file is not supported yet

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