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

featured

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

featured - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

66

lib/featured.js
// Generated by CoffeeScript 1.6.3
var featured, fs, functionName, generatedFunctionName, path, rules;
featured = void 0;
fs = require('fs');
fs = void 0;
path = require('path');
functionName = void 0;
generatedFunctionName = void 0;
path = void 0;
rules = void 0;
fs = require("fs");
path = require("path");
featured = exports;

@@ -24,21 +12,19 @@

functionName = "";
functionName = '';
generatedFunctionName = "";
generatedFunctionName = '';
featured.configure = function(opts) {
var defaults, key, val;
defaults = void 0;
key = void 0;
val = void 0;
var defaults, key;
if (opts == null) {
opts = {};
}
defaults = {
file: "./rules.js",
functionName: "__featured",
generatedFunctionName: "__featuredStatic"
file: './rules.js',
functionName: '__featured',
generatedFunctionName: '__featuredStatic'
};
opts = (opts != null ? opts : {});
for (key in defaults) {
val = defaults[key];
if (opts[key] == null) {
opts[key] = val;
opts[key] = defaults[key];
}

@@ -56,15 +42,11 @@ }

featured.init = function(req, res, next) {
var key, value, __featured;
key = void 0;
value = void 0;
__featured = void 0;
var key, __featured;
__featured.defaults = {};
__featured = function(featureName) {
return featured.checkFeature(featureName, req.session);
return __featured.defaults[featureName];
};
__featured.defaults = {};
for (key in rules) {
value = rules[key];
__featured.defaults[key] = featured.checkFeature(key, req.session);
__featured.defaults[key] = featured.checkFeature(key, req.session, __featured.defaults);
}
res.locals[generatedFunctionName] = "var " + functionName + " = function(featureName){var s = " + functionName + "; if (s[\"defaults\"] === undefined) { s.defaults = JSON.parse(decodeURIComponent(s.encodedDefaults.d)); s.encodedDefaults = null;} return s.defaults[featureName] || false;}" + "; " + functionName + ".encodedDefaults = " + JSON.stringify({
res.locals[generatedFunctionName] = "var " + functionName + " = function(featureName){var s = " + functionName + "; " + "if (s[\"defaults\"] === undefined) { s.defaults = JSON.parse(decodeURIComponent(s.encodedDefaults.d)); " + "s.encodedDefaults = null;} return typeof s.defaults[featureName] !== \"undefined\" ? s.defaults[featureName] : false;}" + "; " + functionName + ".encodedDefaults = " + JSON.stringify({
d: encodeURIComponent(JSON.stringify(__featured.defaults))

@@ -77,20 +59,18 @@ });

featured.checkFeature = function(featureName, session) {
featured.checkFeature = function(featureName, session, previousFlags) {
var rule, _ref;
rule = void 0;
_ref = void 0;
if ((session != null ? ((_ref = session[functionName]) != null ? _ref[featureName] : void 0) : void 0) != null) {
if ((session != null ? (_ref = session[functionName]) != null ? _ref[featureName] : void 0 : void 0) != null) {
return session[functionName][featureName];
}
rule = rules[featureName];
if (typeof rule === "undefined") {
if (typeof rule === 'undefined') {
return false;
}
if (typeof rule === "boolean") {
if (typeof rule === 'boolean') {
return rule;
}
if (typeof rule === "function") {
return rule(session);
if (typeof rule === 'function') {
return rule(session, previousFlags);
}
return false;
};
{
"name": "featured",
"description": "feature flags for node",
"version": "0.0.4",
"version": "0.0.5",
"homepage": "http://github.com/proksoup/featured",

@@ -6,0 +6,0 @@ "repository": {

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