{"id":26674,"library":"yang-parser","title":"yang-parser","description":"A parser for the YANG data modeling language (RFC 7950) written in CoffeeScript using the Comparse functional parsing library. Current stable version 0.2.1 performs lexical analysis and returns a tree of YANG statements without syntactic or semantic validation. The package has not been updated since 2017 and is considered stable but unmaintained. It is primarily for Node.js usage and depends on Comparse.","status":"deprecated","version":"0.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/llhotka/yang-parser-coffee","tags":["javascript","YANG","functional","parser"],"install":[{"cmd":"npm install yang-parser","lang":"bash","label":"npm"},{"cmd":"yarn add yang-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add yang-parser","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"parsing library used internally","package":"comparse","optional":false}],"imports":[{"note":"The package has no default export; use named import.","wrong":"const yangParser = require('yang-parser');","symbol":"parse","correct":"import { parse } from 'yang-parser'"},{"note":"CommonJS require with destructuring is also valid.","symbol":"parse","correct":"const { parse } = require('yang-parser')"},{"note":"Default import is incorrect; the module exports an object with parse.","wrong":"import parse from 'yang-parser'","symbol":"parse","correct":"import { parse } from 'yang-parser'"}],"quickstart":{"code":"import { parse } from 'yang-parser';\n\nconst yangSource = `\nmodule example {\n  namespace \"urn:example:system\";\n  prefix sys;\n  organization \"Example Inc.\";\n  contact \"admin@example.com\";\n  description \"Example module\";\n  revision 2024-01-01 {\n    description \"Initial revision\";\n  }\n  container system {\n    leaf hostname {\n      type string;\n    }\n  }\n}`;\n\ntry {\n  const result = parse(yangSource);\n  console.log(JSON.stringify(result, null, 2));\n} catch (err) {\n  console.error('Parse error:', err.message);\n}","lang":"typescript","description":"Parses a YANG module string and logs the resulting JSON tree."},"warnings":[{"fix":"Consider migrating to a maintained YANG parser such as yang-parser-js or pyang.","message":"Package is unmaintained since 2017; may not support newer YANG RFCs or grammar changes.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Validate output with a separate tool like pyang.","message":"Parser only performs lexical analysis; no syntactic or semantic validation. Invalid YANG may parse without error.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Install with legacy peer deps if using npm v7+.","message":"Depends on Comparse library which may have breaking changes in newer versions; not pinned.","severity":"breaking","affected_versions":">=0.2.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install yang-parser' in your project directory.","cause":"Package not installed or module resolution fails.","error":"Cannot find module 'yang-parser'"},{"fix":"Use 'import { parse } from 'yang-parser'' instead.","cause":"Using default import when named import is required.","error":"TypeError: yangParser is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}