Files

36 lines
925 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# KlonlanmaLal.js — parseCommand() (satır 711)
[← KlonlanmaLal.js](index.md) · [← Master](../../wiki.md)
```javascript
function parseCommand(raw) {
var s = trim(raw);
if (s.length === 0) return null;
var klonAt = lower(s).indexOf("!klon");
if (klonAt > 0) {
s = trim(s.substring(klonAt));
}
if (s.charAt(0) === "/" || s.charAt(0) === "!") {
s = trim(s.substring(1));
}
var space = s.indexOf(" ");
var token = space < 0 ? s : s.substring(0, space);
var args = space < 0 ? "" : trim(s.substring(space + 1));
var cmd = lower(token).replace(/\u0131/g, "i");
var compact = cmd.match(/^klon(\d+)$/);
if (compact) {
return { cmd: "klon", args: compact[1] };
}
if (cmd === "klon" || cmd === "clone" || cmd === "klonlanma") {
return { cmd: cmd, args: args };
}
return null;
}
```