Fully end to end encrypted anonymous chat program. Server only stores public key lookup for users and the encrypted messages. No credentials are transfered to the server, but kept in local browser storage. This allows 100% safe chatting. https://safechat.ch
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.
 
 
 
 
 
 

43 lines
1008 B

var utils = require('../utils')
, nodes = require('../nodes');
var VALID_FLAGS = 'igm';
/**
* retrieves the matches when matching a `val`(string)
* against a `pattern`(regular expression).
*
* Examples:
* $regex = '^(height|width)?([<>=]{1,})(.*)'
*
* match($regex,'height>=sm')
* // => ('height>=sm' 'height' '>=' 'sm')
* // => also truthy
*
* match($regex, 'lorem ipsum')
* // => null
*
* @param {String} pattern
* @param {String|Ident} val
* @param {String|Ident} [flags='']
* @return {String|Null}
* @api public
*/
module.exports = function match(pattern, val, flags){
utils.assertType(pattern, 'string', 'pattern');
utils.assertString(val, 'val');
var re = new RegExp(pattern.val, validateFlags(flags) ? flags.string : '');
return val.string.match(re);
};
function validateFlags(flags) {
flags = flags && flags.string;
if (flags) {
return flags.split('').every(function(flag) {
return ~VALID_FLAGS.indexOf(flag);
});
}
return false;
}