Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
fuzzysort.go(search, targets, {
threshold: -Infinity, // Don't return matches worse than this (higher is faster)
limit: Infinity, // Don't return more results than this (lower is faster)
all: false, // If true, returns all results for an empty search
key: null, // For when targets are objects (see its example usage)
keys: null, // For when targets are objects (see its example usage)
scoreFn: null, // For use with `keys` (see its example usage)
});
What is a result
const result = fuzzysort.single("query", "some string that contains my query.");
// exact match returns a score of 0. lower is worse
result.score; // -59
result.target; // some string that contains my query.
result.obj; // reference to your original obj when using options.key
fuzzysort.highlight(result, "<b>", "</b>"); // some string that contains my <b>query</b>.
How To Go Fast · Performance Tips
let targets = [{ file: "Monitor.cpp" }, { file: "MeshRenderer.cpp" }];
// filter out targets that you don't need to search! especially long ones!
targets = targets.filter((t) => t.file.length < 1000);
// if your targets don't change often, provide prepared targets instead of raw strings!
targets.forEach((t) => (t.filePrepared = fuzzysort.prepare(t.file)));
// don't use options.key if you don't need a reference to your original obj
targets = targets.map((t) => t.filePrepared);
const options = {
limit: 100, // don't return more results than you need!
threshold: -10000, // don't return bad results
};
fuzzysort.go("gotta", targets, options);
fuzzysort.go("go", targets, options);
fuzzysort.go("fast", targets, options);
Advanced Usage
Search a list of objects, by multiple fields, with custom weights.
let objects = [
{ title: "Favorite Color", desc: "Chrome" },
{ title: "Google Chrome", desc: "Launch Chrome" },
];
let results = fuzzysort.go("chr", objects, {
keys: ["title", "desc"],
// Create a custom combined score to sort by. -100 to the desc score makes it a worse match
scoreFn: (a) =>
Math.max(a[0] ? a[0].score : -1000, a[1] ? a[1].score - 100 : -1000),
});
var bestResult = results[0];
// When using multiple `keys`, results are different. They're indexable to get each normal result
fuzzysort.highlight(bestResult[0]); // 'Google <b>Chr</b>ome'
fuzzysort.highlight(bestResult[1]); // 'Launch <b>Chr</b>ome'
bestResult.obj.title; // 'Google Chrome'
Changelog
v2.0.0
Added new behavior when your search contains spaces!
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/slab/fuzzysort là nguồn chính thức.
slab/fuzzysort có bao nhiêu sao?
slab/fuzzysort có 1 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/slab/fuzzysort. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
slab/fuzzysort có phải mã nguồn mở không?
TopGit chưa ghi nhận license cho slab/fuzzysort. Phần lớn repo public trên GitHub là mã nguồn mở, nhưng điều khoản khác nhau từng repo — mở file LICENSE để xác nhận.
slab/fuzzysort có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho slab/fuzzysort. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
slab/fuzzysort có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho slab/fuzzysort. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
slab/fuzzysort còn được duy trì không?
TopGit chưa ghi nhận lần push gần đây của slab/fuzzysort. Xem lịch sử commit trực tiếp trên GitHub để biết thông tin chính xác nhất.
Đọc đầy đủ README ở tab phía trên.
fuzzysort có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về fuzzysort.