File: fuzzy.coffee

Defined in: node_modules/grunt-codo/node_modules/codo/themes/default/assets/javascript/vendor

Method Summary

Method Details

~ (void) window(pattern, items, options = {})

Public: Filter a list of items.

pattern - The fuzzy String to match against. items - An Array of String. options - (optional)

    * pre         - String to insert before matching text.
    * post        - String to insert after matching text.
    * limit       - Integer maximum number of results.
    * separator   - String separator. Match against the last
                    section of the String by default.
    * ignorecase  - Boolean (default: true).
    * ignorespace - Boolean (default: true).
    * separate    - Boolean (default: false). If set to true, the
                    function returns an array of an array of strings,
                    where each array is
                    [beforeLastSeparator, afterLastSeparator].
                    If set, `separator` must also be passed.

Note: If pre is passed, you also have to pass post (and vice-versa).

Examples fuzzy = require 'fuzzy-filter' fuzzy "cs", ["cheese", "pickles", "crackers", "pirate attack", "cs!!"] # => ["cs!!", "cheese", "crackers"] fuzzy "cs", ["cheese", "pickles", "crackers", "pirate attack", "cs!!"], pre: "" post: "" # => ["cs!!", "cheese", "crackers"] fuzzy "cs", ["cookies", "cheese/pie", "fried/cheese", "cheese/cookies"], pre: "" post: "" separator: "/" # => [ "cookies" # , "fried/cheese" # , "cheese/cookies" ] fuzzy "cs/", ["cookies", "cheese/pie", "fried/cheese", "cheese/cookies"], pre: "" post: "" separator: "/" # => [ "cheese/pie" # , "cheese/cookies" ] fuzzy "cs/p", ["cookies", "cheese/pie", "fried/cheese", "cheese/cookies"], pre: "" post: "" separator: "/" # => ["cheese/pie"] fuzzy "cs/p", ["cookies", "cheese/pie", "fried/cheese", "cheese/cookies"], pre: "" post: "" separator: "/" separate: true # => [ ["cheese", "pie"] ]

Returns an Array of String.

~ (void) makePattern(pattern)

Internal:

Returns a String to be turned into a RegExp.

~ (void) surroundMatch(string, pattern, pre, post, ignorecase)

Internal:

Examples surroundMatch "cheese", "cs", "", "" # => "cheese"

Returns String.

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: