Coder Social home page Coder Social logo

fuzzy's People

Contributors

avindra avatar fasterthanlime avatar kourge avatar mattyork avatar minigod avatar romario333 avatar staydecent avatar swatinem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fuzzy's Issues

UglifyJS warning

Hi, there are some warnings in your code

Condition always true [./~/fuzzy/lib/fuzzy.js:16,0]
Dropping unreachable code [./~/fuzzy/lib/fuzzy.js:19,0]
Dropping unused variable compareChar [./~/fuzzy/lib/fuzzy.js:51,0]
Dropping unused variable root [./~/fuzzy/lib/fuzzy.js:11,0]

returns blank answers with fuzzy object search

Hi, I am doing something like this. when i select the answer.answers returns empty string

function searchUser(answers, input) {
var names = [ { name: "Test1", accountId: "a746hsjikel" }, { name: "Test2", accountId: "982bjkkgkbnd" } ]
return new Promise(function(resolve) {
    setTimeout(function() {
      var options = {
        extract: function(el) {
          return el.name;
        }
      };
      var fuzzyResult = fuzzy.filter(input, names, options);
      resolve(
        fuzzyResult.map(function(el) {
          return el.string;
        })
      );
    }, 2000);
  });
}

inquirer
  .prompt([
    {
      type: "autocomplete",
      name: "test",
      message: "Search user",
      source: searchUsers,
      pageSize: 4,
      suggestOnly: true
    }
  ])
  .then(function(answers) {
    console.log(JSON.stringify(answers, null, 2));
  });

Switch to TypeScript

It's best for libs, and means we don't have to manually manage the definition file

Highlighting results

I was just wondering how I would go about hilighting my search results like done so on the Disney Demo I can't see to figure it out.

fuzzy should accept number values

It's common to filter lists with mixed-type data. fuzzy currently throws an error if you pass it a number value.

One workaround is to convert numbers to strings before passing values to fuzzy. The downside to this approach is that you have to throw out (sometimes essential) type information about your data. Ideally, fuzzy would handle both strings and numbers internally, return values that preserve the original type.

Can I get Whole JSON object from "list"

Hi, I'm using these module with node but I have long JSON Array contain object. I need matched object whole. Like

var list = [
{rompalu: 'baconing', zibbity: 'simba'}
, {rompalu: 'narwhal' , zibbity: 'mufasa'}
, {rompalu: 'a mighty bear canoe', zibbity: 'saddam hussein'}
];

I have above list of JSON Array and if I pass word narwhal than It's return only matched words in Array but I need array of matched object. output like :

[
{rompalu: 'narwhal' , zibbity: 'mufasa'}
]

Add a `noresults` option that returns a string to the user

I'd like to provide the user with a default option in the event that their search returns no results. Something simple like "No results found" but that can be customized as well. Is that something you'd be interested in a PR for?

comparing a string against list of json objects

i have read two csv files and put into as list of JSON objects.

Iam trying to match two list of json objects and fetch the matching data.
I implmented this with fuzzy logic, Using fuzzy.filter (string,list) i can able to compare against the list of json objects, can anyone suggest me some solutions

here is my sample code:
read.csvReadJson(function(petdata1) {
read.readCSV(function(petdata2) {
petdata1.forEach(function(petdata) {
for(var i=0;i<=petdata2.length;i++){
//matching string with list of json objects
var results = fuzzy.filter(petdata.breed, petdata2[i])
var matches = results.map(function(el) { return el.string; });
console.log(matches);
if (matches !=" "){
console.log(matches);
}
}
in the above example petdata1 and petdata2 are list of JSON objects.

can anyone please help me out

Use object of objects instead of an array

Hello, Thanks for this great library !

Is it possible to use an object like this :

var list = {
1: {id: 1, rompalu: 'baconing', zibbity: 'simba'},
2: {id: 2, rompalu: 'narwhal' , zibbity: 'mufasa'},
3: {id: 3, rompalu: 'a mighty bear canoe', zibbity: 'saddam hussein'}
}

instead of a list like :

var list = [
{rompalu: 'baconing', zibbity: 'simba'}
, {rompalu: 'narwhal' , zibbity: 'mufasa'}
, {rompalu: 'a mighty bear canoe', zibbity: 'saddam hussein'}
];

Thanks for the response !

Maintainer or deprecated?

The last commit is 1.5 years ago. Is there a maintainer or this project is left?

Do we have any plan to actually maintain this library?

Startswith

Hi,

Is it possible to match an exact text? For example, i want to retrieve the results for all value that as "thisvalue" but not the other resultats that contain these letter for example "this poor value".

Thanks!

Provide non-downloaded testable examples

I'd be much more likely to download the library if there was a place I could go to actually see it in action, test it out, and see if it's what I want. I'd rather not download it if it's not really what I want. Even screenshots of it working would be useful.

Match at first character > substring

Search string: che

[ { string: 'Teachers Credit Union', score: 11, index: 136 },
  { string: 'Teachers Chemical', score: 11, index: 20 }
  { string: 'Chevron Valley CU', score: 11, index: 270 },
]

But Chevron Valley CU should score higher than Teachers Credit Union since Chevron starts with che while Teachers only has a substring che. Additionally, Teachers Chemical score higher since a word inside the string begins with chec (even though it's not the first word inside the string).

undefined is not a function (evaluating 'string.toLowerCase()')

I'm getting the error with the following trace:
match
fuzzy.js: 50

fuzzy.js: 120

filter
fuzzy.js :115

as soon as I try to filter for even a single character. I've verified my input is a string and the list I'm filtering against is an array of objects with only string values.

Sorry I cannot cut and paste the error msgs as I'm using this in a React Native app and the error is reported in the Android emulator.

add weight to the match location

What I want to archive is the mentioned in the tests as todo.

      // TODO: Dont know how I feel about this. Sublime weights characters that
      // appear toward the beginning of the string a bit higher

https://github.com/mattyork/fuzzy/blob/master/test/fuzzy.test.js#L51

The practical usecase is that i have a list with languages and for eng the first result is not english, but bengalish.

Not sure if an exact duplicate, but at least related to: #3 and I guess already fixed in #12

Remove Fuse item object wrapper from Fuse results

is there a way to remove the "item": {} object wrapping each of my results from Fuse that's wrapping my results data? I just want the bare results of my data, not in an object with other props such as refIndex and what not.

I just want the raw data back, having this wrapped is causing me pain because I have to now somehow get that out of the dataset returned by Fuse.

Examples broken?

In disney.html, the matching letters don't turn bold until the next key is pressed.

In directors.html, if I type in "ee", it seems like the only matches brought up are ones with that exact match. No words appear in which there are two e's that are not consecutive. That might be because there's some limit on the number of matches shown. I haven't yet figured out how to find that setting.

Reverse Search

I'm not even sure what to actually call this and I think it's more of a feature request than an issue. Is there any way currently to do a search for something like "Bill Smith" and have it return content that's formatted as "Smith, Bill"?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.