{"id":25253,"library":"es6-shorthands","title":"es6-shorthands","description":"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.","status":"maintenance","version":"0.0.2","language":"javascript","source_language":"en","source_url":"git://github.com/polyfills/es6-shorthands","tags":["javascript","es6","transpiler","shorthands"],"install":[{"cmd":"npm install es6-shorthands","lang":"bash","label":"npm"},{"cmd":"yarn add es6-shorthands","lang":"bash","label":"yarn"},{"cmd":"pnpm add es6-shorthands","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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.","wrong":"const { shorthand } = require('es6-shorthands')","symbol":"default export (function)","correct":"import shorthand from 'es6-shorthands'"},{"note":"TypeScript type import syntax (verb before type) is incorrect; use `import type`.","wrong":"import { type ShorthandOptions } from 'es6-shorthands'","symbol":"TypeScript type import","correct":"import type { ShorthandOptions } from 'es6-shorthands'"},{"note":"In ESM modules, `require` is not available; use `import`.","wrong":"const shorthand = require('es6-shorthands')","symbol":"require in ESM context","correct":"import shorthand from 'es6-shorthands'"}],"quickstart":{"code":"import shorthand from 'es6-shorthands';\n\nconst source = `const obj = { a, b() { return 5; } };`;\nconst result = shorthand(source);\nconsole.log(result);\n// Output: const obj = { a: a, b: function b() { return 5; } };","lang":"javascript","description":"Demonstrates transforming ES6 shorthand method syntax to ES5 compatible code using the default export function."},"warnings":[{"fix":"Use a proper parser-based tool like Babel for production code.","message":"String replacement may incorrectly transform strings containing shorthand-like patterns (e.g., JSON or template literals).","severity":"gotcha","affected_versions":"0.0.x"},{"fix":"Migrate to Babel or TypeScript for ES6+ transpilation.","message":"Package is effectively unmaintained; last version 0.0.2 from 2015-08-20.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"N/A","message":"No breaking changes documented due to minimal scope and single version.","severity":"breaking","affected_versions":"0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `import shorthand from 'es6-shorthands'` or `const shorthand = require('es6-shorthands').default`.","cause":"Importing as `{ shorthand }` instead of default import.","error":"shorthand is not a function"},{"fix":"Run `npm install es6-shorthands --save-dev` and ensure it's in `node_modules`.","cause":"Package not installed or not resolved correctly.","error":"Cannot find module 'es6-shorthands'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}