Skip to content

Commit

Permalink
refactor: use ES2023.Array features
Browse files Browse the repository at this point in the history
  • Loading branch information
scolladon committed Jun 13, 2024
1 parent 5df216c commit ab40dc8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/metadata/MetadataRepositoryImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class MetadataRepositoryImpl implements MetadataRepository {

protected searchByExtension(parts: string[]): Metadata | undefined {
const extension = parse(
parts[parts.length - 1].replace(METAFILE_SUFFIX, '')
parts.at(-1)!.replace(METAFILE_SUFFIX, '')
).ext.replace(DOT, '')

if (MetadataRepositoryImpl.UNSAFE_EXTENSION.has(extension)) {
Expand Down
6 changes: 3 additions & 3 deletions src/service/inResourceHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ export default class ResourceHandler extends StandardHandler {
}
resourcePath.push(pathElement)
}
const lastPathElement = resourcePath[resourcePath.length - 1]
const lastPathElement = resourcePath
.at(-1)!
.replace(METAFILE_SUFFIX, '')
.split(DOT)
if (lastPathElement.length > 1) {
lastPathElement.pop()
}

resourcePath[resourcePath.length - 1] = lastPathElement.join(DOT)
return `${resourcePath.join(PATH_SEP)}`
return `${resourcePath.with(-1, lastPathElement.join(DOT)).join(PATH_SEP)}`
}

protected override _getMetaTypeFilePath() {
Expand Down
6 changes: 3 additions & 3 deletions src/service/objectTranslationHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export default class ObjectTranslationHandler extends ResourceHandler {
protected _getObjectTranslationPath() {
// Return Object Translation Path for both objectTranslation and fieldTranslation
// QUESTION: Why fieldTranslation element are not deployable when objectTranslation element is not in the deployed sources (even if objectTranslation file is empty) ?
return `${parse(this.line).dir}${PATH_SEP}${
this.splittedLine[this.splittedLine.length - 2]
}.${OBJECT_TRANSLATION_META_XML_SUFFIX}`
return `${parse(this.line).dir}${PATH_SEP}${this.splittedLine.at(
-2
)}.${OBJECT_TRANSLATION_META_XML_SUFFIX}`
}

protected override _delegateFileCopy() {
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
"strictNullChecks": true,
"strictPropertyInitialization": true,
"useUnknownInCatchVariables": true,
"skipLibCheck": true
"skipLibCheck": true,
"lib": ["ES2023"],
},
"include": [
"./src/**/*",
"./src/**/*.json"
]
],
}

0 comments on commit ab40dc8

Please sign in to comment.