🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@zulip/shared

Package Overview
Dependencies
Maintainers
5
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zulip/shared - npm Package Compare versions

Comparing version

to
0.0.15

icons/language.svg

34

js/typeahead.js

@@ -37,3 +37,8 @@ /*

function query_matches_string(query, source_str, split_char) {
// This function attempts to match a query with a source text.
// * query is the user-entered search query
// * source_str is the string we're matching in, e.g. a user's name
// * split_char is the separator for this syntax (e.g. ' ').
export function query_matches_string(query, source_str, split_char) {
source_str = source_str.toLowerCase();
source_str = remove_diacritics(source_str);

@@ -54,16 +59,2 @@

// This function attempts to match a query with source's attributes.
// * query is the user-entered search query
// * Source is the object we're matching from, e.g. a user object
// * match_attrs are the values associated with the target object that
// the entered string might be trying to match, e.g. for a user
// account, there might be 2 attrs: their full name and their email.
// * split_char is the separator for this syntax (e.g. ' ').
export function query_matches_source_attrs(query, source, match_attrs, split_char) {
return match_attrs.some((attr) => {
const source_str = source[attr].toLowerCase();
return query_matches_string(query, source_str, split_char);
});
}
function clean_query(query) {

@@ -86,2 +77,11 @@ query = remove_diacritics(query);

export const is_unicode_emoji = (emoji) =>
emoji.reaction_type === "unicode_emoji" && emoji.emoji_code;
export const parse_unicode_emoji_code = (code) =>
code
.split("-")
.map((hex) => String.fromCodePoint(Number.parseInt(hex, 16)))
.join("");
export function get_emoji_matcher(query) {

@@ -93,3 +93,5 @@ // replace spaces with underscores for emoji matching

return function (emoji) {
return query_matches_source_attrs(query, emoji, ["emoji_name"], "_");
const matches_emoji_literal =
is_unicode_emoji(emoji) && parse_unicode_emoji_code(emoji.emoji_code) === query;
return matches_emoji_literal || query_matches_string(query, emoji.emoji_name, "_");
};

@@ -96,0 +98,0 @@ }

{
"name": "@zulip/shared",
"version": "0.0.14",
"version": "0.0.15",
"license": "Apache-2.0",

@@ -10,5 +10,5 @@ "scripts": {

"dependencies": {
"katex": "^0.15.3",
"katex": "^0.16.2",
"lodash": "^4.17.19"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet