refactor (minor): replace substr with substring

This commit is contained in:
naskya 2024-04-07 19:10:26 +09:00
parent 15ddde2431
commit 9df08ea16a
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
10 changed files with 12 additions and 12 deletions

View file

@ -306,7 +306,7 @@ export default abstract class Chart<T extends Schema> {
k.startsWith(columnPrefix),
) as (keyof Columns<T>)[]) {
kvs[
(k as string).substr(columnPrefix.length).split(columnDot).join(".")
(k as string).substring(columnPrefix.length).split(columnDot).join(".")
] = x[k];
}
return kvs as KVs<T>;

View file

@ -27,11 +27,11 @@
<p class="name">
<span>{{
file.name.lastIndexOf(".") != -1
? file.name.substr(0, file.name.lastIndexOf("."))
? file.name.substring(0, file.name.lastIndexOf("."))
: file.name
}}</span>
<span v-if="file.name.lastIndexOf('.') != -1" class="ext">{{
file.name.substr(file.name.lastIndexOf("."))
file.name.substring(file.name.lastIndexOf("."))
}}</span>
</p>
</div>

View file

@ -45,7 +45,7 @@ const ce = computed(() => props.customEmojis ?? instance.emojis ?? []);
const customEmoji = computed(() =>
isCustom.value
? ce.value.find(
(x) => x.name === props.emoji.substr(1, props.emoji.length - 2),
(x) => x.name === props.emoji.substring(1, props.emoji.length - 1),
)
: null,
);

View file

@ -98,7 +98,7 @@ onMounted(() => {
connection.on("stats", onStats);
connection.on("statsLog", onStatsLog);
connection.send("requestLog", {
id: Math.random().toString().substr(2, 8),
id: Math.random().toString().substring(2, 10),
length: 100,
});
});

View file

@ -82,7 +82,7 @@ os.api("admin/ad/list").then((adsResponse) => {
ads.value = adsResponse;
// The date format should be changed to yyyy-MM-dd in order to be properly displayed
for (const i in ads.value) {
ads.value[i].expiresAt = ads.value[i].expiresAt.substr(0, 10);
ads.value[i].expiresAt = ads.value[i].expiresAt.substring(0, 10);
}
});

View file

@ -128,7 +128,7 @@ onMounted(() => {
connection.on("stats", onStats);
connection.on("statsLog", onStatsLog);
connection.send("requestLog", {
id: Math.random().toString().substr(2, 8),
id: Math.random().toString().substring(2, 10),
length: 200,
});
});

View file

@ -212,7 +212,7 @@ connection.on("stats", onStats);
connection.on("statsLog", onStatsLog);
connection.send("requestLog", {
id: Math.random().toString().substr(2, 8),
id: Math.random().toString().substring(2, 10),
length: 1,
});

View file

@ -112,7 +112,7 @@ onMounted(() => {
props.connection.on("stats", onStats);
props.connection.on("statsLog", onStatsLog);
props.connection.send("requestLog", {
id: Math.random().toString().substr(2, 8),
id: Math.random().toString().substring(2, 10),
});
});

View file

@ -66,7 +66,7 @@ onMounted(() => {
props.connection.on("stats", onStats);
props.connection.on("statsLog", onStatsLog);
props.connection.send("requestLog", {
id: Math.random().toString().substr(2, 8),
id: Math.random().toString().substring(2, 10),
});
});

View file

@ -47,8 +47,8 @@ export class Parser extends EventEmitter {
if (root.length !== 2) continue;
// remove event and data markers
const event: string = root[0].substr(7);
const data: string = root[1].substr(6);
const event: string = root[0].substring(7);
const data: string = root[1].substring(6);
let jsonObj = {};
try {