Registry / devops / es6-shorthands

es6-shorthands

JSON →
library0.0.2jsnpmunverified

A tiny transpiler (v0.0.2) that converts ES6 shorthand method syntax in object literals (e.g., `{a, b() {}}`) to ES5 equivalents (`{a: a, b: function b() {}}`). It is a simple, single-purpose tool that performs a string-based transformation, not a full-featured compiler like Babel. Published as a proof-of-concept, it has not seen updates since initial release and is in maintenance mode. Useful only for legacy build pipelines that need a minimal ES6 shorthand transformation without a larger toolchain. Not suitable for production use.

npm install es6-shorthands
INSTALL
IMPORT
SIG · ES6-SHORTHANDS
E
es6-shorthands
devopsjavascriptv0.0.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.

default export (function)
import shorthand from 'es6-shorthands'
const { shorthand } = require('es6-shorthands')
The package exports a single function. CommonJS users should use `const shorthand = require('es6-shorthands').default` for ESM compatibility, but the module itself is CJS.
TypeScript type import
import type { ShorthandOptions } from 'es6-shorthands'
import { type ShorthandOptions } from 'es6-shorthands'
TypeScript type import syntax (verb before type) is incorrect; use `import type`.
require in ESM context
import shorthand from 'es6-shorthands'
const shorthand = require('es6-shorthands')
In ESM modules, `require` is not available; use `import`.

Demonstrates transforming ES6 shorthand method syntax to ES5 compatible code using the default export function.

import shorthand from 'es6-shorthands'; const source = `const obj = { a, b() { return 5; } };`; const result = shorthand(source); console.log(result); // Output: const obj = { a: a, b: function b() { return 5; } };
Debug
Known issues
gotchaString replacement may incorrectly transform strings containing shorthand-like patterns (e.g., JSON or template literals).
fix
Use a proper parser-based tool like Babel for production code.
affects: 0.0.x
deprecatedPackage is effectively unmaintained; last version 0.0.2 from 2015-08-20.
fix
Migrate to Babel or TypeScript for ES6+ transpilation.
affects: >=0.0.0
breakingNo breaking changes documented due to minimal scope and single version.
fix
N/A
affects: 0.0.0
Errors
Common errors & fixes
shorthand is not a function
Importing as `{ shorthand }` instead of default import.
fix
Use `import shorthand from 'es6-shorthands'` or `const shorthand = require('es6-shorthands').default`.
Cannot find module 'es6-shorthands'
Package not installed or not resolved correctly.
fix
Run `npm install es6-shorthands --save-dev` and ensure it's in `node_modules`.
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
es6-shorthands — npm install es6-shorthands · libregistry