ac-rsg
v1.0.2
Published
ACMOBA result generator
Downloads
2
Readme
#Simple Demo
##Code
var rsg = require('ac-rsg');
console.log(rsg.resultOK('success'));
console.log(rsg.resultFailed('resultFailed'));
console.log(rsg.resultError('resultError'));
console.log(rsg.resultOK({a: 123}));
console.log(rsg.resultOK({
a : 234,
message: 'yes'
}));
console.log(rsg.resultFailed({a: 345}));
console.log(rsg.resultFailed({
a : 456,
message: 'no'
}));
console.log(rsg.resultError({a: 345}));
console.log(rsg.resultError({
a : 456,
message: 'no'
}));
##Output
{ code: 0, message: 'success' }
{ code: 1000, message: 'resultFailed' }
{ code: 2000, message: 'resultError' }
{ code: 0, a: 123, message: 'success' }
{ code: 0, a: 234, message: 'yes' }
{ code: 1000, a: 345, message: 'some error(1000)' }
{ code: 1000, a: 456, message: 'no' }
{ code: 2000, a: 345, message: 'some error(2000)' }
{ code: 2000, a: 456, message: 'no' }