Registry / data / nlcst-affix-emoticon-modifier

nlcst-affix-emoticon-modifier

JSON →
library3.0.0jsnpmunverified

nlcst-affix-emoticon-modifier is a utility within the unified ecosystem designed to process Natural Language Concrete Syntax Tree (NLCST) nodes. Its primary function is to identify and re-position emoticons that appear at the beginning of a sentence, moving them to the end of the preceding sentence. This addresses common linguistic patterns where users place emoticons as a reaction to the previous thought, even after terminal punctuation. The current stable version is 3.0.0, which requires Node.js 16+. While a low-level utility, it forms a crucial part of more abstracted tools like `retext-emoji`. The project follows semver for releases, with significant breaking changes in major versions, particularly the move to ESM-only in v2 and further API adjustments in v3.

npm install nlcst-affix-emoticon-modifier
INSTALL
IMPORT
SIG · NLCST-AFFIX-EMOTIC
N
nlcst-affix-emoticon-modifier
datajavascriptv3.0.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

affixEmoticonModifier
✓ import { affixEmoticonModifier } from 'nlcst-affix-emoticon-modifier'
✗ const affixEmoticonModifier = require('nlcst-affix-emoticon-modifier')
This package is ESM-only since v2.0.0, and requires Node.js 16+ since v3.0.0. CommonJS `require` will result in an error.
Emoticon (type)
✓ import type { Emoticon } from 'nlcst-emoticon-modifier'
✗ import type { Emoticon } from 'nlcst-affix-emoticon-modifier'
The `Emoticon` type was removed from `nlcst-affix-emoticon-modifier` in v3.0.0. It must now be imported directly from `nlcst-emoticon-modifier`.

This example demonstrates how to parse a sentence with an initial emoticon and then use `affixEmoticonModifier` to move it into the previous sentence in the NLCST tree.

import {affixEmoticonModifier} from 'nlcst-affix-emoticon-modifier' import {emoticonModifier} from 'nlcst-emoticon-modifier' import {ParseEnglish} from 'parse-english' import {inspect} from 'unist-util-inspect' const parser = new ParseEnglish() // Register emoticonModifier to tokenize emoticons into EmoticonNodes parser.tokenizeSentencePlugins.unshift(emoticonModifier) // Register affixEmoticonModifier to move these nodes after terminal punctuation parser.tokenizeParagraphPlugins.unshift(affixEmoticonModifier) const text = 'Hey. :) How is it going?' const tree = parser.parse(text) console.log(inspect(tree)) /* Expected output will show ' :)' moved into the first sentence. */
Debug
Known issues
breakingThe package is now ESM-only (ECMAScript Modules). CommonJS `require()` is no longer supported.
fix
Migrate your project to use ES modules (`import`/`export` syntax). Ensure your `package.json` specifies `"type": "module"` or use `.mjs` file extensions for ES module files.
affects: >=2.0.0
breakingThis package now requires Node.js version 16 or higher to run.
fix
Upgrade your Node.js runtime environment to version 16 or a newer LTS release.
affects: >=3.0.0
breakingThe package now uses the `exports` field in its `package.json`, which affects module resolution and restricts direct deep imports or access to previously public internal paths.
fix
Avoid relying on internal or undocumented paths. Always import public APIs directly from the main package entry point, e.g., `import { affixEmoticonModifier } from 'nlcst-affix-emoticon-modifier'`.
affects: >=3.0.0
breakingThe `Emoticon` TypeScript type has been removed from `nlcst-affix-emoticon-modifier`.
fix
If you were importing the `Emoticon` type, you must now import it from `nlcst-emoticon-modifier` instead: `import type { Emoticon } from 'nlcst-emoticon-modifier'`.
affects: >=3.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM (or similar 'require is not defined in ES module scope')
Attempting to use `require()` to import `nlcst-affix-emoticon-modifier`, which is an ESM-only package.
fix
Update your import statement to use ES module syntax: `import { affixEmoticonModifier } from 'nlcst-affix-emoticon-modifier'`. Ensure your project's `package.json` has `"type": "module"` or you are using `.mjs` file extensions.
TypeError: affixEmoticonModifier is not a function
This error often occurs when running on an unsupported Node.js version (older than 16) or due to incorrect interoperability between CommonJS and ES Modules.
fix
Ensure your Node.js version is 16 or newer. Verify that your project is correctly configured for ES modules, using `import` statements and appropriate `package.json` settings.
Property 'Emoticon' does not exist on type 'typeof import("nlcst-affix-emoticon-modifier")'
Attempting to import the `Emoticon` type directly from `nlcst-affix-emoticon-modifier` in TypeScript after upgrading to v3.0.0.
fix
The `Emoticon` type has been moved. Import it from `nlcst-emoticon-modifier` instead: `import type { Emoticon } from 'nlcst-emoticon-modifier'`.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
nlcst-emoticon-modifierrequiredRequired to create the `EmoticonNode`s that this utility processes. Also provides the `Emoticon` type since v3.0.0.
nlcst-emoji-modifieroptionalCan also produce `EmoticonNode`s that this utility processes, often used alongside `nlcst-emoticon-modifier`.
parse-englishoptionalCommonly used parser in examples and workflows for building an NLCST tree to apply modifiers.
Agent activity
2 hits · last 30 days
node
2
Resources
nlcst-affix-emoticon-modifier — npm install nlcst-affix-emoticon-modifier · libregistry