Registry / web-framework / dataset-transpiler

dataset-transpiler

JSON →
library0.1.2jsnpmunverified

A JavaScript utility that transforms `.dataset.X` property access into equivalent `getAttribute('data-X')` and `setAttribute('data-X', value)` calls for backward compatibility with older browsers. Version 0.1.2 (last released Jan 2015) fixes simple setters/getters; nested `.dataset` calls remain unsupported. This package is a relic of the pre-standard `HTMLElement.dataset` era and is superseded by native browser support. It has no active maintenance and is only useful for legacy project archaeology.

npm install dataset-transpiler
INSTALL
IMPORT
SIG · DATASET-TRANSPILER
D
dataset-transpiler
web-frameworkjavascriptv0.1.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.

transpile
import { transpile } from 'dataset-transpiler'
const datasetTranspiler = require('dataset-transpiler')
Package ships ESM module; CommonJS require will fail in Node or bundlers without ESM interop.
default
import transpile from 'dataset-transpiler'
import { transpile } from 'dataset-transpiler'
Default export is the main transpile function; named export was removed in early documentation.
runtimePrefix
transpile('element.dataset.foo', { runtimePrefix: 'myApp' })
transpile('element.dataset.foo', { runtimePrefix: 'myapp' })
runtimePrefix option is case-sensitive; incorrect casing was a common bug in 0.1.1.

Transpiles .dataset.X assignments and reads into setAttribute/getAttribute calls.

import transpile from 'dataset-transpiler'; const input = `element.dataset.foo = 'bar'; const x = element.dataset.baz;`; const output = transpile(input); console.log(output); // Output: // element.setAttribute('data-foo', 'bar'); // const x = element.getAttribute('data-baz');
Debug
Known issues
breakingNested .dataset calls are not transpiled (e.g. element.dataset.foo.bar)
fix
Manually rewrite nested accesses or avoid using them.
affects: <=0.1.2
deprecatedPackage is unmaintained since 2015; modern browsers support HTMLElement.dataset natively.
fix
Remove dependency and use element.dataset directly for modern browsers (IE11+).
affects: all
gotcharuntimePrefix option fixed in 0.1.1 but still case-sensitive; wrong casing silently produces incorrect output.
fix
Ensure runtimePrefix matches exactly (camelCase).
affects: 0.1.0 - 0.1.2
Errors
Common errors & fixes
Cannot find module 'dataset-transpiler'
Package uses ES module format; CommonJS require fails.
fix
Use ES import syntax: import x from 'dataset-transpiler'
TypeError: transpile is not a function
Attempted to use a named export that does not exist.
fix
Use default import: import transpile from 'dataset-transpiler'
ReferenceError: element is not defined
The transpiler does not validate inputs; expects valid JS string.
fix
Ensure input is a string containing valid JavaScript with .dataset usage.
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
4
Bingbot
1
Resources
dataset-transpiler — npm install dataset-transpiler · libregistry