mirror of
https://github.com/google/blockly.git
synced 2026-01-11 02:47:09 +01:00
chore: Use .includes and .startsWith, not .indexOf (#7936)
Easier to read than the diverse collection of `=== 0` and `!== -1` and `> -1` tests.
This commit is contained in:
@@ -243,8 +243,8 @@ export class PythonGenerator extends CodeGenerator {
|
||||
|
||||
// Follow the CPython behaviour of repr() for a non-byte string.
|
||||
let quote = "'";
|
||||
if (string.indexOf("'") !== -1) {
|
||||
if (string.indexOf('"') === -1) {
|
||||
if (string.includes("'")) {
|
||||
if (!string.includes('"')) {
|
||||
quote = '"';
|
||||
} else {
|
||||
string = string.replace(/'/g, "\\'");
|
||||
|
||||
Reference in New Issue
Block a user