{"id":13195,"library":"format-parser","title":"Declarative Format Parser","description":"format-parser is a JavaScript utility designed for parsing declarative format strings, primarily intended for use with template engines. It allows for the definition of data transformations and formatting within a string, such as `created_at | date:\"%Y %M %d\"`. The package's current and only version, `0.0.2`, was last published in December 2012. It emerged from the now-obsolete `component(1)` build ecosystem, a client-side package manager that predates modern npm and browser module bundlers. Due to its age and lack of updates, it is considered abandoned. This makes it unsuitable for modern development, as it lacks support for ES Modules, TypeScript, and has not received security patches or performance improvements in over a decade. Modern alternatives provide more robust, actively maintained, and feature-rich parsing capabilities for various data formats.","status":"abandoned","version":"0.0.2","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","format","parser","component"],"install":[{"cmd":"npm install format-parser","lang":"bash","label":"npm"},{"cmd":"yarn add format-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add format-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS-only and does not support ES Modules. It was developed for the `component(1)` ecosystem, which predates widespread ESM adoption.","wrong":"import parse from 'format-parser';\nimport { parse } from 'format-parser';","symbol":"parse","correct":"const parse = require('format-parser');"}],"quickstart":{"code":"const parse = require('format-parser');\n\nconsole.log('Parsing \"created_at | date:\\\"%Y %M %d\\\"\":');\ntry {\n  const result1 = parse('created_at | date:\"%Y %M %d\"');\n  console.log('Result 1 (AST-like structure):', JSON.stringify(result1, null, 2));\n\n  console.log('\\nParsing \"item.price | currency:\\\"USD\\\"\":');\n  const result2 = parse('item.price | currency:\"USD\"');\n  console.log('Result 2 (AST-like structure):', JSON.stringify(result2, null, 2));\n\n  console.log('\\nParsing a more complex string: \"user.name | uppercase | truncate:10\"');\n  const result3 = parse('user.name | uppercase | truncate:10');\n  console.log('Result 3 (AST-like structure):', JSON.stringify(result3, null, 2));\n\n  // Demonstrate an invalid format to observe error handling (if any)\n  console.log('\\nAttempting to parse an invalid string: \"bad_format | missing_arg:\"');\n  try {\n    const result4 = parse('bad_format | missing_arg:'); \n    console.log('Result 4 (might be incomplete/erroneous AST):', JSON.stringify(result4, null, 2));\n  } catch (e) {\n    console.error('Error parsing invalid string (expected for bad syntax):', e.message);\n  }\n\n} catch (e) {\n  console.error('An unexpected runtime error occurred:', e.message);\n  console.error('This package is very old; ensure compatibility with your Node.js version and environment.');\n}","lang":"javascript","description":"Demonstrates how to import and use the `parse` function to process various declarative format strings, showing the resulting AST-like structure and potential error handling."},"warnings":[{"fix":"Do not use in new projects. For existing usage, migrate to a modern, actively maintained parsing library or implement custom parsing logic that fits current JavaScript standards and practices.","message":"The `format-parser` package is abandoned and has not been maintained for over a decade. It will not receive bug fixes, performance improvements, or security updates.","severity":"breaking","affected_versions":">=0.0.2"},{"fix":"Direct npm installation might function in some CommonJS environments, but integration with modern bundlers may be challenging and require specific, non-standard configurations. It is strongly recommended to use alternatives designed for the contemporary JavaScript ecosystem.","message":"This package relies on the obsolete `component(1)` build ecosystem. While it is available on npm, its architecture is not designed for modern JavaScript build tools (e.g., Webpack, Rollup, Vite) or module resolution.","severity":"gotcha","affected_versions":">=0.0.2"},{"fix":"Only `require()` syntax is supported. If attempting to use in an ESM project, a CJS wrapper or dynamic `import()` might be technically possible but is not recommended due to the package's overall abandonment and potential for further compatibility issues.","message":"The package is CommonJS-only and lacks native support for ES Modules (ESM).","severity":"gotcha","affected_versions":">=0.0.2"},{"fix":"For TypeScript projects, manual type declarations would be required, adding overhead. Considering the package's abandoned status, investing time in type definitions is not advisable; prefer a type-safe modern alternative.","message":"No TypeScript type definitions (`.d.ts` files) are provided for this package.","severity":"gotcha","affected_versions":">=0.0.2"},{"fix":"Using this package in production environments introduces significant security risks. Conduct a thorough security audit if absolutely necessary, but prioritize migrating to a well-maintained and audited solution.","message":"As an unmaintained library, `format-parser` is susceptible to undiscovered security vulnerabilities, including supply chain risks, which will not be addressed.","severity":"gotcha","affected_versions":">=0.0.2"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure you are using CommonJS `require()` syntax: `const parse = require('format-parser');`","cause":"Attempting to use ES Module `import` syntax (`import parse from 'format-parser';` or `import { parse } from 'format-parser';`) with this CommonJS-only package.","error":"TypeError: parse is not a function"},{"fix":"Verify that your bundler (e.g., Webpack, Rollup, Parcel) is correctly configured to process and include CommonJS modules from `node_modules`. If the issue persists, the fundamental incompatibility with modern toolchains suggests migrating to a different solution.","cause":"Module resolution failure in a modern environment or bundler that expects ES Modules or has specific configurations for handling CommonJS modules. This can be exacerbated by the package's age and its origins in the `component(1)` ecosystem.","error":"Error: Cannot find module 'format-parser'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}