-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lexus Drumgold <[email protected]>
- Loading branch information
1 parent
c9aecaa
commit c949bdc
Showing
15 changed files
with
426 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,4 @@ vates | |
vfile | ||
vitest | ||
yarnrc | ||
zwnj |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @file Unit Tests - chars | ||
* @module vfile-reader/tests/unit/chars | ||
*/ | ||
|
||
import testSubject from '../chars' | ||
import codes from '../codes' | ||
|
||
describe('unit:chars', () => { | ||
it('should have same keys as codes', () => { | ||
expect(testSubject).to.have.keys(Object.keys(codes)) | ||
}) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @file Unit Tests - codes | ||
* @module vfile-reader/tests/unit/codes | ||
*/ | ||
|
||
import chars from '../chars' | ||
import testSubject from '../codes' | ||
|
||
describe('unit:codes', () => { | ||
it('should define codes for all keys in chars', () => { | ||
for (const [key, char] of Object.entries(chars)) { | ||
expect(testSubject).to.have.property(key, char?.codePointAt(0) ?? char) | ||
} | ||
}) | ||
|
||
it('should have same keys as chars', () => { | ||
expect(testSubject).to.have.keys(Object.keys(chars)) | ||
}) | ||
}) |
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,153 @@ | ||
/** | ||
* @file chars | ||
* @module vfile-reader/chars | ||
*/ | ||
|
||
import type { Character } from '@flex-development/vfile-reader' | ||
|
||
/** | ||
* Character dictionary. | ||
* | ||
* @see https://symbl.cc/en/unicode/blocks/basic-latin | ||
* | ||
* @enum {Character} | ||
*/ | ||
const chars = { | ||
ack: '\u0006', | ||
ampersand: '&', | ||
apostrophe: '\'', | ||
asterisk: '*', | ||
at: '@', | ||
backslash: '\\', | ||
backtick: '`', | ||
bar: '|', | ||
bel: '\u0007', | ||
bom: '\uFEFF', | ||
bs: '\u0008', | ||
can: '\u0018', | ||
caret: '^', | ||
colon: ':', | ||
comma: ',', | ||
cr: '\r', | ||
dc1: '\u0011', | ||
dc2: '\u0012', | ||
dc3: '\u0013', | ||
dc4: '\u0014', | ||
del: '\u007F', | ||
digit0: '0', | ||
digit1: '1', | ||
digit2: '2', | ||
digit3: '3', | ||
digit4: '4', | ||
digit5: '5', | ||
digit6: '6', | ||
digit7: '7', | ||
digit8: '8', | ||
digit9: '9', | ||
dle: '\u0010', | ||
dollar: '$', | ||
dot: '.', | ||
em: '\u0019', | ||
enq: '\u0005', | ||
eof: null, | ||
eot: '\u0004', | ||
equal: '=', | ||
esc: '\u001B', | ||
etb: '\u0017', | ||
etx: '\u0003', | ||
exclamation: '!', | ||
ff: '\f', | ||
fs: '\u001C', | ||
gs: '\u001D', | ||
gt: '>', | ||
hash: '#', | ||
ht: '\t', | ||
leftBrace: '{', | ||
leftBracket: '[', | ||
leftParen: '(', | ||
lf: '\n', | ||
lowercaseA: 'a', | ||
lowercaseB: 'b', | ||
lowercaseC: 'c', | ||
lowercaseD: 'd', | ||
lowercaseE: 'e', | ||
lowercaseF: 'f', | ||
lowercaseG: 'g', | ||
lowercaseH: 'h', | ||
lowercaseI: 'i', | ||
lowercaseJ: 'j', | ||
lowercaseK: 'k', | ||
lowercaseL: 'l', | ||
lowercaseM: 'm', | ||
lowercaseN: 'n', | ||
lowercaseO: 'o', | ||
lowercaseP: 'p', | ||
lowercaseQ: 'q', | ||
lowercaseR: 'r', | ||
lowercaseS: 's', | ||
lowercaseT: 't', | ||
lowercaseU: 'u', | ||
lowercaseV: 'v', | ||
lowercaseW: 'w', | ||
lowercaseX: 'x', | ||
lowercaseY: 'y', | ||
lowercaseZ: 'z', | ||
ls: '\u2028', | ||
lt: '<', | ||
minus: '-', | ||
nak: '\u0015', | ||
nul: '\0', | ||
percent: '%', | ||
plus: '+', | ||
ps: '\u2029', | ||
question: '?', | ||
quotation: '"', | ||
replacement: '�', | ||
rightBrace: '}', | ||
rightBracket: ']', | ||
rightParen: ')', | ||
rs: '\u001E', | ||
semicolon: ';', | ||
si: '\u000F', | ||
slash: '/', | ||
so: '\u000E', | ||
soh: '\u0001', | ||
space: ' ', | ||
stx: '\u0002', | ||
sub: '\u001A', | ||
syn: '\u0016', | ||
tilde: '~', | ||
underscore: '_', | ||
uppercaseA: 'A', | ||
uppercaseB: 'B', | ||
uppercaseC: 'C', | ||
uppercaseD: 'D', | ||
uppercaseE: 'E', | ||
uppercaseF: 'F', | ||
uppercaseG: 'G', | ||
uppercaseH: 'H', | ||
uppercaseI: 'I', | ||
uppercaseJ: 'J', | ||
uppercaseK: 'K', | ||
uppercaseL: 'L', | ||
uppercaseM: 'M', | ||
uppercaseN: 'N', | ||
uppercaseO: 'O', | ||
uppercaseP: 'P', | ||
uppercaseQ: 'Q', | ||
uppercaseR: 'R', | ||
uppercaseS: 'S', | ||
uppercaseT: 'T', | ||
uppercaseU: 'U', | ||
uppercaseV: 'V', | ||
uppercaseW: 'W', | ||
uppercaseX: 'X', | ||
uppercaseY: 'Y', | ||
uppercaseZ: 'Z', | ||
us: '\u001F', | ||
vt: '\v', | ||
zwj: '\u200D', | ||
zwnj: '\u200C' | ||
} as const | ||
|
||
export default chars |
Oops, something went wrong.