Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/duyehong/CommonTask
Browse files Browse the repository at this point in the history
  • Loading branch information
coding-and-trading committed Nov 15, 2017
2 parents e97b13d + cc619e3 commit 6017242
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion CompanyCommonTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,34 @@ var financialHelper = (function () {
return {
convertCurrency: convertCurrency
}
})();
})();

// 验证相关的方法
var strategies = {
isNumber: function (value) {
return /^[0-9\.]+$/.test(value);
}
};

// assert
var testHelper = {
assert: function (value, msg) {
if (!value) {
throw(msg || (value + " does not equal true"));
}
},
assertEqual: function (val1, val2, msg) {
if (val1 !== val2) {
throw(msg || (val1 + " does not equal " + val2));
}
}
};

var mathHelper = {
guid : function () {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
}).toUpperCase();
}
};

0 comments on commit 6017242

Please sign in to comment.