Full Code of tsivinsky/hi-mom for AI

master 8d1631d29edb cached
11 files
9.3 KB
3.3k tokens
2 symbols
1 requests
Download .txt
Repository: tsivinsky/hi-mom
Branch: master
Commit: 8d1631d29edb
Files: 11
Total size: 9.3 KB

Directory structure:
gitextract_7ntvilm0/

├── .babelrc
├── .github/
│   └── workflows/
│       └── test.yml
├── .gitignore
├── .prettierrc
├── README.md
├── index.d.ts
├── index.js
├── index.test.js
├── languages/
│   └── index.js
├── package.json
└── rollup.config.js

================================================
FILE CONTENTS
================================================

================================================
FILE: .babelrc
================================================
{
  "presets": ["@babel/preset-env"]
}


================================================
FILE: .github/workflows/test.yml
================================================
name: test

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
  workflow_dispatch:

jobs:
  test:
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
    name: Testing as a good child on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: 16
      - run: npm install --ignore-scripts
      - run: npm test


================================================
FILE: .gitignore
================================================
/node_modules
/lib
/coverage
.idea/


================================================
FILE: .prettierrc
================================================
{
  "tabWidth": 2,
  "useTabs": false,
  "semi": true,
  "singleQuote": false,
  "endOfLine": "lf",
  "trailingComma": "es5"
}


================================================
FILE: README.md
================================================
# Hi, mom!

A blazingly fast JavaScript library to say hi to your mom!

## Install

#### yarn

```bash
yarn add hi-mom
```

#### npm

```bash
npm i hi-mom
```

#### unpkg.com (UMD)

```html
<script src="https://unpkg.com/hi-mom/lib/hi-mom.umd.js"></script>
```

## Usage

#### CommonJS

```javascript
const { hiMom } = require("hi-mom");

console.log(hiMom()); // Hi, mom!
```

#### ES Modules

```javascript
import { hiMom } from "hi-mom";

console.log(hiMom()); // Hi, mom!
```

#### Browser (UMD)

```javascript
console.log(hiMom.hiMom());
```

#### custom mother name

```javascript
import { hiMom } from "hi-mom";

console.log(hiMom("Mother")); // Hi, Mother!
```

## Languages supported

- ar - Arabic
- ar-IQ - Iraqi Arabic
- as - Assamese
- az - Azerbaijani
- bn - Bengali
- bg - Bulgarian
- ca - Catalan
- cn - Chinese
- cs - Czech
- da - Danish
- de - German
- en - English
- en-AU - Australian English
- en-PT - Pirate Speak
- es - Spanish
- fa - Persian
- fr - French
- he - Hebrew
- hi - Hindi
- hr - Croatian
- hu - Hungarian
- id - Indonesian
- it - Italian
- ja - Japanese
- ko - Korean
- kaa - Karakalpak
- lt - Lithuanian
- mar - Marathi
- ml - Malayalam
- ms - Malay
- nl-BE - Flemish
- nl-NL - Dutch
- no - Norwegian
- no-NB - Norwegian Bokmål
- no-NN - Norwegian Nynorsk
- pl - Polish
- pt - Portuguese
- qt - Crimean
- ro - Romanian
- ru - Russian
- se - Swedish
- si - Sinhala
- sr - Serbian
- ta - Tamil
- th - Thai
- tl - Filipino
- tr - Turkish
- tm - Turkmen
- ua - Ukrainian
- ur - Urdu
- vi - Vietnamese
- zh - Zhongwen
- ug - Uyghur


================================================
FILE: index.d.ts
================================================
import languages from "./languages/index";

/**
 * Say hi to your mom blazingly fast!
 * @param name Mother's name
 * @param language Language of your mother
 * @example
 * import { hiMom } from "hi-mom";
 * console.log(hiMom()); // Hi, mom!
 */
export function hiMom(
  name?: string,
  language: keyof typeof languages = "en"
): string;

/**
 * Say hi to multiple moms blazingly fast!
 * @param mothers Your moms
 * @example
 * import { hiMoms } from "hi-mom";
 * console.log(hiMoms([
 *  { lang: "en" },
 *  { lang: "si" },
 * ]])); // Hi, mom! ආයුබෝවන්, අම්මේ!
 */
export function hiMoms(
  mothers: string | { name?: string; lang?: keyof typeof languages }[]
): string;


================================================
FILE: index.js
================================================
import languages from "./languages/index.js";

/**
 * A blazingly fast way to say hi to your mom!
 * @param {string} name - The mom name
 * @param {string} [language="en"] - The language
 * @example hiMom()
 * // "Hi, mom!"
 * @example hiMom("Kate")
 * // "Hi, Kate!"
 * @example hiMom("Maria", "pt")
 * // "Oi, Maria!"
 * @returns {string} A greeting to your mom in the informed language
 */
export function hiMom(name, language = "en") {
  if (!language || !languages.hasOwnProperty(language)) {
    throw new Error("Language not yet supported, but hi mom anyway!");
  }

  const regex = /\{{2}([^}]+)\}{2}/;
  const greeting = languages[language];
  const localeName = greeting.split(regex)[1];

  return greeting.replace(regex, name || localeName);
}

export function hiMoms(mothers) {
  if (typeof mothers == "string") {
    return hiMom(mothers);
  } else if (mothers instanceof Array) {
    return mothers.map((mother) => hiMom(mother?.name, mother?.lang)).join(" ");
  }

  throw new Error("Mother type not supported, but hi mom anyway!");
}


================================================
FILE: index.test.js
================================================
import { hiMom } from "./index";

test("should say hi to mom", () => {
  expect(hiMom()).toBe("Hi, mom!");
});

test("should not say hi to dad", () => {
  expect(hiMom()).not.toBe("Hi, dad!");
});

test("should say hi to Mother when requested", () => {
  expect(hiMom("Mother")).toBe("Hi, Mother!");
});

test("should say hi to mom in tamil when requested", () => {
  expect(hiMom("", "ta")).toContain("வணக்கம் அம்மா");
});

test("should say hi to mom in german when requested", () => {
  expect(hiMom("", "de")).toContain("Hallo");
});

test("should say hi to mom in danish when requested", () => {
  expect(hiMom("", "da")).toContain("Hej");
});

test("should say hi to mom in russian when requested", () => {
  expect(hiMom("", "ru")).toBe("Привет, мама!");
});

test("should say hi to mom in persian when requested", () => {
  expect(hiMom("", "fa")).toContain("مامان");
});

test("should say hi to Mother in french when requested", () => {
  expect(hiMom("Mother", "fr")).toContain("Mother");
});

test("should say hi to Mother in arabic when requested", () => {
  expect(hiMom("", "ar-IQ")).toContain("يمه");
});

test("should say hi to Mother in darija (Moroccan Arabic) when requested", () => {
  expect(hiMom("", "ar-MA")).toContain("ماما");
});

test("nl-Be should not say the same as nl-NL when requested", () => {
  expect(hiMom("", "nl-BE")).not.toBe(hiMom("", "nl-NL"));
});

test("should say hi to Mother in assamese when requested", () => {
  expect(hiMom("", "as")).toContain("অ' মা");
});

test("should say hi to mom in pirate speak when requested", () => {
  expect(hiMom("", "en-PT")).toContain("Ahoy,");
});

test("should say hi to Mother in azerbaijani when requested", () => {
  expect(hiMom("", "az")).toBe("Salam, ana!");
});

test("should say hi to Mother in Swedish and not Bork Bork!", () => {
  expect(hiMom("", "se")).toBe("Hej, mamma!");
});

test("should say hi to Mother in Norwegian Bokmål when requested", () => {
  expect(hiMom("", "no-NB")).toBe("Hei, mamma!");
});

test("should say hi to Mother in Norwegian Nynorsk when requested", () => {
  expect(hiMom("", "no-NN")).toBe("Hei, mamma!");
});

test("should say hi to Mother in Croatian when requested", () => {
  expect(hiMom("", "hr")).toBe("Bok, mama!");
});

test("should say hi to Mother in Filipino when requested", () => {
  expect(hiMom("", "tl")).toBe("Kamusta po, nanay!");
});

test("should say hi to Mother in Crimean when requested", () => {
  expect(hiMom("", "qt")).toBe("Selâm, anam!");
});

test("should say hi to Mother in Marathi when requested", () => {
  expect(hiMom("", "mar")).toBe("नमस्कार, आई!");
});

test("should say hi to mom in Bengali when requested", () => {
  expect(hiMom("", "bn")).toBe("নমস্কার, মা!");
});

test("should throw error when requested", () => {
  expect(() => hiMom("", "")).toThrowError(/language/i);
});


================================================
FILE: languages/index.js
================================================
export default {
  ar: "مرحباً, {{امي}}!",
  "ar-IQ": "هلا, {{يمه}}!",
  as: "মা, {{অ' মা}}",
  "ar-MA": "سلام، {{ماما}}",
  az: "Salam, {{ana}}!",
  bn: "নমস্কার, {{মা}}!",
  bg: "Здрасти, {{мамо}}!",
  ca: "Hola, {{mamà}}!",
  cn: "你好,{{妈妈}}!",
  cs: "Ahoj, {{mamá}}!",
  da: "Hej, {{mor}}!",
  de: "Hallo, {{Mama}}!",
  en: "Hi, {{mom}}!",
  "en-AU": "Hi, {{mum}}!",
  "en-PT": "Ahoy, {{mom}}!",
  es: "Hola, {{mamá}}!",
  fa: "سلام، {{مامان}}!",
  fr: "Salut, {{maman}}!",
  he: "שלום, {{מה}}!",
  hi: "नमस्ते {{मम्मी}}!",
  hr: "Bok, {{mama}}!",
  hu: "Szia, {{anya}}!",
  id: "Hai, {{ibu}}!",
  it: "Ciao {{mamma}}!",
  ja: "こんにちは、{{ママ}}!",
  ko: "안녕, {{엄마}}!",
  kaa: "Sálem, {{anajan}}!",
  lt: "Labas, {{mama}}!",
  mar: "नमस्कार, {{आई}}!",
  ml: "ഹായ്, {{അമ്മേ}}!",
  ms: "Hai, {{bapa}}!",
  "nl-BE": "Hallo, {{moeke}}!",
  "nl-NL": "Hallo, {{moeder}}!",
  no: "Hei, {{mamma}}!",
  "no-NB": "Hei, {{mamma}}!",
  "no-NN": "Hei, {{mamma}}!",
  pl: "Cześć, {{matka}}!",
  pt: "Oi, {{mãe}}!",
  ro: "Bună, {{mamă}}!",
  ru: "Привет, {{мама}}!",
  se: "Hej, {{mamma}}!",
  si: "ආයුබෝවන්, {{අම්මේ}}!",
  sr: "Ćao, {{mama}}!",
  ta: "வணக்கம் {{அம்மா}}",
  th: "สวัสดีค่ะ, {{มา}}!",
  tl: "Kamusta po, {{nanay}}!",
  tr: "Merhaba, {{anne}}!",
  tm: "Salam, {{eje}}!",
  ua: "Привіт, {{мама}}!",
  ur: "سلام، {{امی}}",
  vi: "Xin chào, {{mẹ}}!",
  zh: "你好,{{妈妈}}!",
  ug: "سالام، {{ئاپا}}!",
  qt: "Selâm, {{anam}}!",
};


================================================
FILE: package.json
================================================
{
  "name": "hi-mom",
  "version": "1.2.1",
  "description": "A blazingly fast JavaScript library to say hi to your mom!",
  "main": "index.js",
  "types": "index.d.ts",
  "keywords": [
    "hello-world",
    "hello",
    "hi",
    "mom",
    "hi-mom"
  ],
  "author": "Daniil Tsivinsky",
  "license": "MIT",
  "type": "module",
  "devDependencies": {
    "@babel/core": "^7.17.8",
    "@babel/preset-env": "^7.16.11",
    "jest": "^27.5.1",
    "rollup": "^2.70.1"
  },
  "scripts": {
    "prebuild": "npm run test",
    "build": "rollup -c rollup.config.js",
    "prepublishOnly": "npm run build",
    "test": "jest",
    "coverage": "jest --coverage"
  },
  "exports": {
    ".": {
      "require": "./lib/hi-mom.cjs",
      "import": "./lib/hi-mom.esm.js"
    }
  },
  "files": [
    "lib/",
    "languages/",
    "index.d.ts"
  ]
}


================================================
FILE: rollup.config.js
================================================
import { defineConfig } from "rollup";

export default defineConfig({
  input: "./index.js",
  output: [
    {
      file: "./lib/hi-mom.cjs",
      format: "cjs",
      exports: "auto",
    },
    {
      file: "./lib/hi-mom.esm.js",
      format: "esm",
      exports: "auto",
    },
    {
      file: "./lib/hi-mom.umd.js",
      format: "umd",
      exports: "auto",
      name: "hiMom",
    },
  ],
});
Download .txt
gitextract_7ntvilm0/

├── .babelrc
├── .github/
│   └── workflows/
│       └── test.yml
├── .gitignore
├── .prettierrc
├── README.md
├── index.d.ts
├── index.js
├── index.test.js
├── languages/
│   └── index.js
├── package.json
└── rollup.config.js
Download .txt
SYMBOL INDEX (2 symbols across 1 files)

FILE: index.js
  function hiMom (line 15) | function hiMom(name, language = "en") {
  function hiMoms (line 27) | function hiMoms(mothers) {
Condensed preview — 11 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (11K chars).
[
  {
    "path": ".babelrc",
    "chars": 39,
    "preview": "{\n  \"presets\": [\"@babel/preset-env\"]\n}\n"
  },
  {
    "path": ".github/workflows/test.yml",
    "chars": 522,
    "preview": "name: test\n\non:\n  push:\n    branches:\n      - master\n  pull_request:\n    branches:\n      - master\n  workflow_dispatch:\n\n"
  },
  {
    "path": ".gitignore",
    "chars": 36,
    "preview": "/node_modules\n/lib\n/coverage\n.idea/\n"
  },
  {
    "path": ".prettierrc",
    "chars": 127,
    "preview": "{\n  \"tabWidth\": 2,\n  \"useTabs\": false,\n  \"semi\": true,\n  \"singleQuote\": false,\n  \"endOfLine\": \"lf\",\n  \"trailingComma\": \""
  },
  {
    "path": "README.md",
    "chars": 1563,
    "preview": "# Hi, mom!\n\nA blazingly fast JavaScript library to say hi to your mom!\n\n## Install\n\n#### yarn\n\n```bash\nyarn add hi-mom\n`"
  },
  {
    "path": "index.d.ts",
    "chars": 675,
    "preview": "import languages from \"./languages/index\";\n\n/**\n * Say hi to your mom blazingly fast!\n * @param name Mother's name\n * @p"
  },
  {
    "path": "index.js",
    "chars": 1050,
    "preview": "import languages from \"./languages/index.js\";\n\n/**\n * A blazingly fast way to say hi to your mom!\n * @param {string} nam"
  },
  {
    "path": "index.test.js",
    "chars": 2845,
    "preview": "import { hiMom } from \"./index\";\n\ntest(\"should say hi to mom\", () => {\n  expect(hiMom()).toBe(\"Hi, mom!\");\n});\n\ntest(\"sh"
  },
  {
    "path": "languages/index.js",
    "chars": 1422,
    "preview": "export default {\n  ar: \"مرحباً, {{امي}}!\",\n  \"ar-IQ\": \"هلا, {{يمه}}!\",\n  as: \"মা, {{অ' মা}}\",\n  \"ar-MA\": \"سلام، {{ماما}}"
  },
  {
    "path": "package.json",
    "chars": 837,
    "preview": "{\n  \"name\": \"hi-mom\",\n  \"version\": \"1.2.1\",\n  \"description\": \"A blazingly fast JavaScript library to say hi to your mom!"
  },
  {
    "path": "rollup.config.js",
    "chars": 408,
    "preview": "import { defineConfig } from \"rollup\";\n\nexport default defineConfig({\n  input: \"./index.js\",\n  output: [\n    {\n      fil"
  }
]

About this extraction

This page contains the full source code of the tsivinsky/hi-mom GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 11 files (9.3 KB), approximately 3.3k tokens, and a symbol index with 2 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!