Registry / productivity / ask-jp-formatter

ask-jp-formatter

JSON →
library2.2.2jsnpmunverified

A simple formatter for Japanese Alexa Skill content. Provides helper functions to convert written Japanese text into natural speech-friendly expressions suitable for Alexa responses. Version 2.2.2 is the latest. It handles common conversions such as replacing periods with polite forms, expanding symbols like '&' to 'アンド', and formatting date ranges. Differentiates itself by being lightweight and specific to Japanese Alexa skill development, complementing the ask-sdk ecosystem.

npm install ask-jp-formatter
INSTALL
IMPORT
SIG · ASK-JP-FORMATTER
A
ask-jp-formatter
productivityjavascriptv2.2.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

replaceDescription
import { replaceDescription } from 'ask-jp-formatter'
const replaceDescription = require('ask-jp-formatter').replaceDescription
ESM import since v2.0. Using require with destructuring still works in CommonJS.
replaceSpeechContent
import { replaceSpeechContent } from 'ask-jp-formatter'
import replaceSpeechContent from 'ask-jp-formatter'
Named export, not default export.
replaceLabel
import { replaceLabel } from 'ask-jp-formatter'
const replaceLabel = require('ask-jp-formatter').replaceLabel
CommonJS require works, but ESM imports are preferred for tree-shaking.

Demonstrates the three main formatting functions: replaceDescription, replaceSpeechContent, and replaceLabel with example Japanese text.

import { replaceDescription, replaceSpeechContent, replaceLabel } from 'ask-jp-formatter'; const desc = replaceDescription('テストである。仕方ないが、確認する。'); console.log(desc); // 'テストです。仕方ありませんが、確認します。' const speech = replaceSpeechContent('『テスト&チェック』 (1990年1月 - )'); console.log(speech); // 'テストアンドチェック (1990年1月生まれ)' const label = replaceLabel('『テスト&チェック』'); console.log(label); // '「テスト&チェック」'
Debug
Known issues
breakingIn v2.0.0, the package switched to ESM-first. CommonJS require still works, but tree-shaking may be affected.
fix
Use ESM imports (import { ... } from 'ask-jp-formatter') instead of require() for best compatibility.
affects: >=2.0.0
deprecatedThe function 'replaceSpeechContent' had a different behavior for date ranges before v1.5.0. It used to keep parentheses and hyphens literally.
fix
Upgrade to v1.5.0 or later to get proper date range conversion like (1990年1月 - ) -> (1990年1月生まれ).
affects: <1.5.0
gotchaReplaceDescription only handles sentence-ending polite forms; it does not convert casual-to-polite in the middle of sentences.
fix
Ensure your input text is already in a mix of casual/polite as needed; the function only modifies final stops and some phrase endings.
affects: *
Errors
Common errors & fixes
Cannot find module 'ask-jp-formatter'
Missing npm installation or incorrect import path after npm install.
fix
Run 'npm install ask-jp-formatter' and ensure your project's package.json includes it.
TypeError: replaceDescription is not a function
Attempted to import default export instead of named export.
fix
Use named imports: import { replaceDescription } from 'ask-jp-formatter'.
Upgrade
Version history
2.2.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
27 hits · last 30 days
node
22
OpenAI (training)
1
Resources
ask-jp-formatter — npm install ask-jp-formatter · libregistry