Repository: typeorm/typeorm
File: src/query-builder/SelectQueryBuilder.ts (TypeScript)

Code before:
        mapToProperty?: string,
        isMappingMany?: boolean,
        mapAsEntity?: Function | string,
    ): void {
        if (parameters) {
            this.setParameters(parameters)
        }

        const joinAttribute = new JoinAttribute(
            this.connection,
            this.expressionMap,
        )
        joinAttribute.direction = direction
        joinAttribute.mapAsEntity = mapAsEntity
        joinAttribute.mapToProperty = mapToProperty
        joinAttribute.isMappingMany = isMappingMany
        joinAttribute.entityOrProperty = entityOrProperty // relationName
        joinAttribute.condition = condition // joinInverseSideCondition
        // joinAttribute.junctionAlias = joinAttribute.relation.isOwning ? parentAlias + "_" + destinationTableAlias : destinationTableAlias + "_" + parentAlias;
        this.expressionMap.joinAttributes.push(joinAttribute)
        const isEntity = this.connection.hasMetadata(entityOrProperty)
        const isSubQuery =
            (!isEntity && typeof entityOrProperty === "function") ||
            (typeof entityOrProperty === "string" &&
                entityOrProperty.substr(0, 1) === "(" &&
                entityOrProperty.substr(-1) === ")")

        let subQuery: string = ""
        if (isSubQuery) {
            if (typeof entityOrProperty === "string") {
                subQuery = entityOrProperty
            } else {
                const subQueryBuilder: SelectQueryBuilder<any> = (
                    entityOrProperty as any
                )((this as any as SelectQueryBuilder<any>).subQuery())
                this.setParameters(subQueryBuilder.getParameters())
                subQuery = subQueryBuilder.getQuery()
            }
        }

        const joinAttributeMetadata = joinAttribute.metadata
        if (joinAttributeMetadata) {
            if (
                joinAttributeMetadata.deleteDateColumn &&
                !this.expressionMap.withDeleted
            ) {
                const conditionDeleteColumn = `${aliasName}.${joinAttributeMetadata.deleteDateColumn.propertyName} IS NULL`
                joinAttribute.condition = joinAttribute.condition
                    ? ` ${joinAttribute.condition} AND ${conditionDeleteColumn}`
                    : `${conditionDeleteColumn}`
            }

Review comment (suggestion):
[String.startsWith()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith) and [String.endsWith()](  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith) should be simpler to read :)

Code after:
        mapToProperty?: string,
        isMappingMany?: boolean,
        mapAsEntity?: Function | string,
    ): void {
        if (parameters) {
            this.setParameters(parameters)
        }

        const joinAttribute = new JoinAttribute(
            this.connection,
            this.expressionMap,
        )
        joinAttribute.direction = direction
        joinAttribute.mapAsEntity = mapAsEntity
        joinAttribute.mapToProperty = mapToProperty
        joinAttribute.isMappingMany = isMappingMany
        joinAttribute.entityOrProperty = entityOrProperty // relationName
        joinAttribute.condition = condition // joinInverseSideCondition
        // joinAttribute.junctionAlias = joinAttribute.relation.isOwning ? parentAlias + "_" + destinationTableAlias : destinationTableAlias + "_" + parentAlias;
        this.expressionMap.joinAttributes.push(joinAttribute)
        const isEntity = this.connection.hasMetadata(entityOrProperty)
        const isSubQuery =
            (!isEntity && typeof entityOrProperty === "function") ||
            (typeof entityOrProperty === "string" &&
                entityOrProperty.startsWith("(") &&
                entityOrProperty.endsWith(")"))

        let subQuery: string = ""
        if (isSubQuery) {
            if (typeof entityOrProperty === "string") {
                subQuery = entityOrProperty
            } else {
                const subQueryBuilder: SelectQueryBuilder<any> = (
                    entityOrProperty as any
                )((this as any as SelectQueryBuilder<any>).subQuery())
                this.setParameters(subQueryBuilder.getParameters())
                subQuery = subQueryBuilder.getQuery()
            }
        }

        const joinAttributeMetadata = joinAttribute.metadata
        if (joinAttributeMetadata) {
            if (
                joinAttributeMetadata.deleteDateColumn &&
                !this.expressionMap.withDeleted
            ) {
                const conditionDeleteColumn = `${aliasName}.${joinAttributeMetadata.deleteDateColumn.propertyName} IS NULL`
                joinAttribute.condition = joinAttribute.condition
                    ? ` ${joinAttribute.condition} AND ${conditionDeleteColumn}`
                    : `${conditionDeleteColumn}`
            }