demo-functions
v1.0.9
Published
A minimal npm package with two exported functions.
Readme
demo-functions
A minimal npm package that exports two functions for debugging demonstration in React Native applications.
Functions
badFunction(): Always throws an error (perfect for debugging demonstration)goodFunction(): Always returns a good value
🐛 Debugging Support
This package is specifically configured with comprehensive source maps to enable full debugging capabilities in React Native applications:
- ✅ Source Maps: Generated for both JavaScript and TypeScript declaration files
- ✅ Step-Through Debugging: Set breakpoints and step into package functions
- ✅ Error Stack Traces: See original TypeScript line numbers in error messages
- ✅ React Native Compatible: Optimized configuration for React Native debugging
Debugging Setup
- Install the package in your React Native app
- Set breakpoints in your app code where you call the package functions
- Start debugging - you can now step into the package source code!
📦 Installation
npm install demo-functions💻 Usage
Individual Function Imports
import { badFunction, goodFunction } from "demo-functions";
// This will throw an error - perfect for debugging demonstration!
try {
badFunction();
} catch (error) {
console.log("Caught error:", error);
// You can set breakpoints here and step into badFunction()
}
// This returns a good value
const result = goodFunction();
console.log(result); // "good function always returns good value"Default Object Import
import demoFunctions from "demo-functions";
// Access functions through the default export
console.log(demoFunctions.badFunction());
console.log(demoFunctions.goodFunction());TypeScript Support
import { badFunction, goodFunction } from "demo-functions";
// Full TypeScript support with proper type inference
const result: string = goodFunction();🛠️ Development
npm run build # Build the package with source maps
npm publish # Publish to npm (automatically builds first)📋 Package Information
- Version: 1.0.6
- Type: ES Module
- TypeScript: Full support with declaration files
- Source Maps: ✅ Enabled for debugging
- React Native: ✅ Optimized for debugging
🚀 Publishing
To publish this package to npm:
- Run
npm login(if not already logged in) - Run
npm publish
The package will automatically build before publishing, ensuring the latest source maps are included.
📄 License
MIT
