-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from andrewcourtice/fix/history-array-mutable
Fix mutable array methods in history extension
- Loading branch information
Showing
13 changed files
with
152 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export default function clamp(lower: number, upper: number, value: number) { | ||
export default function clamp(value: number, lower: number, upper: number) { | ||
return Math.max(lower, Math.min(upper, value)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { | ||
RuntimeType, | ||
RuntimeTypeMap, | ||
} from '../types'; | ||
|
||
import getType from './get-type'; | ||
|
||
export default function typeIsAny<TType extends RuntimeType>(value: unknown, types: TType[]): value is RuntimeTypeMap[TType] { | ||
return types.includes(getType(value) as TType); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import clamp from '../../src/number/clamp'; | ||
|
||
import { | ||
describe, | ||
expect, | ||
test, | ||
} from 'vitest'; | ||
|
||
describe('Utilities', () => { | ||
|
||
describe('Number Clamp', () => { | ||
|
||
test('Should clamp the given value between the specified lower/upper bounds', () => { | ||
expect(clamp(25, 10, 20)).toBe(20); | ||
expect(clamp(-50, 0, 100)).toBe(0); | ||
}); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import isAny from '../../src/type/is-any'; | ||
|
||
import { | ||
describe, | ||
expect, | ||
test, | ||
} from 'vitest'; | ||
|
||
describe('Utilities', () => { | ||
|
||
describe('Type Is Any', () => { | ||
|
||
test('Should verify that a given value matches the specified types', () => { | ||
expect(isAny(true, ['boolean', 'date'])).toBe(true); | ||
expect(isAny(true, ['string', 'symbol'])).toBe(false); | ||
expect(isAny('hello', ['date', 'object'])).toBe(false); | ||
}); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import isMatchable from '../../src/type/is-matchable'; | ||
|
||
import { | ||
describe, | ||
expect, | ||
test, | ||
} from 'vitest'; | ||
|
||
describe('Utilities', () => { | ||
|
||
describe('Type Is Matchable', () => { | ||
|
||
test('Should verify that a given value is matchable', () => { | ||
expect(isMatchable({ | ||
include: '*', | ||
exclude: ['errors'], | ||
})).toBe(true); | ||
}); | ||
|
||
}); | ||
|
||
}); |
1df78af
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
harlem – ./
harlem.vercel.app
harlem-git-main-andrewcourtice.vercel.app
harlem-andrewcourtice.vercel.app
harlemjs.com