Socket
Socket
Sign inDemoInstall

babel-plugin-feature-flags

Package Overview
Dependencies
16
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

14

index.js

@@ -0,1 +1,3 @@

var stringify = require('json-stable-stringify');
module.exports = function(options) {

@@ -27,3 +29,3 @@ options = options || {};

return function(babel) {
function babelPluginFeatureFlags(babel) {
var t = babel.types;

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

});
}
babelPluginFeatureFlags.baseDir = function() {
return __dirname;
};
babelPluginFeatureFlags.cacheKey = function() {
return stringify(options);
};
return babelPluginFeatureFlags;
};

@@ -51,0 +63,0 @@

5

package.json
{
"name": "babel-plugin-feature-flags",
"version": "0.2.1",
"version": "0.2.2",
"description": "A babel transform for managing feature flags",

@@ -26,3 +26,6 @@ "main": "index.js",

"mocha": "^2.2.5"
},
"dependencies": {
"json-stable-stringify": "^1.0.1"
}
}

@@ -31,3 +31,3 @@ var assert = require('assert');

}
}
};

@@ -56,2 +56,38 @@ testFixture('if/enabled', options);

testFixture('preserves-other-imports', options);
it('provides a baseDir', function() {
var expectedPath = path.join(__dirname, '..');
var featureFlagInstance = applyFeatureFlags({
import: {
module: 'features'
}
});
assert.equal(featureFlagInstance.baseDir(), expectedPath);
});
it('includes options in `cacheKey`', function() {
var first = applyFeatureFlags({
import: {
module: 'features'
},
features: {
foo: 'enabled',
bar: 'disabled'
}
});
var second = applyFeatureFlags({
import: {
module: 'features'
},
features: {
foo: 'enabled',
bar: 'dynamic'
}
});
assert.notEqual(first.cacheKey(), second.cacheKey());
});
});
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