Move licenseCodes outside function

If this will be a separate file, we might as well.
This commit is contained in:
someguy126 2014-12-13 16:20:15 -08:00 committed by Thaddee Tyl
parent 9883d2bd19
commit c15ffb04f6

View File

@ -135,11 +135,8 @@ var githubLicense = function(user, repo, end) {
}); });
}; };
// Key phrases for common licenses
// Try to guess the license based on the text and return an abbreviated name (or null if not recognized). var licensePhrases = {
var guessLicense = function(text) {
// Key phrases for common licenses
var licensePhrases = {
'Apache 1.1': 'apache (software)? license,? (version)? 1\\.1', 'Apache 1.1': 'apache (software)? license,? (version)? 1\\.1',
'Apache 2': 'apache (software)? license,? (version)? 2', 'Apache 2': 'apache (software)? license,? (version)? 2',
'Original BSD': 'all advertising materials mentioning features or use of this software must display the following acknowledgement', 'Original BSD': 'all advertising materials mentioning features or use of this software must display the following acknowledgement',
@ -166,7 +163,10 @@ var guessLicense = function(text) {
'ISC': 'permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted', 'ISC': 'permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted',
'CC0': 'cc0', 'CC0': 'cc0',
'Unlicense': 'this is free and unencumbered software released into the public domain', 'Unlicense': 'this is free and unencumbered software released into the public domain',
} }
// Try to guess the license based on the text and return an abbreviated name (or null if not recognized).
var guessLicense = function(text) {
var licenseCodes = Object.keys(licensePhrases); var licenseCodes = Object.keys(licensePhrases);
var licenseRegex; var licenseRegex;
var spaceMetaRegex = new RegExp(' ', 'g'); var spaceMetaRegex = new RegExp(' ', 'g');