Skip to content

Commit

Permalink
using webstorm
Browse files Browse the repository at this point in the history
  • Loading branch information
bahrus committed Oct 26, 2024
1 parent 4626b16 commit 550778b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
11 changes: 7 additions & 4 deletions URLBuilder.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
export class URLBuilder {
pattern;
#tokenStream = [];
#tokens = [];
get tokens() {
return this.#tokens;
}
constructor(pattern) {
this.pattern = pattern;
let result;
let i = 0;
const positions = this.#tokenStream;
const positions = this.#tokens;
while ((result = reg.exec(pattern)) !== null) {
const beforeToken = pattern.substring(i, result.index);
const r = result[0];
Expand All @@ -19,7 +22,7 @@ export class URLBuilder {
}
build(obj) {
const tokens = [];
for (const tokenItem of this.#tokenStream) {
for (const tokenItem of this.#tokens) {
const [beforeToken, key] = tokenItem;
tokens.push(beforeToken);
if (key !== undefined && key in obj) {
Expand All @@ -29,4 +32,4 @@ export class URLBuilder {
return tokens.join('');
}
}
const reg = /:(\@|\#|\.)\w+/g;
const reg = /\:\w+/g;
2 changes: 1 addition & 1 deletion URLBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ export class URLBuilder implements IURLBuilder{
}
}

const reg = /:(@|#|\.)\w+/g;
const reg = /\:\w+/g;
1 change: 0 additions & 1 deletion be-reformable.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class BeReformable extends BE {
async updateAction(self){
const {enhancedElement, urlBuilder} = self;
console.log({urlBuilder});
urlBuilder.
return /** @type {PAP} */({
});
}
Expand Down

0 comments on commit 550778b

Please sign in to comment.