This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
999 B
42 lines
999 B
/* |
|
--- |
|
name : sg-regex-tools |
|
description : A few super-handy tools for messing around with RegExp |
|
|
|
authors : Thomas Aylott |
|
copyright : © 2010 Thomas Aylott |
|
license : MIT |
|
|
|
provides : [combineRegExp] |
|
... |
|
*/ |
|
;(function(exports){ |
|
|
|
exports.combineRegExp = function(regex, group){ |
|
if (regex.source) regex = [regex] |
|
|
|
var names = [], i, source = '', this_source |
|
|
|
for (i = 0; i < regex.length; ++i){ if (!regex[i]) continue |
|
this_source = regex[i].source || ''+regex[i] |
|
if (this_source == '|') source += '|' |
|
else { |
|
source += (group?'(':'') + this_source.replace(/\s/g,'') + (group?')':'') |
|
if (group) names.push(group) |
|
} |
|
if (regex[i].names) names = names.concat(regex[i].names) |
|
} |
|
try { |
|
regex = new RegExp(source,'gm') |
|
} |
|
catch (e){ |
|
throw new SyntaxError('Invalid Syntax: ' + source +'; '+ e) |
|
} |
|
// [key] → 1 |
|
for (i = -1; i < names.length; ++i) names[names[i]] = i + 1 |
|
// [1] → key |
|
regex.names = names |
|
return regex |
|
} |
|
|
|
}(typeof exports != 'undefined' ? exports : this))
|
|
|