{"id":13192,"library":"font-family-papandreou","title":"CSS Font Family Parser","description":"The `font-family-papandreou` package provides a lightweight utility for parsing and stringifying CSS `font-family` property values. It converts a CSS font-family string (e.g., `\"Helvetica Neue\", Helvetica, sans-serif`) into an array of individual font names and vice-versa. The package is currently at version `0.2.0-patch2` and has been unmaintained for several years, with its last publish occurring over six years ago and last code commit in 2017. Its simplicity stems from having zero external runtime dependencies, making it a self-contained solution. However, due to its age and lack of active development, it primarily supports CommonJS modules and does not offer native TypeScript declarations or ESM compatibility, which are standard in modern JavaScript ecosystems. While functional for its niche, developers should be aware of its abandoned status and consider more contemporary alternatives for new projects.","status":"abandoned","version":"0.2.0-patch2","language":"javascript","source_language":"en","source_url":"https://github.com/hanamura/font-family","tags":["javascript"],"install":[{"cmd":"npm install font-family-papandreou","lang":"bash","label":"npm"},{"cmd":"yarn add font-family-papandreou","lang":"bash","label":"yarn"},{"cmd":"pnpm add font-family-papandreou","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Despite the npm package name being `font-family-papandreou`, the module is exported internally as `font-family` and strictly uses CommonJS syntax. Direct ESM `import` statements will fail in native ESM environments.","wrong":"import { parse } from 'font-family-papandreou';","symbol":"parse","correct":"const { parse } = require('font-family');"},{"note":"The `stringify` function is a named export from the internal `font-family` CommonJS module. ESM imports are not natively supported.","wrong":"import { stringify } from 'font-family-papandreou';","symbol":"stringify","correct":"const { stringify } = require('font-family');"}],"quickstart":{"code":"const { parse, stringify } = require('font-family');\n\n// Example 1: Parsing a font-family string\nconst fontString = '\"Helvetica Neue\", Helvetica, sans-serif';\nconst parsedFonts = parse(fontString);\nconsole.log('Parsed fonts:', parsedFonts);\n// Expected output: ['Helvetica Neue', 'Helvetica', 'sans-serif']\n\n// Example 2: Stringifying an array of font names\nconst fontArray = ['Arial Black', 'Arial', 'sans-serif'];\nconst stringifiedFonts = stringify(fontArray);\nconsole.log('Stringified fonts:', stringifiedFonts);\n// Expected output: '\"Arial Black\", Arial, sans-serif'","lang":"javascript","description":"Demonstrates how to parse a CSS `font-family` string into an array and stringify an array back into a CSS `font-family` value using CommonJS `require`."},"warnings":[{"fix":"Consider migrating to a more actively maintained library for CSS parsing or implementing custom parsing logic.","message":"This package is effectively abandoned. It has not received updates for over six years, meaning it may contain unpatched bugs or security vulnerabilities and will not receive new features.","severity":"breaking","affected_versions":">=0.2.0-patch2"},{"fix":"Ensure your project or file uses CommonJS `require()` syntax. For ESM projects, you might need to use a bundler that transpiles CJS, or wrap the module in a CJS loader function, or switch to an ESM-compatible alternative.","message":"The package is CommonJS (CJS) only. It does not provide native ECMAScript Modules (ESM) support. Attempting to use `import` syntax in a pure ESM environment will result in errors.","severity":"breaking","affected_versions":">=0.2.0-patch2"},{"fix":"Always use `require('font-family')` to import the module after installing `font-family-papandreou`.","message":"When installing `font-family-papandreou`, the `require` statement must use the module name `font-family` (e.g., `require('font-family')`), not the package name `font-family-papandreou`.","severity":"gotcha","affected_versions":">=0.2.0-patch2"},{"fix":"Create a `font-family.d.ts` file in your project or install `@types/font-family` if it existed (which it doesn't). Alternatively, use `// @ts-ignore` or cast types manually, but prefer migration to a typed library.","message":"This package does not provide TypeScript declaration files (`.d.ts`). Developers using TypeScript will not have type safety or auto-completion without manually creating declaration files.","severity":"gotcha","affected_versions":">=0.2.0-patch2"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"This package is CJS-only. Convert your file to use CJS or migrate to an ESM-compatible parsing library. If you must use it in ESM, ensure your bundler handles CJS interoperability correctly.","cause":"Attempting to use `require()` in an ECMAScript Module (ESM) context.","error":"ReferenceError: require is not defined in ES module scope"},{"fix":"Ensure you are using `const { parse, stringify } = require('font-family');` after installing `font-family-papandreou`. Do not use `require('font-family-papandreou')` or ESM `import`.","cause":"Incorrect module name in `require()` or `import` statement, or attempting to import a CJS module in an ESM context.","error":"TypeError: Cannot read properties of undefined (reading 'parse') (or similar for 'stringify')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}