From fee592d96c914336aaf96376524b81cb59dc6083 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Thu, 17 Feb 2022 22:11:46 +0530 Subject: v0.0.2 --- esbuild.js | 6 +++--- package.json | 3 ++- src/index.ts | 6 +++--- tests/replace.spec.ts | 3 +++ yarn.lock | 7 +++++++ 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/esbuild.js b/esbuild.js index de4b3e9..5b06664 100644 --- a/esbuild.js +++ b/esbuild.js @@ -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 = (exp: string | RegExp, list: T[]) => - pipe(exp, liexp, lxp => ev.matchAll(lxp, list)) + pipe(exp, elxr, lxp => ev.matchAll(lxp, list)) export const replaceAll = (exp: string | RegExp, replacer: (v: T, m: ev.MatchGroupIndexed, 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', () => { diff --git a/yarn.lock b/yarn.lock index b5e7b67..b59aff8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" -- cgit v1.3.1