{"id":26104,"library":"prettytype","title":"PrettyType","description":"Multi-platform ES5 coding patterns and base super-prototypes for write-once, run-and-test everywhere (AngularJS, RequireJS, Node.js). Version 2.0.0 targets ES5 with no transpiler dependency, supporting Node 0.10.x+, AngularJS 1.x, RequireJS/AMD, and modern browsers. It provides reusable base prototypes, module patterns, and dependency injection for server/browser logic without build steps. Differentiators: native ES5 (no transpiler), supports multiple module systems without browserify, and includes supertype constructors for prototypal inheritance. Release cadence is low (stable, not actively updated).","status":"maintenance","version":"2.0.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/carrascoMDD/prettytype","tags":["javascript","angularjs","requirejs","nodejs","modules","prototypes","superprototypes"],"install":[{"cmd":"npm install prettytype","lang":"bash","label":"npm"},{"cmd":"yarn add prettytype","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettytype","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export in v2. ESM requires bundler; Node CJS works with require('prettytype').","wrong":"const { PrettyType } = require('prettytype')","symbol":"PrettyType","correct":"import PrettyType from 'prettytype'"},{"note":"Named export for base prototype class.","wrong":"const BaseProto = require('prettytype').BaseProto","symbol":"BaseProto","correct":"import { BaseProto } from 'prettytype'"},{"note":"Named export for super-prototype constructor.","wrong":"var SuperProto = require('prettytype').SuperProto","symbol":"SuperProto","correct":"import { SuperProto } from 'prettytype'"}],"quickstart":{"code":"// Example: Using PrettyType to create a multi-platform module\n// Assume prettytype is installed via npm or included in browser\nconst PrettyType = require('prettytype');\n\n// Define a simple prototype using PrettyType patterns\nconst MyApp = PrettyType.extend({\n  constructor: function(config) {\n    this.config = config || {};\n    this.name = this.config.name || 'default';\n  },\n  init: function() {\n    console.log('MyApp initialized with name:', this.name);\n    return this;\n  },\n  greet: function() {\n    return 'Hello from ' + this.name;\n  }\n});\n\n// Create an instance\nconst app = new MyApp({ name: 'test' });\napp.init();\nconsole.log(app.greet());\n\n// Export for multiple platforms (if needed)\nif (typeof define === 'function' && define.amd) {\n  define(function() { return MyApp; });\n} else if (typeof module !== 'undefined' && module.exports) {\n  module.exports = MyApp;\n}","lang":"javascript","description":"Shows basic usage of PrettyType.extend() to create a prototype-based class with constructor, init, and methods, plus multi-platform export pattern."},"warnings":[{"fix":"Use ES5 polyfills (e.g., core-js) if running in modern environments that drop ES5 support.","message":"ES5-only: Polyfills required for ES6+. No Promise, Map, Set, or arrow functions.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"For Angular 2+, wrap PrettyType in Angular services.","message":"AngularJS 1.x support may be deprecated; Angular 2+ not compatible.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Always load via AMD/CommonJS or wrap in IIFE.","message":"Browser global leak if not loaded via AMD or CommonJS; adds to window object.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Update imports: use require('prettytype') instead of require('prettytype').PrettyType.","message":"v2.0.0 changed export structure from v1; named exports replaced default object.","severity":"breaking","affected_versions":">=2.0.0 <3.0.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 prettytype' and ensure node_modules is present.","cause":"Package not installed or path incorrect.","error":"Cannot find module 'prettytype'"},{"fix":"Use 'const PrettyType = require('prettytype')' (no destructuring).","cause":"Importing default export incorrectly in CommonJS.","error":"TypeError: PrettyType.extend is not a function"},{"fix":"Check if define exists before using: if (typeof define === 'function' && define.amd) { ... }","cause":"AMD code running in non-browser env without RequireJS.","error":"ReferenceError: define is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}