Registry / x-is-string

x-is-string

JSON →
library0.1.0jsnpmunverified

The `x-is-string` package offers a singular, lightweight utility function designed to determine if a given JavaScript value is a string, encompassing both primitive string literals and `String` objects (e.g., `new String("value")`). Currently at version 0.1.0, the package was last published over 12 years ago and has received no updates or new releases since its inception. Despite its dormant status, it maintains a considerable number of weekly downloads, often due to its inclusion as a deep, indirect dependency in older projects. Its core appeal lies in its extremely minimal footprint and zero external dependencies, providing a direct, unopinionated string check. This contrasts with more actively maintained and feature-rich alternatives, which might include additional logic for cross-realm string detection or more robust type narrowing. Primarily targeting CommonJS environments given its age, `x-is-string` does not include explicit ECMAScript Module (ESM) export definitions in its `package.json`, relying instead on Node.js's backward compatibility for ESM interoperability.

npm install x-is-string
INSTALL
IMPORT
SIG · X-IS-STRING
X
x-is-string
javascriptv0.1.0
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.

isString
const isString = require('x-is-string')
Standard CommonJS import pattern.
isString
import isString from 'x-is-string'
import { isString } from 'x-is-string'
For ESM, use default import as this is a CommonJS module without explicit named exports. Node.js provides interoperability for this pattern.

Demonstrates how to import and use the `isString` function to test various JavaScript values.

const isString = require("x-is-string") console.log(isString("hello")) // -> true console.log(isString("")) // -> true console.log(isString(new String("things"))) // -> true console.log(isString(1)) // -> false console.log(isString(true)) // -> false console.log(isString(new Date())) // -> false console.log(isString({})) // -> false console.log(isString(null)) // -> false console.log(isString(undefined)) // -> false
Debug
Known issues
breakingThis package is effectively abandoned, having not received any updates, bug fixes, or security patches in over a decade (since its initial release 0.1.0, 12 years ago). Relying on it for new development or critical path code is highly discouraged as it will not address new JavaScript language features, runtime environments, or potential vulnerabilities.
fix
Consider migrating to actively maintained alternatives like `is-string` (from `inspect-js`) which offer broader compatibility, type definitions, and ongoing support.
affects: >=0.1.0
gotchaThe package lacks official ECMAScript Module (ESM) support, meaning it does not define `exports` in its `package.json`. While Node.js provides interoperability for CommonJS modules, direct named imports (`import { isString } from 'x-is-string'`) will not work. This can lead to unexpected `undefined` imports or runtime errors in ESM contexts.
fix
When using in an ESM project, use a default import: `import isString from 'x-is-string';`
affects: >=0.1.0
gotchaNo TypeScript type definitions are bundled with the `x-is-string` package, and no `@types/x-is-string` package exists on npm. This means TypeScript users will receive 'Could not find a declaration file for module' errors, hindering type checking and editor autocompletion.
fix
Manually declare the module's type: `declare module 'x-is-string' { function isString(value: any): boolean; export = isString; }` or use an actively maintained alternative like `is-string` which ships with TypeScript types.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: (0, _x_is_string.default) is not a function
Incorrect ESM import attempting to destructure a CommonJS default export, or a CommonJS module being imported as if it had named exports.
fix
For ESM, use `import isString from 'x-is-string';`. For CommonJS, use `const isString = require('x-is-string');`
Could not find a declaration file for module 'x-is-string'. 'c:/path/to/node_modules/x-is-string/index.js' implicitly has an 'any' type.
The package does not provide TypeScript type definitions, leading to TypeScript errors when imported.
fix
Create a custom declaration file (e.g., `src/types/x-is-string.d.ts`) with `declare module 'x-is-string' { function isString(value: any): boolean; export = isString; }`
Cannot find module 'x-is-string' or its corresponding type declarations.
The package has not been installed, or the module resolution path is incorrect.
fix
Ensure the package is installed by running `npm install x-is-string` or `yarn add x-is-string`. Verify module resolution settings in your build configuration if applicable.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources
x-is-string — npm install x-is-string · libregistry