From fdac6fb121066d70a80a5542f1c23902cb350a1d Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 14 Nov 2013 08:28:37 +0000 Subject: [PATCH] refactor(socket) Util.isContainStrAtBegin -> equalPart --- lib/server/socket.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/server/socket.js b/lib/server/socket.js index 58c54603..b28aa874 100644 --- a/lib/server/socket.js +++ b/lib/server/socket.js @@ -11,6 +11,7 @@ exec = main.child_process.exec, Util = main.util, mainpackage = main.mainpackage, + equalPart = Util.isContainStrAtBegin, CLOUDCMD = mainpackage.name, ClientFuncs = [], OnMessageFuncs = [], @@ -126,9 +127,9 @@ connName = '#' + pConnNum + ': '; Util.log(connName + pCommand); - if (Util.isContainStrAtBegin(pCommand, CLOUDCMD)) + if (equalPart(pCommand, CLOUDCMD)) lRet = onCloudCmd(pCommand); - else if( Util.isContainStrAtBegin(pCommand, 'cd ') ) + else if (equalPart(pCommand, 'cd ')) lRet = onCD(pCommand); if (lRet) @@ -236,10 +237,10 @@ pCommand = Util.removeStr(pCommand, CLOUDCMD); - if( Util.isContainStrAtBegin(pCommand, ' ') ) { + if (equalPart(pCommand, ' ')) { pCommand = Util.removeStr(pCommand, ' '); - if( Util.isContainStrAtBegin(pCommand, 'update') && update ) { + if (equalPart(pCommand, 'update') && update) { update.get(); lRet = { stdout: Util.addNewLine('update: ok')