mattyork / fuzzy

Filters a list based on a fuzzy string search
MIT License
831 stars 86 forks source link

Angluar2 Ionic #32

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi,

I try to use your lib with ionic2

npm install https://github.com/mattyork/fuzzy.git#typescript --save

import { fuzzy } from 'fuzzy';

error throw new Error("Cannot find module \"fuzzy\"");

any idea ?

thx

ghost commented 7 years ago

And if I try with master branch.

npm install fuzzy --save

error /node_modules/fuzzy/lib/fuzzy"' has no exported member 'fuzzy'.

SamVerschueren commented 7 years ago

I used it in my Angular 2 application and it works great. It might have something to do with your import statement.

$ npm install fuzzy --save
import { filter } from 'fuzzy';

const list = ['baconing', 'narwhal', 'a mighty bear canoe'];
const results = filter('bcn', list)

Or, you can also do it like this probably

import * as fuzzy from 'fuzzy';

const list = ['baconing', 'narwhal', 'a mighty bear canoe'];
const results = fuzzy.filter('bcn', list)