type-gimei
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

type-gimei

Tests

type-gimeiは日本人の名前をランダムに返すライブラリです。

テストの時に使うことを想定しています。

rubyのgimeiにインスパイアされており、インターフェースをなるべく踏襲するようにしています。

使い方

TypeScript

import { Gimei, Name, Address } from 'type-gimei';

for (let i = 0; i < 10; i++) {
  const name: Name = Gimei.randomName();
  const hiragana: string = name.hiragana();
  const romaji: string = name.romaji();
  const kanji: string = name.kanji();
  const katakana: string = name.katakana();
  const address: Address = Gimei.randomAddress();
  const address_hiragana: string = address.hiragana();
  const address_romaji: string = address.romaji();
  const address_kanji: string = address.kanji();
  const address_katakana: string = address.katakana();
  console.log(`
    ${hiragana}
    ${romaji}
    ${kanji}
    ${katakana}
    ${address_hiragana}
    ${address_romaji}
    ${address_kanji}
    ${address_katakana}
  `);
}

ES6, ES5

const {Gimei} = require('type-gimei');
for (let i = 0; i < 10; i++) {
  let name = Gimei.randomFemale();
  let address = Gimei.randomAddress();
  console.log(name.hiragana());
  console.log(name.kanji());
  console.log(name.romaji());
  console.log('----');
  console.log(address.hiragana());
  console.log(address.kanji());
  console.log(address.romaji());
  console.log('----');
}
var gimei = require('type-gimei').Gimei;

var name = gimei.randomName();
var hiragana = name.hiragana();
var romaji = name.romaji();
var kanji = name.kanji();
var katakana = name.katakana();

var address = gimei.randomAddress();
var address_hiragana = address.hiragana();
var address_romaji = address.romaji();
var address_kanji = address.kanji();
var address_katakana = address.katakana();

console.log(hiragana);
console.log(romaji);
console.log(kanji);
console.log(katakana);
console.log(address_hiragana);
console.log(address_romaji);
console.log(address_kanji);
console.log(address_katakana);

Contributors

Package Sidebar

Install

npm i type-gimei

Weekly Downloads

645

Version

1.0.3

License

MIT

Unpacked Size

7.43 MB

Total Files

41

Last publish

Collaborators

  • abcb2