Skip to content

Commit

Permalink
Provide way to omit __interal__ from store on get
Browse files Browse the repository at this point in the history
The internal key causes some problems, both during write (sindresorhus#114) and at read (can't trust MyStore.keys() or MyStore.values() without omitting __internal__). We should at least export the variable so the client can manually omit it (and at best, provide a more ergonomic pattern—perhaps a WeakMap?)
  • Loading branch information
willium committed Jan 11, 2021
1 parent a96e9d7 commit f570e8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const checkValueType = (key: string, value: unknown): void => {
}
};

const INTERNAL_KEY = '__internal__';
const MIGRATION_KEY = `${INTERNAL_KEY}.migrations.version`;
export const INTERNAL_KEY = '__internal__';
export const MIGRATION_KEY = `${INTERNAL_KEY}.migrations.version`;

class Conf<T extends Record<string, any> = Record<string, unknown>> implements Iterable<[keyof T, T[keyof T]]> {
readonly path: string;
Expand Down

0 comments on commit f570e8f

Please sign in to comment.