From 7d240b34610af96e8bc0757c332fe10349536746 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 25 Feb 2020 19:02:52 +0000 Subject: [PATCH] fix(core): update --- package-lock.json | 5 +++++ package.json | 4 +++- test/test.ts | 7 ++++++- ts/index.ts | 13 ++++++++++++- ts/smartmatch.plugins.ts | 8 ++++++-- 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index fefd5ce..d58ff53 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1256,6 +1256,11 @@ "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, + "picomatch": { + "version": "2.2.1", + "resolved": "https://verdaccio.lossless.one/picomatch/-/picomatch-2.2.1.tgz", + "integrity": "sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA==" + }, "pump": { "version": "3.0.0", "resolved": "https://verdaccio.lossless.one/pump/-/pump-3.0.0.tgz", diff --git a/package.json b/package.json index af33997..0452e3d 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,9 @@ "tslint": "^5.11.0", "tslint-config-prettier": "^1.15.0" }, - "dependencies": {}, + "dependencies": { + "picomatch": "^2.2.1" + }, "files": [ "ts/**/*", "ts_web/**/*", diff --git a/test/test.ts b/test/test.ts index 0ed8c19..909c0bd 100644 --- a/test/test.ts +++ b/test/test.ts @@ -2,7 +2,12 @@ import { expect, tap } from '@pushrocks/tapbundle'; import * as smartmatch from '../ts/index'; tap.test('first test', async () => { - console.log(smartmatch.standardExport); + const smartMatchInstance = new smartmatch.SmartMatch('*.any'); + const isAMatch = smartMatchInstance.match('wow.any'); + const isNotAMatch = smartMatchInstance.match('wow.not'); + + expect(isAMatch).to.be.true; + expect(isNotAMatch).to.be.false; }); tap.start(); diff --git a/ts/index.ts b/ts/index.ts index bf78306..627347e 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,3 +1,14 @@ import * as plugins from './smartmatch.plugins'; -export let standardExport = 'Hi there! :) This is an exported string'; +export class SmartMatch { + private picomatch; + public globString; + constructor(globStringArg: string) { + this.globString = globStringArg; + this.picomatch = plugins.picomatch(this.globString); + } + + public match(matchStringArg): boolean { + return this.picomatch(matchStringArg); + } +} \ No newline at end of file diff --git a/ts/smartmatch.plugins.ts b/ts/smartmatch.plugins.ts index 29aa9da..3eef40c 100644 --- a/ts/smartmatch.plugins.ts +++ b/ts/smartmatch.plugins.ts @@ -1,2 +1,6 @@ -const removeme = {}; -export { removeme }; +// third party scope +import picomatch from 'picomatch'; + +export { + picomatch +} \ No newline at end of file