npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aurelia-fusejs

v1.0.1

Published

An Aurelia plugin in which there is value converters for fuse.js

Downloads

9

Readme

aurelia-fusejs

This is an Aurelia plugin in which there is two value converters in order to use fusejs.

1. Installation

  • npm install aurelia-fusejs --save or yarn add aurelia-fusejs

  • add the following line in your aurelia startup file

    .plugin('aurelia-fusejs');

    if you use webpack use

     .plugin(PLATFORM.moduleName('aurelia-fusejs'));

2. Usage

There are two value converters in this plugin for fusejs

  • fuse

    Should be applied on an array of objects and should be provided two parameters as input for it: your fuzzy search options which must be of type FuseOptions and the criteria that is your searching string.

    <ul>
        <li repeat.for="book of books | fuse:options:criteria">
            <span>${book.title}</span>
        </li>
    <ul>
  • fuseHighlight

    Had you provided includeMatches: true in your fusejs options, you can use the fuseHighlight value converter to get highlighted values based on the css class you pass to it as an input. Having done this way, you will get an extra property on your item property of fusejs resuls named highlighted which includes keys for the search result, the usage is like following:

        this.options = {
            //Omitted code
            includeMatches: true,
            keys: [{
                    name: 'title',
                    weight: 0.3
                }, {
                    name: 'author.lastName',
                    weight: 0.7
                }]
            //Omitted code
        };
    <style>
        .my-highlight{
            color:'#753B85';
        }
    </style>
    <ul>
        <li repeat.for="book of books | fuse:options:criteria | fuseHighlight:'my-highlight'">
            <span innerhtml.bind="book.item.highlighted.title || book.item.title"></span>
            <span>-></span>
            <span>${book.item.author.firstName}</span> 
            <span innerhtml.bind="book.item.highlighted.author.lastName || book.item.author.lastName"</span>
        </li>
    </ul>
  • Bear in mind that if the key of an item does not match the criteria the highlighted.property name will be null, thus you should handle it with coalesce operator in your code

    <!-- omitted snippet -->
    <span innerhtml.bind="book.item.highlighted.author.lastName || book.item.author.lastName"</span>
    <!-- omitted snippet -->