diff --git a/README.md b/README.md index eceacdc..a27a25e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# πŸ“± tsndef +# tsndef β€” Type-safe TypeScript NDEF (NFC) library [![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href] @@ -7,6 +7,10 @@ A modern, type-safe TypeScript library for creating and parsing NDEF (NFC Data Exchange Format) messages with full compile-time type checking and intelligent autocompletion. +- βœ… Type-safe records (URI, JSON, text, media…) +- πŸš€ Zero deps, tree-shakable ESM +- πŸ§ͺ Well-tested parsing/serialization with robust errors + ## ✨ Features - **πŸ”’ Type-Safe**: Full TypeScript support with compile-time type checking @@ -251,6 +255,29 @@ Maintaining precise type information allows you to: - Leverage TypeScript's powerful type system for safer NFC operations - Ensure your code is more maintainable and less prone to runtime errors +## ❓ FAQ + +### Which record types are supported? + +tsndef supports the most common NDEF record types: +- **Well-Known**: URI records with automatic prefix optimization +- **Media**: JSON, plain text, HTML, images (PNG/JPEG), video (MP4), audio (MPEG) + +All record types include full TypeScript type definitions for compile-time safety. + +### Is it safe to parse unknown records? + +Yes! Use `safeParseNDEFMessage()` for error-safe parsing that won't throw exceptions. Unknown record types are preserved with their raw payload accessible via `rawPayload()`, so you never lose data. + +### How is this different from other NDEF libraries? + +tsndef is the only NDEF library that provides: +- **Full compile-time type safety** with TypeScript +- **Intelligent type inference** that tracks exact record types +- **Zero dependencies** and tree-shakable architecture +- **Modern ES modules** with immutable-style API +- **Comprehensive error handling** with both throwing and safe parsing options + ## πŸ§ͺ Testing ```bash diff --git a/package.json b/package.json index 59cddd2..77739dd 100644 --- a/package.json +++ b/package.json @@ -18,13 +18,19 @@ "nfc", "ndef", "typescript", + "javascript", + "encoder", + "decoder", + "parser", + "uri-record", + "json", "type-safe", "nfc-data-exchange-format", "near-field-communication", "mobile", "android", "ios", - "web-nfc" + "browser" ], "exports": { ".": "./dist/index.js",