Registry / data / nlcst-emoticon-modifier

nlcst-emoticon-modifier

JSON →
library3.0.1jsnpmunverified

nlcst-emoticon-modifier is a specialized utility within the `unified` ecosystem, designed to process Natural Language Concrete Syntax Trees (NLCST). It identifies ASCII-based emoticons (e.g., `:)`, `:(`) within text and transforms them into dedicated `EmoticonNode` objects in the syntax tree. This package is currently stable at version `3.0.1` and follows the `unified` collective's release strategy, which typically involves new major versions for significant breaking changes like Node.js version updates or module system transitions. It is a foundational tool for natural language processing, offering a precise way to classify emoticons, distinguishing itself by its integration with the `nlcst` specification and its ESM-only distribution. Higher-level plugins, such as `retext-emoji`, build upon this utility for broader emoji and emoticon support.

npm install nlcst-emoticon-modifier
INSTALL
IMPORT
SIG · NLCST-EMOTICON-MOD
N
nlcst-emoticon-modifier
datajavascriptv3.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

emoticonModifier
import { emoticonModifier } from 'nlcst-emoticon-modifier'
const emoticonModifier = require('nlcst-emoticon-modifier')
This package is ESM-only since v2.0.0 and requires Node.js 16+ since v3.0.0. There is no default export.
Emoticon
import type { Emoticon } from 'nlcst-emoticon-modifier'
import { Emoticon } from 'nlcst-emoticon-modifier'
Used for TypeScript type annotations. Importing the utility also registers the Emoticon node type with `@types/nlcst` globally.

Demonstrates how to integrate `emoticonModifier` into a `ParseEnglish` pipeline to transform ASCII emoticons into `EmoticonNode`s within an NLCST sentence, then inspects the resulting tree.

import { emoticonModifier } from 'nlcst-emoticon-modifier'; import { ParseEnglish } from 'parse-english'; import { inspect } from 'unist-util-inspect'; const parser = new ParseEnglish(); parser.tokenizeSentencePlugins.unshift(emoticonModifier); const sentence = parser.parse('This makes me feel :).').children[0].children[0]; console.log(inspect(sentence));
Debug
Known issues
breakingVersion 3.0.0 updated the minimum Node.js requirement to Node.js 16 and above.
fix
Ensure your Node.js environment is version 16 or newer. Update by using `nvm install 16` or similar version management tools.
affects: >=3.0.0
breakingVersion 2.0.0 switched the package to be ESM-only. CommonJS `require()` statements are no longer supported.
fix
Migrate your project to use ES modules (`import`/`export` syntax). If you must use CommonJS, you will need to stick to `nlcst-emoticon-modifier@^1`.
affects: >=2.0.0
breakingVersion 3.0.0 introduced the `exports` field in `package.json`, which affects how modules are resolved, especially for direct file imports (e.g., `require('pkg/file.js')`).
fix
Always use the main entry point `import { symbol } from 'nlcst-emoticon-modifier'`. Avoid direct deep imports into internal files unless explicitly documented, as these are no longer stable.
affects: >=3.0.0
breakingVersion 3.0.0 removed the `complex-types.d.ts` file.
fix
Consumers should now rely on the main module's type declarations which provide the `Emoticon` type.
affects: >=3.0.0
gotchaTo correctly register the `Emoticon` node type for TypeScript within the `nlcst` ecosystem (e.g., for `unist-util-visit`), you need to import the `nlcst-emoticon-modifier` package somewhere in your type declarations or application.
fix
Add `import type { Emoticon } from 'nlcst-emoticon-modifier';` or `/** @typedef {import('nlcst-emoticon-modifier')} */` to a relevant TypeScript file in your project.
affects: >=2.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/nlcst-emoticon-modifier/index.js not supported.
Attempting to use `require()` to import an ESM-only package.
fix
Refactor your code to use `import { emoticonModifier } from 'nlcst-emoticon-modifier'` within an ES module context. Ensure your `package.json` has `"type": "module"` or files end with `.mjs`.
TypeError: emoticonModifier is not a function
Incorrectly importing the `emoticonModifier` symbol, typically by trying to import a default export or using `require()` incorrectly.
fix
Use a named import: `import { emoticonModifier } from 'nlcst-emoticon-modifier'`. The package does not provide a default export.
TS2307: Cannot find module 'nlcst-emoticon-modifier' or its corresponding type declarations.
TypeScript compiler cannot locate the type definitions for the package, often related to `moduleResolution` settings or `skipLibCheck`.
fix
Ensure `npm install` has been run and `@types/nlcst` is installed if you're working with nlcst nodes directly. Check `tsconfig.json` for `moduleResolution` set to `node16` or `bundler` for modern ESM environments.
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources