Skip to content

Commit 6da6f7a

Browse files
committed
added splitTitle function
1 parent 3589f61 commit 6da6f7a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

utils.js

+16
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,21 @@ var loginClient = function(client, tries) {
6969
});
7070
};
7171

72+
var splitTitle = function(title) {
73+
title = title || "";
74+
75+
if(typeof title === "string") {
76+
if(title.indexOf('-') >= 0)
77+
title = title.split('-').map(function(str) { return str.trim(); });
78+
else if(title.indexOf(' ') >= 0)
79+
title = title.split(' ').map(function(str) { return str.trim(); });
80+
else
81+
title = [title, title];
82+
}
83+
84+
return title;
85+
};
86+
7287
var decode = function(str) {
7388
if(typeof str !== "string")
7489
return str;
@@ -84,5 +99,6 @@ var decode = function(str) {
8499
exports.setErrorMessage = setErrorMessage;
85100
exports.createIterator = createIterator;
86101
exports.loginClient = loginClient;
102+
exports.splitTitle = splitTitle;
87103
exports.waterfall = waterfall;
88104
exports.decode = decode;

0 commit comments

Comments
 (0)