Skip to content

Commit

Permalink
Merge pull request #2 from mvc-works/dev
Browse files Browse the repository at this point in the history
add parse-by-word function; bump 0.0.3
  • Loading branch information
Ovilia committed Sep 27, 2018
2 parents e8f8cc8 + 95908d5 commit 2957f08
Show file tree
Hide file tree
Showing 6 changed files with 649 additions and 43 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ Demo http://repo.mvc-works.org/fuzzy-filter/
[![Clojars Project](https://img.shields.io/clojars/v/mvc-works/fuzzy-filter.svg)](https://clojars.org/mvc-works/fuzzy-filter)

```edn
[mvc-works/fuzzy-filter "0.0.2"]
[mvc-works/fuzzy-filter "0.0.4"]
```

```edn
[fuzzy-filter.core :refer [resolve-text]]
[fuzzy-filter.core :refer [parse-by-letter parse-by-word]]
[fuzzy-filter.comp.visual :refer [comp-visual]]
```

```clojure
(resolve-text "content to query" "query")
; => {:matches? true, :chunks [[:rest "content to "] [:hitted "query"]] :text "content to query"}
(parse-by-letter "this and that to search" "that search")
; => {:matches? false, :chunks [[:hitted "th"] [:rest "is "] [:hitted "a"] [:rest "nd "] [:hitted "t"] [:space "h"] [:rest "at to "] [:hitted "searc"] [:rest "h"] [:missed "g"]], :text "this and that to search"}

(parse-by-word "this and that to search" "that search")
; => {:matches? false, :chunks [[:rest "this and "] [:hitted "that"] [:missed "searcg"]], :text "this and that to search"}

(comp-visual (:sequences result) {:style-rest {:color (hsl 0 0 70)}}))))
```
Expand Down

0 comments on commit 2957f08

Please sign in to comment.