diff options
| -rw-r--r-- | esbuild.js | 6 | ||||
| -rw-r--r-- | package.json | 3 | ||||
| -rw-r--r-- | src/index.ts | 6 | ||||
| -rw-r--r-- | tests/replace.spec.ts | 3 | ||||
| -rw-r--r-- | yarn.lock | 7 |
5 files changed, 18 insertions, 7 deletions
@@ -8,7 +8,7 @@ esbuild sourcemap: true, minify: true, splitting: false, - format: 'esm', - target: ['esnext'] + format: 'cjs', + target: ['es2015'] }) - .catch(() => process.exit(1)); + .catch(e => (console.error(e), process.exit(1))); diff --git a/package.json b/package.json index 43089db..c8c61a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "elxr", - "version": "0.0.1", + "version": "0.0.2", "description": "Regular expression-like syntax generalized for list operations", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -30,6 +30,7 @@ "typescript": "^4.5.4" }, "dependencies": { + "elxr": "^0.0.1", "fp-ts": "^2.11.6" } } diff --git a/src/index.ts b/src/index.ts index 1a52c95..64a0b6a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,7 +8,7 @@ import { index, ListExpr } from './types' const toSourceString = (r: string | RegExp): string => typeof r === 'string' ? r : r.source -export const liexp: (r: string | RegExp) => ListExpr = flow( +const elxr: (r: string | RegExp) => ListExpr = flow( toSourceString, parser, Either.map(fst), @@ -18,7 +18,7 @@ export const liexp: (r: string | RegExp) => ListExpr = flow( ) export const matchAll = <T>(exp: string | RegExp, list: T[]) => - pipe(exp, liexp, lxp => ev.matchAll(lxp, list)) + pipe(exp, elxr, lxp => ev.matchAll(lxp, list)) export const replaceAll = <T>(exp: string | RegExp, replacer: (v: T, m: ev.MatchGroupIndexed<T>, i: index) => T[], list: T[]) => - pipe(exp, liexp, lxp => ev.replaceAll(lxp, replacer, list)) + pipe(exp, elxr, lxp => ev.replaceAll(lxp, replacer, list)) diff --git a/tests/replace.spec.ts b/tests/replace.spec.ts index 98f1540..0130972 100644 --- a/tests/replace.spec.ts +++ b/tests/replace.spec.ts @@ -1,5 +1,8 @@ import { jlog } from '../src/utils' import { replaceAll } from '../src' +import * as elxr from 'elxr' + +console.log(elxr) describe('Basic tests', () => { it('should', () => { @@ -989,6 +989,13 @@ electron-to-chromium@^1.4.17: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.36.tgz#446c6184dbe5baeb5eae9a875490831e4bc5319a" integrity sha512-MbLlbF39vKrXWlFEFpCgDHwdlz4O3LmHM5W4tiLRHjSmEUXjJjz8sZkMgWgvYxlZw3N1iDTmCEtOkkESb5TMCg== +elxr@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/elxr/-/elxr-0.0.1.tgz#7218d4c016d2c11c7175a3d583d29f563655e93d" + integrity sha512-CHWIsdS3zu0E/8ub56FEWrCLXm5/nBk6VxexZ5e2C2fx1Xp7rr3YwmJct5X0B22jOPMjctytQuZ5bvmb9emp7A== + dependencies: + fp-ts "^2.11.6" + emittery@^0.8.1: version "0.8.1" resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.8.1.tgz#bb23cc86d03b30aa75a7f734819dee2e1ba70860" |
