GithubHelp home page GithubHelp logo

fable.import.matchsorter's Introduction

Fable.Import.MatchSorter

This package provides Fable bindings for match-sorter.

Installation

  • Install the match-sorter npm package:

    • using npm: npm install match-sorter
    • using yarn: yarn add match-sorter
  • Install the bindings:

    • using dotnet: dotnet add package Fable.Import.MatchSorter
    • using paket: paket add Fable.Import.MatchSorter

Example usage

open Fable.Import.MatchSorter

// Without configuration

let sortedMatches =
  ["apple"; "banana"; "kiwi"]
  |> matchSort "a"

// More complex configuration using fluent pipe syntax

type Country =
  { Id: Guid
    Name: string
    Description: string }

let countryMatchSortOpts =
  MSOpts.empty
  |> MSOpts.addKey (fun c -> c.Name)
  |> MSOpts.addKeySpec (
      KeySpec.create (fun c -> c.Description)
      |> KeySpec.withThreshold Ranking.Contains
      |> KeySpec.withMaxRanking Ranking.Equal)
  |> MSOpts.withThreshold Ranking.Contains
  |> MSOpts.keepDiacritics
  
let matchSortCountries query (cs: Country list) : Country list =
  matchSortWith countryMatchSortOpts query cs
  
// You can also ensure the options are converted to native match-sort
// options only once by partially applying them to matchSortWith:

let matchSortCountries : string -> Country list -> Country list =
  matchSortWith countryMatchSortOpts

You can also access the “native” match-sorter bindings in the Native submodule.

Changelog

1.1.1 (2019-07-25)

  • Added femto support
  • Updated for match-sorter 4 (no API changes)

1.1.0 (2019-05-02)

  • Updated for Fable.Core 3 and match-sorter 3. No API changes.

1.0.0 (2019-01-12)

  • Initial release

Deployment checklist

  1. Make necessary changes to the code
  2. Update the changelog
  3. Update the version and release notes in the package info
  4. Update the supported npm dependency versions for femto in the fsproj
  5. Commit and tag the commit (this is what triggers deployment from AppVeyor). For consistency, the tag should ideally be in the format v1.2.3.
  6. Push the changes and the tag to the repo. If AppVeyor build succeeds, the package is automatically published to NuGet.

fable.import.matchsorter's People

Contributors

cmeeren avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.