-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(transducers): deprecate hex(), update hexDump() xform & deps
- Loading branch information
1 parent
5864f2c
commit b1ea9a5
Showing
3 changed files
with
15 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
const ZEROES = "00000000"; | ||
import { radix } from "@thi.ng/strings/radix"; | ||
|
||
export function hex(digits = 2, prefix = "") { | ||
return (x: number) => { | ||
const s = x.toString(16); | ||
return prefix + (s.length >= digits ? s : ZEROES.substring(0, digits - s.length) + s); | ||
} | ||
} | ||
/** | ||
* @deprecated use thi.ng/strings `radix()` instead | ||
* | ||
* @param digits | ||
* @param prefix | ||
*/ | ||
export const hex = (digits = 2, prefix = "") => radix(16, digits, prefix); |
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