diff --git a/packages/dantalion-i18n/README.md b/packages/dantalion-i18n/README.md index 590fb25..4896790 100644 --- a/packages/dantalion-i18n/README.md +++ b/packages/dantalion-i18n/README.md @@ -1,13 +1,221 @@ -# `@kurone-kito/dantalion-i18n` +# ๐Ÿฆ Dantalion: i18n resources library -> TODO: description +This package provides a function that infers the personality details +from the specified birthday. By using this package, you can quickly +implement birthday divination in your Node.js apps. Its calculation +is using the method of _Four Pillars of Destiny (Ba-Zi)_. + +This package is a library that obtains human-readable (Markdown format) +details for the output of the `@kurone-kito/dantalion-core` package. +It's only in Japanese yet, but we'll gradually support multiple languages. ## Usage Require: Node.js >= v12 +### Add to dependency + +```sh +npm install -S @kurone-kito/dantalion-core @kurone-kito/dantalion-i18n +``` + +### Get the details of the personality + ```js -const dantalionI18N = require('@kurone-kito/dantalion-i18n'); +const { getPersonality } = require('@kurone-kito/dantalion-core'); +const { genius } = require('@kurone-kito/dantalion-i18n'); + +const personality = getPersonality('1993-10-09'); +console.log(personality.inner); // === '555' + +const result = genius.getValue(personality.inner); + +console.log(JSON.stringify(result)); +``` + +#### Result + +In strictly, The function gets the raw object, not the JSON. +Since it's a long sentence, it omitted some parts. + +```json +{ + "name": "ๆ‚ ็„ถใ‚ฟใ‚คใƒ—", + "keyword": ["ๅธๆ—บ", "่™Ž"], + "summary": "ใƒใƒฉใƒณใ‚นๅž‹่ƒฝๅŠ›ใจ้ขๅ€’่ฆ‹ใŒ่‰ฏใ„ใ€ๅ‹‡่€…็š„ใƒใ‚ธใ‚ทใƒงใƒณ", + "detail": [ + "้‡ๅฝน็คพๅ“กใฎใ‚ˆใ†ใชใ€ไธ‡่ƒฝๆ„Ÿใจ่ฆชๅˆ†่‚Œใฎใ‚ˆใ†ใช็ฉบๆฐ—ๆ„Ÿใ‚’ๆŒใคไบบใŒๅคšใ„ใงใ™ใ€‚", + : + : + ], + "weak": [ + "ๆ‚ ็„ถใ‚ฟใ‚คใƒ—ใฎไบบใฏใ€่‡ชๅˆ†ใŒๆ‚ชใใฆใ‚‚่ฌ็ฝชใ™ใ‚‹ใฎใ‚’ๅซŒใŒใ‚Šใพใ™ใ€‚่ฒฌไปปใ‚„่ฌ็ฝชๅฟƒใ‚’ๆŒใฃใฆใ„ใฆใ‚‚ใ€ใใ‚Œใ‚’่กจๆ˜Žใ™ใ‚‹ใฎใŒๆฅต็ซฏใซ่‹ฆๆ‰‹ใงใ™ใ€‚" + ], + "strategy": [ + "ๆ‚ ็„ถใ‚ฟใ‚คใƒ—ใฎไบบใฏ่‡ชๅŠ›ใงใชใ‚“ใงใ‚‚ใงใใฆใ—ใพใ†ใŒใŸใ‚ใ€่‡ชๅˆ†ใงใชใ‚“ใงใ‚‚ๆŠฑใˆใฆใ—ใพใ„ใพใ™ใ€‚ไฝ•ใ‹ใ‚’ไปปใ›ใ‚‹้š›ใฏใ€Žใ‚„ใ‚‰ใ›ใ™ใŽใชใ„ใ€ใ‚ˆใ†ๆณจๆ„ใ™ใ‚‹ใจ่‰ฏใ„ใงใ—ใ‚‡ใ†ใ€‚" + ] +} +``` + +## API + +### `brain` + +The instance provides a set of functions that retrieve human-readable resources related to the thought method. + +- Type: `ResourcesAccessor` +- The [`Brain`](../dantalion-core#brain) type is a string literal union type provided by the `@kurone-kito/dantalion-core` library. + +### `communication` + +The instance provides a set of functions that retrieve human-readable resources related to dialogue policy. + +- Type: `ResourcesAccessor` +- The [`Communication`](../dantalion-core#communication) type is a string literal union type provided by the `@kurone-kito/dantalion-core` library. + +### `genius` + +The instance provides a set of functions that retrieve human-readable resources related to natural personality. + +- Type: `ResourcesAccessor` +- The [`Genius`](../dantalion-core#genius) type is a string literal union type provided by the `@kurone-kito/dantalion-core` library. + +### `management` + +The instance provides a set of functions that retrieve human-readable resources related to risk and return thinking in specific people. + +- Type: `ResourcesAccessor` +- The [`Management`](../dantalion-core#management) type is a string literal union type provided by the `@kurone-kito/dantalion-core` library. + +### `motivation` + +The instance provides a set of functions that retrieve human-readable resources related to an environment that is easy to get motivated. + +- Type: `ResourcesAccessor` +- The [`Motivation`](../dantalion-core#motivation) type is a string literal union type provided by the `@kurone-kito/dantalion-core` library. + +### `position` + +The instance provides a set of functions that retrieve human-readable resources related to a talented role. + +- Type: `ResourcesAccessor` +- The [`Position`](../dantalion-core#position) type is a string literal union type provided by the `@kurone-kito/dantalion-core` library. -// TODO: DEMONSTRATE API +### `response` + +The instance provides a set of functions that retrieve human-readable resources related to on-site or behind. + +- Type: `ResourcesAccessor` +- The [`Response`](../dantalion-core#response) type is a string literal union type provided by the `@kurone-kito/dantalion-core` library. + +### `vector` + +The instance provides a set of functions that retrieve human-readable resources related to the major classification of personality. + +- Type: `ResourcesAccessor` +- The [`Vector`](../dantalion-core#vector) type is a string literal union type provided by the `@kurone-kito/dantalion-core` library. + +## Types (for TypeScript) + +The strings contained in the object are in Markdown format. In the +case of an array of strings, the elements separate for each paragraph. + +### `DetailsBaseType` + +The type definition that the pair of name and detail. + +```ts +interface VectorType { + readonly detail: string; + readonly name: string; +} +``` + +| Property | Type | Description | +| :------- | :------- | :------------------------------ | +| `detail` | `string` | The detail. | +| `name` | `string` | The resource name as a heading. | + +### `DetailsType` + +The type definition that the name, detail and more descriptions. + +```ts +interface VectorType { + readonly detail: string; + readonly name: string; + readonly more: readonly string[]; +} +``` + +| Property | Type | Description | +| :------- | :------------------ | :------------------------------ | +| `detail` | `string` | The detail. | +| `more` | `readonly string[]` | The more detailed descriptions. | +| `name` | `string` | The resource name as a heading. | + +### `PersonalityType` + +A type definition of a structure that stores a +description of a particular person's personality. + +```ts +interface VectorType { + readonly detail: readonly string[]; + readonly keyword: readonly string[]; + readonly name: string; + readonly strategy: readonly string[]; + readonly summary: string; + readonly weak: readonly string[]; +} +``` + +| Property | Type | Description | +| :--------- | :------------------ | :--------------------------------------------------------------------- | +| `detail` | `readonly string[]` | The detail. | +| `keyword` | `readonly string[]` | The keywords. | +| `name` | `string` | The resource name. | +| `strategy` | `readonly string[]` | The strategies for communicating with people of this personality type. | +| `summary` | `string` | The short summary as a heading. | +| `weak` | `readonly string[]` | The weak points. | + +### `ResourcesAccessor` + +The type definition with a function to +access a resource of the specific category. + +```ts +interface ResourcesAccessor { + getAsync(key: K): Promise; + getCategoryDetailAsync(): Promise; +} +``` + +| Type | Constraint | Description | +| :--- | :----------------- | :-------------------------------------- | +| `T` | `object \| string` | The type of resource as a return value. | +| `K` | `string` | The type for the key. | + +| Method | Description | +| :---------------------------------------------------------------- | :---------------------------------------------------------------------------------------- | +| `getAsync(key: K): Promise` | The function acquires the resource corresponding to the key asynchronously. | +| `getCategoryDetailAsync(): Promise` | The function acquires the resource corresponding to the specific category asynchronously. | + +### `VectorType` + +A type definition of a structure that +stores a description of a personality type. + +```ts +interface VectorType { + readonly detail: string; + readonly name: string; + readonly strategy: readonly string[]; +} ``` + +| Property | Type | Description | +| :--------- | :------------------ | :--------------------------------------------------------------------- | +| `detail` | `string` | The detail. | +| `name` | `string` | The resource name as a heading. | +| `strategy` | `readonly string[]` | The strategies for communicating with people of this personality type. |