mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-13 20:08:05 +08:00
🐶 Sync 2026-10-20 22:40:23
This commit is contained in:
1 parent
e813f5cc54
commit
64cea2243a
216 files changed
+11913
-2968
No files matched your search
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
'require baseclass';
|
||||
|
||||
return baseclass.extend({
|
||||
parseAutoJoin: function(val) {
|
||||
if (!val || !val.trim())
|
||||
return { channels: [], keys: [] };
|
||||
|
||||
var trimmed = val.trim();
|
||||
var spaceIdx = trimmed.search(/\s/);
|
||||
if (spaceIdx === -1) {
|
||||
return {
|
||||
channels: trimmed.split(',').map(function(c) { return c.trim(); }).filter(Boolean),
|
||||
keys: []
|
||||
};
|
||||
}
|
||||
|
||||
var firstPart = trimmed.substring(0, spaceIdx).trim();
|
||||
var rest = trimmed.substring(spaceIdx + 1).trim();
|
||||
|
||||
/* Keys are positional, so keep empty ones to stay aligned with channels */
|
||||
return {
|
||||
channels: firstPart.split(',').map(function(c) { return c.trim(); }).filter(Boolean),
|
||||
keys: rest.length ? rest.split(',').map(function(k) { return k.trim(); }) : []
|
||||
};
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user