mirror of https://github.com/xwiki-labs/cryptpad
implement Util.both
This commit is contained in:
parent
89d6a7ad76
commit
bcbe561bbf
|
@ -1,6 +1,14 @@
|
|||
(function (window) {
|
||||
var Util = {};
|
||||
|
||||
Util.both = function (pre, post) {
|
||||
if (typeof(post) !== 'function') { post = function (x) { return x; }; }
|
||||
return function () {
|
||||
pre.apply(null, arguments);
|
||||
return post.apply(null, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
Util.tryParse = function (s) {
|
||||
try { return JSON.parse(s); } catch (e) { return;}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue