Last active
September 24, 2015 08:15
-
-
Save Kequc/132a0fefa707f6b12d36 to your computer and use it in GitHub Desktop.
Find da memory leak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// `domains` is a global containing valid domains grouped by keys | |
// this module is instantiated via require at the top of some file and | |
// the following is run once per request: | |
// Origin.foundKey(blah, blah); | |
// some origin stuff | |
var _ = require('underscore'); | |
module.exports = { | |
list: function (arr) { | |
var result = []; | |
_.each(arr || [], function (domain) { | |
result.push('http://' + domain); | |
result.push('https://' + domain); | |
result.push('http://www.' + domain); | |
result.push('https://www.' + domain); | |
}); | |
return result; | |
}, | |
foundKey: function (key, origin) { | |
return _.contains(this.list(domains[key]), origin); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment