Skip to content

Commit

Permalink
chore: rename types
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenoak authored Nov 24, 2023
1 parent e8e3ab3 commit 59f7a56
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/lib/index.mts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import StructType from './type/StructType.mjs';
import StringType from './type/StringType.mjs';
import ArrayType from './type/ArrayType.mjs';
import ArrayIo from './type/ArrayIo.mjs';
import StringIo from './type/StringIo.mjs';
import StructIo from './type/StructIo.mjs';
import { getType } from './util.mjs';

const array = (type, options) => new ArrayType(type, options);
const array = (type, options) => new ArrayIo(type, options);

const string = (options) => new StringType(options);
const string = (options) => new StringIo(options);

const struct = (fields, options) => new StructType(fields, options);
const struct = (fields, options) => new StructIo(fields, options);

const int8 = {
read: (stream: Stream) => stream.readInt8(),
Expand Down
4 changes: 2 additions & 2 deletions src/lib/type/ArrayType.mts → src/lib/type/ArrayIo.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type ArrayOptions = {
size?: number;
};

class ArrayType implements IoType {
class ArrayIo implements IoType {
#type: IoType;
#options: ArrayOptions;

Expand Down Expand Up @@ -54,4 +54,4 @@ class ArrayType implements IoType {
}
}

export default ArrayType;
export default ArrayIo;
4 changes: 2 additions & 2 deletions src/lib/type/StringType.mts → src/lib/type/StringIo.mts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type StringOptions = {
terminate?: boolean;
};

class StringType implements IoType {
class StringIo implements IoType {
#options: StringOptions;
#decoder: TextDecoder;
#encoder: TextEncoder;
Expand Down Expand Up @@ -66,4 +66,4 @@ class StringType implements IoType {
}
}

export default StringType;
export default StringIo;
6 changes: 3 additions & 3 deletions src/lib/type/StructType.mts → src/lib/type/StructIo.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getStream, getType } from '../util.mjs';

class StructType implements IoType {
class StructIo implements IoType {
#fields;
#options;

Expand All @@ -14,7 +14,7 @@ class StructType implements IoType {
}

extend(fields = {}, options = {}) {
return new StructType(
return new StructIo(
{ ...this.#fields, ...fields },
{ ...this.#options, ...options },
);
Expand Down Expand Up @@ -46,4 +46,4 @@ class StructType implements IoType {
}
}

export default StructType;
export default StructIo;

0 comments on commit 59f7a56

Please sign in to comment.