Comparing version 0.0.3 to 0.0.4
// Generated by CoffeeScript 1.6.3 | ||
var featured, fs, functionName, generatedFunctionName, path, rules; | ||
fs = require('fs'); | ||
featured = void 0; | ||
path = require('path'); | ||
fs = void 0; | ||
functionName = void 0; | ||
generatedFunctionName = void 0; | ||
path = void 0; | ||
rules = void 0; | ||
fs = require("fs"); | ||
path = require("path"); | ||
featured = exports; | ||
@@ -12,14 +24,17 @@ | ||
functionName = ''; | ||
functionName = ""; | ||
generatedFunctionName = ''; | ||
generatedFunctionName = ""; | ||
featured.configure = function(opts) { | ||
var defaults, key, val; | ||
defaults = void 0; | ||
key = void 0; | ||
val = void 0; | ||
defaults = { | ||
file: './rules.js', | ||
functionName: '__featured', | ||
generatedFunctionName: '__featuredStatic' | ||
file: "./rules.js", | ||
functionName: "__featured", | ||
generatedFunctionName: "__featuredStatic" | ||
}; | ||
opts = opts != null ? opts : {}; | ||
opts = (opts != null ? opts : {}); | ||
for (key in defaults) { | ||
@@ -42,2 +57,5 @@ val = defaults[key]; | ||
var key, value, __featured; | ||
key = void 0; | ||
value = void 0; | ||
__featured = void 0; | ||
__featured = function(featureName) { | ||
@@ -51,3 +69,5 @@ return featured.checkFeature(featureName, req.session); | ||
} | ||
res.locals[generatedFunctionName] = 'var ' + functionName + ' = function(featureName){return ' + functionName + '.defaults[featureName] || false;}' + '; ' + functionName + '.defaults = ' + JSON.stringify(__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({ | ||
d: encodeURIComponent(JSON.stringify(__featured.defaults)) | ||
}); | ||
res.locals[functionName] = __featured; | ||
@@ -60,13 +80,15 @@ req[functionName] = __featured; | ||
var rule, _ref; | ||
if ((session != null ? (_ref = session[functionName]) != null ? _ref[featureName] : void 0 : void 0) != null) { | ||
rule = void 0; | ||
_ref = void 0; | ||
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') { | ||
if (typeof rule === "function") { | ||
return rule(session); | ||
@@ -73,0 +95,0 @@ } |
{ | ||
"name": "featured", | ||
"description": "feature flags for node", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"homepage": "http://github.com/proksoup/featured", | ||
@@ -6,0 +6,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
8518
87