range parser, move typings
This commit is contained in:
parent
3d061e1b67
commit
9a56b99eff
21 changed files with 33 additions and 3 deletions
|
@ -3,7 +3,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.js",
|
"main": "./src/index.js",
|
||||||
"types": "./src/index.d.ts",
|
"types": "./typings/index.d.ts",
|
||||||
"author": "Rowan <rowan@kitsu.cafe> (https://kitsu.cafe)",
|
"author": "Rowan <rowan@kitsu.cafe> (https://kitsu.cafe)",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "./tests/index.js",
|
"test": "./tests/index.js",
|
||||||
|
|
15
src/multi.js
15
src/multi.js
|
@ -46,3 +46,18 @@ export const many = curry((parser, state) => {
|
||||||
|
|
||||||
export const many1 = parser => seq(parser, many(parser))
|
export const many1 = parser => seq(parser, many(parser))
|
||||||
|
|
||||||
|
const _range = (start, end, step = 1) => {
|
||||||
|
const len = end - start + 1
|
||||||
|
const result = new Array(len)
|
||||||
|
|
||||||
|
for (let i = 0, n = start; i <= len; i += i, n += step) {
|
||||||
|
result[i] = n
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
export const range = (start, end) => {
|
||||||
|
return anyChar(_range(start.codePointAt(0), end.codePointAt(0)))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||||
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
"outDir": "./typings", /* Specify an output folder for all emitted files. */
|
||||||
// "removeComments": true, /* Disable emitting comments. */
|
// "removeComments": true, /* Disable emitting comments. */
|
||||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||||
|
@ -109,5 +109,8 @@
|
||||||
/* Completeness */
|
/* Completeness */
|
||||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||||
}
|
},
|
||||||
|
"exclude": [
|
||||||
|
"typings"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
0
typings/dist/index.d.ts
vendored
Normal file
0
typings/dist/index.d.ts
vendored
Normal file
0
src/byte.d.ts → typings/src/byte.d.ts
vendored
0
src/byte.d.ts → typings/src/byte.d.ts
vendored
0
src/clone.d.ts → typings/src/clone.d.ts
vendored
0
src/clone.d.ts → typings/src/clone.d.ts
vendored
0
src/cond.d.ts → typings/src/cond.d.ts
vendored
0
src/cond.d.ts → typings/src/cond.d.ts
vendored
0
src/const.d.ts → typings/src/const.d.ts
vendored
0
src/const.d.ts → typings/src/const.d.ts
vendored
0
src/fn.d.ts → typings/src/fn.d.ts
vendored
0
src/fn.d.ts → typings/src/fn.d.ts
vendored
0
src/index.d.ts → typings/src/index.d.ts
vendored
0
src/index.d.ts → typings/src/index.d.ts
vendored
0
src/iter.d.ts → typings/src/iter.d.ts
vendored
0
src/iter.d.ts → typings/src/iter.d.ts
vendored
1
src/multi.d.ts → typings/src/multi.d.ts
vendored
1
src/multi.d.ts → typings/src/multi.d.ts
vendored
|
@ -5,3 +5,4 @@ export const takeUntil: any;
|
||||||
export const skip: any;
|
export const skip: any;
|
||||||
export const many: any;
|
export const many: any;
|
||||||
export function many1(parser: any): any;
|
export function many1(parser: any): any;
|
||||||
|
export function range(start: any, end: any): any;
|
0
src/state.d.ts → typings/src/state.d.ts
vendored
0
src/state.d.ts → typings/src/state.d.ts
vendored
0
src/tuple.d.ts → typings/src/tuple.d.ts
vendored
0
src/tuple.d.ts → typings/src/tuple.d.ts
vendored
2
typings/tests/index.d.ts
vendored
Normal file
2
typings/tests/index.d.ts
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
export {};
|
1
typings/tests/units/bytes.d.ts
vendored
Normal file
1
typings/tests/units/bytes.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export const Byte: any[];
|
3
typings/tests/units/common.d.ts
vendored
Normal file
3
typings/tests/units/common.d.ts
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export const assertState: any;
|
||||||
|
export const parseEq: any;
|
||||||
|
export const parseErr: any;
|
1
typings/tests/units/cond.d.ts
vendored
Normal file
1
typings/tests/units/cond.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export const Conditionals: any[];
|
3
typings/tests/units/index.d.ts
vendored
Normal file
3
typings/tests/units/index.d.ts
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export * from "./bytes.js";
|
||||||
|
export * from "./iter.js";
|
||||||
|
export * from "./cond.js";
|
1
typings/tests/units/iter.d.ts
vendored
Normal file
1
typings/tests/units/iter.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export const Iterator: any[];
|
Loading…
Add table
Reference in a new issue