Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
allevo committed Nov 13, 2023
1 parent 62faace commit 2200a68
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface Ser {
serializeFloat32: (n: number) => void
serializeString: (str: string) => void
serializeArray: <T>(arr: T[], serialize: (ser: Ser, t: T) => void) => void
serializeIterable <T>(iterable: Iterable<T>, serialize: (ser: Ser, t: T) => void): void
serializeIterable: <T>(iterable: Iterable<T>, serialize: (ser: Ser, t: T) => void) => void
}
export interface Des {
index: number
Expand All @@ -23,7 +23,7 @@ export interface Des {
deserializeFloat32: () => number
deserializeString: () => string
deserializeArray: <T>(deserialize: (des: Des) => T) => T[]
deserializeIterable <T>(deserialize: (des: Des) => T): Iterable<T>
deserializeIterable: <T>(deserialize: (des: Des) => T) => Iterable<T>
}

export function createSer (): Ser {
Expand Down Expand Up @@ -63,7 +63,7 @@ export function createDes (buffer: ArrayBuffer): Des {
deserializeFloat32,
deserializeString,
deserializeArray,
deserializeIterable,
deserializeIterable
}
}

Expand Down Expand Up @@ -131,16 +131,15 @@ function serializeIterable<T> (this: Ser, iterable: Iterable<T>, serialize: (ser

function deserializeIterable<T> (this: Des, deserialize: (des: Des) => T): Iterable<T> {
const len = this.deserializeUInt32()
const des = this
const aGeneratorObject = (function* () {
const aGeneratorObject = (function * (des) {
for (let i = 0; i < len; i++) {
yield deserialize(des)
}
})();
})(this)

return {
[Symbol.iterator]() {
return aGeneratorObject;
},
[Symbol.iterator] () {
return aGeneratorObject
}
}
}

0 comments on commit 2200a68

Please sign in to comment.