Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import pzz from 'pzz-rest'
✗ const pzz = require('pzz-rest')
UMD library with TypeScript types; default import recommended. CommonJS require yields 'any' type.
get
✓ import { get } from 'pzz-rest'
✗ import { get } from 'pzz-rest' (correct usage)
Named export for HTTP GET requests. Requires destructured import.
post
✓ import { post } from 'pzz-rest'
✗ import post from 'pzz-rest'
Named export, not default. Do not use default import for post.
put
✓ import { put } from 'pzz-rest'
Named export for HTTP PUT requests.
del
✓ import { del } from 'pzz-rest'
✗ import { delete } from 'pzz-rest'
'delete' is a reserved word; library uses 'del'. Importing 'delete' will cause a syntax error.
Shows basic HTTP GET and POST requests using both default and named imports, including TypeScript generics.
import pzz from 'pzz-rest';
// Simple GET request
pzz.get('https://api.example.com/data')
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Request failed:', error);
});
// POST request with body
pzz.post('https://api.example.com/submit', { key: 'value' })
.then(response => {
console.log('Success:', response.data);
});
// Using named imports
import { get, post } from 'pzz-rest';
get('https://api.example.com/items')
.then(res => console.log(res.data));
// TypeScript usage with type assertion
interface Data { id: number; name: string; }
pzz.get<Data>('/endpoint').then(res => res.data.name);
Debug
Known issues
gotchaThe library is a UMD bundle; using with Node.js might require browser polyfills for fetch or XMLHttpRequest.fixOn Node.js, use a fetch polyfill like 'node-fetch' or run in browser environment.
affects: >=1.0.0
gotchaThe 'del' function is an alias for DELETE requests; do not attempt to import 'delete'.fixUse 'del' as named import. See imports section.
affects: >=1.0.0
deprecatedNo API deprecations documented in this version.
breakingNo breaking changes in version 1.0.0 (initial release).
Errors
Common errors & fixes
TypeError: pzz.get is not a function
Default import used incorrectly; 'pzz' is the default export but 'get' is a method on it, not a direct function.
fixUse pzz.get(...) or import { get } from 'pzz-rest'. SyntaxError: Unexpected token 'delete'
Attempted to import reserved word 'delete' as named export.
fixUse 'del' instead: import { del } from 'pzz-rest'. Cannot find module 'pzz-rest' or its corresponding type declarations.
Package not installed or TypeScript strict mode with missing type declarations.
fixEnsure package is installed: npm install pzz-rest. If types are not found, check that 'types' field in package.json or @types/pzz-rest exists.
Audit
Dependencies
No dependency data recorded yet.