Skip to content

Commit

Permalink
feat(types): object value now can be anything, cause we only need to …
Browse files Browse the repository at this point in the history
…cast it to boolean, it gives more versatile usage;
  • Loading branch information
xobotyi committed Feb 18, 2020
1 parent 46bf7af commit 7d1ced4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ export type ClassValue = string | null | boolean | undefined | ClassListDictiona
export type ClassListArray = ClassValue[];

export interface ClassListDictionary {
[cn: string]: boolean | undefined | null;
[cn: string]: any; // in can be anything
}
3 changes: 2 additions & 1 deletion tests/cnb.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ describe('cnb', () => {
it('should build from various amount of objects', () => {
expect(cnb({ '': true })).toBe('');
expect(cnb({ a: true })).toBe('a');
expect(cnb({ a: true, b: true }, { c: true })).toBe('a b c');
// eslint-disable-next-line @typescript-eslint/no-empty-function
expect(cnb({ a: true, b: true }, { c: true, d: () => {} })).toBe('a b c d');
});

it('should ignore invalid entries', () => {
Expand Down
3 changes: 2 additions & 1 deletion tests/dcnb.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ describe('dcnb', () => {
it('should build from various amount of objects', () => {
expect(dcnb({ '': true })).toBe('');
expect(dcnb({ a: true })).toBe('a');
expect(dcnb({ a: true, b: true, d: true }, { c: true, d: false })).toBe('a b c');
// eslint-disable-next-line @typescript-eslint/no-empty-function
expect(dcnb({ a: true, b: true, d: true }, { c: true, d: false }, { d: () => {} })).toBe('a b d c');
});

it('should ignore invalid entries', () => {
Expand Down

0 comments on commit 7d1ced4

Please sign in to comment.