Compare View

switch
from
...
to
 
Commits (2)

Changes

Showing 2 changed files Inline Diff

1 { 1 {
2 "name": "komodo-sdk", 2 "name": "komodo-sdk",
3 "version": "1.26.0", 3 "version": "1.26.1",
4 "description": "SDK for Komodo", 4 "description": "SDK for Komodo",
5 "main": "index.js", 5 "main": "index.js",
6 "scripts": { 6 "scripts": {
7 "test": "mocha", 7 "test": "mocha",
8 "postversion": "git push && git push --tags" 8 "postversion": "git push && git push --tags"
9 }, 9 },
10 "repository": { 10 "repository": {
11 "type": "git", 11 "type": "git",
12 "url": "git@gitlab.kodesumber.com:komodo/komodo-sdk.git" 12 "url": "git@gitlab.kodesumber.com:komodo/komodo-sdk.git"
13 }, 13 },
14 "keywords": [ 14 "keywords": [
15 "ppob", 15 "ppob",
16 "payment", 16 "payment",
17 "komodo" 17 "komodo"
18 ], 18 ],
19 "author": "Adhidarma Hadiwinoto <gua@adhisimon.org>", 19 "author": "Adhidarma Hadiwinoto <gua@adhisimon.org>",
20 "license": "ISC", 20 "license": "ISC",
21 "dependencies": { 21 "dependencies": {
22 "basic-auth": "^2.0.0", 22 "basic-auth": "^2.0.0",
23 "body-parser": "^1.18.2", 23 "body-parser": "^1.18.2",
24 "dot-object": "^1.7.0", 24 "dot-object": "^1.7.0",
25 "express": "^4.16.3", 25 "express": "^4.16.3",
26 "express-session": "^1.15.6", 26 "express-session": "^1.15.6",
27 "json-query": "^2.2.2", 27 "json-query": "^2.2.2",
28 "lru-cache": "^4.1.1", 28 "lru-cache": "^4.1.1",
29 "macaddress": "^0.2.8", 29 "macaddress": "^0.2.8",
30 "moment": "^2.19.1", 30 "moment": "^2.19.1",
31 "node-machine-id": "^1.1.10", 31 "node-machine-id": "^1.1.10",
32 "node-natural-sort": "^0.8.6", 32 "node-natural-sort": "^0.8.6",
33 "numeral": "^2.0.6", 33 "numeral": "^2.0.6",
34 "nunjucks": "^3.0.1", 34 "nunjucks": "^3.0.1",
35 "redis": "^2.8.0", 35 "redis": "^2.8.0",
36 "request": "^2.81.0", 36 "request": "^2.81.0",
37 "sha1": "^1.1.1", 37 "sha1": "^1.1.1",
38 "simple-git": "^1.80.1", 38 "simple-git": "^1.80.1",
39 "strftime": "^0.10.0", 39 "strftime": "^0.10.0",
40 "uniqid": "^4.1.1", 40 "uniqid": "^4.1.1",
41 "uuid": "^3.1.0", 41 "uuid": "^3.1.0",
42 "winston": "^2.3.1", 42 "winston": "^2.3.1",
43 "winston-circular-buffer": "^1.0.0", 43 "winston-circular-buffer": "^1.0.0",
44 "winston-daily-rotate-file": "^1.4.6" 44 "winston-daily-rotate-file": "^1.4.6"
45 } 45 }
46 } 46 }
47 47
1 "use strict"; 1 "use strict";
2 2
3 function logOnDebug(msg) {
4 if (process.env.KOMODO_SDK_DEBUG_RC_FROM_MSG) {
5 console.log(msg);
6 }
7 }
8
3 function logOnDebug(msg) { 9 function run(msg, rules) {
4 if (process.env.KOMODO_SDK_DEBUG_RC_FROM_MSG) { 10 if (typeof msg !== 'string') return;
5 console.log(msg); 11 if (!rules) return;
6 } 12 if (!rules.length) return;
7 } 13
8 14 const rules_count = rules.length;
9 function run(msg, rules) { 15 for(let i = 0; i < rules_count; i++) {
10 if (typeof msg !== 'string') return; 16 const rule = rules[i];
11 if (!rules) return; 17
18 logOnDebug('RC-FROM-MSG: checking with rule: ' + JSON.stringify(rule));
12 if (!rules.length) return; 19 const re = (typeof rule.flags === 'string') ? new RegExp(rule.pattern, rule.flags) : new RegExp(rule.pattern);
13 20 if (msg.search(re) > 0) {
21 logOnDebug('RC-FROM-MSG: match with rule: ' + JSON.stringify(rule));
14 const rules_count = rules.length; 22 return rule.rc || rule.result;
15 for(let i = 0; i < rules_count; i++) { 23 }
16 const rule = rules[i]; 24 }
17 25 }
18 logOnDebug('RC-FROM-MSG: checking with rule: ' + JSON.stringify(rule)); 26
19 const re = (typeof rule.flags === 'string') ? new RegExp(rule.pattern, rule.flags) : new RegExp(rule.pattern); 27 module.exports = run;
20 if (msg.search(re) > 0) { 28