New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@matsukky/gender

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@matsukky/gender

Easy list of gender terms in several languages.

0.1.6
latest
Source
npm
Version published
Weekly downloads
25
-85.96%
Maintainers
0
Weekly downloads
 
Created
Source

Gender

Lightweight, dependency-free library for gender-specific terms in multiple languages

English - French - Spanish - Italian - German - Japanese - Chinese - Arabic - Russian

A minimalist library that provides a comprehensive way to handle gender representation in various languages. Zero dependencies, tree-shakeable, and type-safe.

Table of Contents

  • Installation
  • Features
  • Usage
  • API Reference
  • Types

Installation

npm install @matsukky/gender
# or
yarn add @matsukky/gender
# or
bun add @matsukky/gender

Features

  • 🪶 Lightweight
  • 📦 Zero dependencies
  • 🌍 Support for multiple languages
  • 🎨 Color schemes for each gender
  • 🔄 Custom properties support
  • 🔠 Automatic capitalization
  • 📝 Rich set of gender-specific terms
  • 💪 Fully typed (TypeScript)

Usage

Basic Usage

import gender from '@matsukky/gender';

const female = gender('F');
console.log(female.genderName);    // "woman"
console.log(female.childTerm);     // "girl"
console.log(female.emoji);         // "🚺"

const male = gender('MALE');       // Alias support
console.log(male.genderName);      // "man"
console.log(male.colors.primary);  // "#1e90ff"

const neutral = gender('X');
console.log(neutral.genderName);   // "person"

Localization

import gender, { locale } from '@matsukky/gender';

// Load French locale
await locale('fr');

const female = gender('F');
console.log(female.genderName);    // "femme"
console.log(female.childTerm);     // "fille"

Custom Properties

import gender from '@matsukky/gender';

// Definition of context-specific terms
const result = gender('F', {
  custom: {
    occupation: {
      F: "actress",
      M: "actor",
      X: "performer"
    },
    workplace: {
      F: "actresses' room",
      M: "actors' room",
      X: "performers' room"
    },
    award: {
      F: "best actress",
      M: "best actor",
      X: "best performance"
    }
  }
});

// Basic usage
console.log(result.occupation);     // "actress"
console.log(result.workplace);      // "actresses' room"

// Combination with standard properties
console.log(`${result.title} ${result.genderName}`);          // "Mrs woman"
console.log(`${result.occupation} ${result.objectPronoun}`);   // "actress her"

// Usage with capitalization
const capitalizedResult = gender('F', {
  capitalize: true,
  custom: {
    occupation: {
      F: "actress",
      M: "actor",
      X: "performer"
    }
  }
});

console.log(capitalizedResult.occupation);  // "Actress"

The gender function allows extending standard properties with custom terms while maintaining gender consistency. Each custom property must define a value for all three genders (F, M, X) to ensure inclusive usage.

Capitalization

import gender from '@matsukky/gender';

const result = gender('F', { capitalize: true });
console.log(result.genderName);    // "Woman"
console.log(result.childTerm);     // "Girl"

API Reference

gender(type, options)

gender(type: AvalaibleGender, options?: {
  capitalize?: boolean;
  custom?: Record<string, Record<'F' | 'M' | 'X', string>>;
  language?: AvalaibleLanguage;
}): GenderData

locale(language, define?)

locale(language: AvalaibleLanguage, define?: boolean): Promise<GenderCollection>

Types

GenderData Properties

PropertyDescriptionExample (Female)
emojiGender emoji🚺
colorsColor palette object{ rose, petal, bloom, blush, berry }
genderNameGender name"woman"
childTermTerm for child"girl"
adultTermTerm for adult"woman"
combinedMostly used in social media as pronouns"she/her"
subjectPronounSubject pronoun"she"
objectPronounObject pronoun"her"
indirectPronounIndirect pronoun"her"
possessiveAdjectivePossessive adjective"her"
reflexivePronounReflexive pronoun"herself"
demonstrativeDemonstrative pronoun"she"
indeterminateArticleIndeterminate article"a"
genderAdjectiveGender adjective"female"
pluralSubjectPronounPlural subject pronoun"they"
pluralPossessiveAdjPlural possessive adjective"their"
titleFull honorific title"Mrs."
shortTitleShort honorific title"Ms."

Avalaible Gender Keys

RoleValues
FF, ♀, WOMAN, GIRL, FEMALE, SHE, HER
MM, H, ♂, MAN, MEN, BOY, MALE, HE, HIM
XX, N, ⚧, NEUTRAL, HUMAN, THEY, THEM

Keywords

gender

FAQs

Package last updated on 02 Mar 2025

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