Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

turkish-string

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turkish-string

isomorphic turkish string utilities for javascript

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

turkish-string

isomorphic turkish string utilities for javascript

GitHub version npm version Build Status codecov

NPM

Installation

$ yarn add turkish-string

Documentation

initialize via constructor, create or clone methods

const TurkishString = require("turkish-string");

const str1 = new TurkishString("string");
const str2 = TurkishString.create("string");
const str3 = new TurkishString(str1);
const str4 = TurkishString.create(str2);
const str5 = str4.clone();

Lowercase transform

const TurkishString = require("turkish-string");

const instance = new TurkishString("Ç-Ğ-I-İ-Ö-Ş-Ü");
const str1 = instance.toLowerCase();                     //ç-ğ-ı-i-ö-ş-ü
const str2 = TurkishString.toLowerCase("Ç-Ğ-I-İ-Ö-Ş-Ü"); //ç-ğ-ı-i-ö-ş-ü
const str3 = TurkishString.toLowerCase(instance);        //ç-ğ-ı-i-ö-ş-ü

Uppercase transform

const TurkishString = require("turkish-string");

const instance = new TurkishString("ç-ğ-ı-i-ö-ş-ü");
const str1 = instance.toUpperCase();                     //Ç-Ğ-I-İ-Ö-Ş-Ü
const str2 = TurkishString.toUpperCase("Ç-Ğ-I-İ-Ö-Ş-Ü"); //Ç-Ğ-I-İ-Ö-Ş-Ü
const str3 = TurkishString.toUpperCase(instance);        //Ç-Ğ-I-İ-Ö-Ş-Ü

Clear turkish characters

const TurkishString = require("turkish-string");

const instance = new TurkishString("Ç-Ğ-I-İ-Ö-Ş-Ü");
const str1 = instance.clear();                     //C-G-I-I-O-S-U
const str2 = TurkishString.clear("Ç-Ğ-I-İ-Ö-Ş-Ü"); //C-G-I-I-O-S-U
const str3 = TurkishString.clear(instance);        //C-G-I-I-O-S-U

Sorting support

For sorting TurkishString.compare method can be use as compare function

const letters = ["ğ", "g'", "f", "e", "d", "ç", "c", "b", "a"];

const englishSorted = letters.sort();
//["a", "b", "c", "d", "e", "f", "g", "ç", "ğ"]

const turkishSorted = letters.sort(TurkishString.compare);
//["a", "b", "c", "ç", "d", "e", "f", "g", "ğ"]

Other instance and static methods

  • isLessThan
  • isLessThanOrEqual
  • isGreaterThan
  • isGreaterThanOrEqual

Keywords

FAQs

Package last updated on 03 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc