Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
A module for efficiently querying name records from ENAMDICT (A Japanese-English mapping of proper names). Specifically this module is designed for the use case of finding a good English/Kana/Kanji mapping for given names and surnames. Finding these mappings can be especially challenging and ENAMDICT appears to have the best available mapping. At this time all other entries in ENAMDICT are ignored (such as place names, full names, company names, etc.).
This utility was created to correct artist names in the romaji-name
library, which is used in the Ukiyo-e.org service, created by John Resig. All code is available under an MIT license.
var enamdict = require("./enamdict");
enamdict.init(function() {
var entries = enamdict.find("utagawa");
console.log("Romaji:", entries.romaji());
console.log("Kana:", entries.kana());
console.log("Kanji:", entries.kanji());
console.log("Type:", entries.type());
entries = enamdict.findKanji("曷川")
console.log("Romaji:", entries.romaji());
console.log("Kana:", entries.kana());
console.log("Kanji:", entries.kanji());
console.log("Type:", entries.type());
});
Sample Output:
# From `find()`
Romaji: Utagawa
Kana: うたがわ
Kanji: [ '哥川', '唄川', '宇多川', '宇田川', '歌川', '詩川', '雅楽川' ]
Type: surname
# From `findKanji()`
Romaji: [ 'katsugawa', 'katsukawa' ]
Kana: [ 'かつがわ', 'かつかわ' ]
Kanji: 曷川
Type: surname
This package can be installed by running:
npm install enamdict
When this package is installed a copy of ENAMDICT is downloaded from ftp.edrdg.org, if it doesn't already exist. A couple optimizations are performed in order to speed up search time and to decrease the file size of the dictionary.
This is all placed into a new enamdict.gz
file in the same directory as the enamdict.js
script itself. For comparison the old ENAMDICT file is 7.2MB whereas the new one is only 2.8MB.
.init(callback)
Asynchronously loads the previously-generated reduced ENAMDICT. Must be called before attempting to call .find()
or .findKanji()
.
.find(romajiName)
Finds matching entries by Romaji name (English name). This is the default search mechanism, the search index is optimized for this particular method. Returns an Entries
object.
.findKanji(kanjiName)
Finds matching entries by Kanji name (Japanese name). The search index is NOT optimized for this particular method and may be slow. Returns an Entries
object.
Entries
The result object returned from the .find()
and .findKanji()
methods. Holds a collection of entries that are then used in aggregate.
.entries()
Returns an array of objects representing matching entries. The objects have the following properties:
romaji
: A string holding an English (Romaji) representation of a name.kana
: A string holding a Kana representation of a name.kanji
: A string holding a Kanji representation of a name.type
: A string that represents the type of the name. Possible values are: "surname"
, "given"
, or "unknown"
..type()
Returns the most popular type of the name, aggregated from all matching entries. For example if 5 entries were found, three of which were "surname"
, 1 of which was "given"
, and 1 of which was "unknown"
then this method would return "surname"
. Returns the same possible values as the type
property itself.
.kana()
If a query was done with .find()
then this will return a string representing the Kana reading of the name.
If a query was done with .findKanji()
then this will return an array of all the possible Kana readings of the Kanji.
.romaji()
If a query was done with .find()
then this will return a string representing the Romaji reading of the name.
If a query was done with .findKanji()
then this will return an array of all the possible Kana readings of the Kanji.
.kanji()
If a query was done with .find()
then this will return an array of all the possible Kanji versions of the name.
If a query was done with .findKanji()
then this will return a string representing the Kanji version of the name.
FAQs
Efficiently query ENAMDICT using Node.js.
The npm package enamdict receives a total of 23 weekly downloads. As such, enamdict popularity was classified as not popular.
We found that enamdict demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.