Skip to content

Commit

Permalink
Merge pull request #65 from PaimaStudios/concise-improvements
Browse files Browse the repository at this point in the history
Improvements to paima-concise
  • Loading branch information
martin-tomko-vacuumlabs authored Dec 8, 2022
2 parents 9ec0980 + 631d332 commit 39c8f14
Show file tree
Hide file tree
Showing 19 changed files with 16 additions and 199 deletions.
4 changes: 3 additions & 1 deletion paima-concise/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
build/
node_modules
*.tsbuildinfo
cache/
cache/
*.js
*.d.ts
2 changes: 0 additions & 2 deletions paima-concise/src/builder.d.ts

This file was deleted.

53 changes: 0 additions & 53 deletions paima-concise/src/builder.js

This file was deleted.

2 changes: 0 additions & 2 deletions paima-concise/src/consumer.d.ts

This file was deleted.

49 changes: 0 additions & 49 deletions paima-concise/src/consumer.js

This file was deleted.

15 changes: 9 additions & 6 deletions paima-concise/src/consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ const initialize = (input: string, version = EncodingVersion.V1): ConciseConsume
initialInput(_decompress = false): string {
return this.conciseInput;
},
nextValue(): ConciseValue | '' {
nextValue(): ConciseValue | null {
const [nextValue] = conciseValues.splice(0, 1);
return nextValue ?? '';
return nextValue ?? null;
},
popValue(): ConciseValue | '' {
remainingValues(): ConciseValue[] {
return this.conciseValues;
},
popValue(): ConciseValue | null {
const nextValue = conciseValues.pop();
return nextValue ?? '';
return nextValue ?? null;
},
prefix(): string {
return this.concisePrefix;
},
readValue(position: number): ConciseValue | '' {
readValue(position: number): ConciseValue | null {
const index = position - 1;
return this.conciseValues[index] ?? '';
return this.conciseValues[index] ?? null;
},
stateIdentifiers(): ConciseValue[] {
return this.conciseValues.filter(value => value.isStateIdentifier);
Expand Down
2 changes: 0 additions & 2 deletions paima-concise/src/index.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions paima-concise/src/index.js

This file was deleted.

40 changes: 0 additions & 40 deletions paima-concise/src/types.d.ts

This file was deleted.

4 changes: 0 additions & 4 deletions paima-concise/src/types.js

This file was deleted.

9 changes: 4 additions & 5 deletions paima-concise/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ export type ConciseConsumer = {
conciseInput: string;
concisePrefix: string;
conciseValues: ConciseValue[];

prefix: () => string;
stateIdentifiers: () => ConciseValue[];
nextValue: () => ConciseValue | '';

popValue: () => ConciseValue | '';
nextValue: () => ConciseValue | null;
remainingValues: () => ConciseValue[];
popValue: () => ConciseValue | null;
initialInput: (decompress?: boolean) => UTF8String;
// Positions start at 1
readValue: (position: number) => ConciseValue | '';
readValue: (position: number) => ConciseValue | null;
valueCount: () => number;
};
2 changes: 0 additions & 2 deletions paima-concise/src/utils.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion paima-concise/src/utils.js

This file was deleted.

3 changes: 0 additions & 3 deletions paima-concise/src/v1/builder.d.ts

This file was deleted.

14 changes: 0 additions & 14 deletions paima-concise/src/v1/builder.js

This file was deleted.

2 changes: 0 additions & 2 deletions paima-concise/src/v1/consts.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions paima-concise/src/v1/consts.js

This file was deleted.

2 changes: 0 additions & 2 deletions paima-concise/src/v1/utils.d.ts

This file was deleted.

7 changes: 0 additions & 7 deletions paima-concise/src/v1/utils.js

This file was deleted.

0 comments on commit 39c8f14

Please sign in to comment.