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

cyrillic-latin-search

v0.8.5

Published

Cyrillic Latin Search is convenient for Cyrillic Latin search engines because you can write 'Celavica' ('Bald letters') 'c' for 'č', 's' for 'š', 'и' for 'й',...

Downloads

29

Readme

cyrillic-latin-search 🔤

Cyrillic Latin Search is convenient for Cyrillic Latin search engines because you can write "Celavica" ("Bald letters") "c" for "č", "s" for "š", "и" for "й",...

Supports ISO 9 standard

Examples

| Latin | Celavica | includes | | ------- | -------- | -------- | | Niš | Nis | true | | Ćao | Cao | true | | Šišmiš | Sismis | true | | čeljavo | Celjavo | false |

| Cyrillic | Celavica | includes | | -------- | -------- | -------- | | Нӣш | Ниш | true | | үй | үи | true | | Хороший | Хорошии | true | | Добрий | добрии | false |

The last ones are false because functions are Case Sensitive.

Installation

npm install cyrillic-latin-search
# or
yarn add cyrillic-latin-search

Usage

import { includes, indexOf, setDefaultAlphabet } from "cyrillic-latin-search";

// latin search
includes("Lep je grad, Niš", "Nis"); // => true
indexOf("Lep je grad, Niš", "Nis"); // => 13

// cyrillic search
includes("Привет мой друг", "мои", "cyrillic"); // => true
setDefaultAlphabet("cyrillic"); // you can set 'latin' or 'cyrillic'
indexOf("Привет мой друг", "мои"); // => 7

Documentation

Default alphabet is latin. But you can change that with function setDefaultAlphabet

Types

type Alphabet = "cyrillic" | "latin";

Functions

Returns true if searchString appears as a substring in string str.

includes(str: string, searchString: string, alphabet?: Alphabet): boolean

Returns the position of the first occurrence of a searchString or -1 if searchString is not occurring in string str.

indexOf(
  str: string,
  searchString: string,
  alphabet?: Alphabet,
  position?: number // start of the search (by default 0)
): number;

Finding all the occurrences of an searchString in str and returning array of positions or empty array if it is not present.

allIndexOf(
  str: string,
  searchString: string,
  alphabet?: Alphabet,
  position?: number // start of the search (by default 0)
): number[]

Sets defaultAlphabet witch is used by other functions. Valid values are: "cyrillic" or "latin".

setDefaultAlphabet(alphabet: Alphabet): void

Gets defaultAlphabet witch is used by other functions. By default this will return "latin"

getDefaultAlphabet(): string

Converts string str to Celavica depending on defaultAlphabet or passed argument alphabet. (eg.) // for alphabet = "latin" Niš -> Nis, // for alphabet = "cyrillic" Хороший -> Хорошии

convertToCelavica(str: string, alphabet?: Alphabet): string

Gets dictionary that is used for conversion from Cyrillic/Latin to Celavica based on alphabet.

getDict(alphabet?: Alphabet): Record<string, string>