{"id":22878025,"url":"https://github.com/xnodeoncode/i45-sample-data","last_synced_at":"2026-02-25T21:05:40.192Z","repository":{"id":267123606,"uuid":"899671763","full_name":"xnodeoncode/i45-sample-data","owner":"xnodeoncode","description":"Sample datasets for testing and development","archived":false,"fork":false,"pushed_at":"2025-12-20T15:44:39.000Z","size":753,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-22T04:53:48.527Z","etag":null,"topics":["datasets","development","development-data","javascript","json","npm","npm-package","sample-data","test-data"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xnodeoncode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-06T18:57:07.000Z","updated_at":"2025-12-20T15:44:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"313b8047-5684-4884-8e1b-18e0dd034a7a","html_url":"https://github.com/xnodeoncode/i45-sample-data","commit_stats":null,"previous_names":["xnodeoncode/i45-sample-data"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/xnodeoncode/i45-sample-data","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnodeoncode%2Fi45-sample-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnodeoncode%2Fi45-sample-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnodeoncode%2Fi45-sample-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnodeoncode%2Fi45-sample-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xnodeoncode","download_url":"https://codeload.github.com/xnodeoncode/i45-sample-data/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnodeoncode%2Fi45-sample-data/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29839980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T20:42:33.054Z","status":"ssl_error","status_checked_at":"2026-02-25T20:42:21.322Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datasets","development","development-data","javascript","json","npm","npm-package","sample-data","test-data"],"created_at":"2024-12-13T16:17:37.766Z","updated_at":"2026-02-25T21:05:40.185Z","avatar_url":"https://github.com/xnodeoncode.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# i45 Sample Data\n\n[Node JS Package](https://www.npmjs.com/package/i45-sample-data)\n\nA library of sample datasets that can be used during testing and development. Fully typed with TypeScript definitions included.\n\n## Installation\n\n```bash\nnpm i i45-sample-data --save-dev\n```\n\n## Features\n\n- ✅ **Fully TypeScript supported** with comprehensive type definitions\n- ✅ **ES Modules** (ESM) support\n- ✅ **Tree-shakeable** exports with individual imports\n- ✅ **Zero dependencies** for production\n- ✅ **18+ dataset types** with proper interfaces\n- ✅ **Optimized bundle size** - import only what you need\n\n## Bundle Size\n\nThe package is optimized for tree-shaking to minimize your production bundle:\n\n```javascript\n// ⚠️ Full import - bundles all datasets (~40-50KB minified)\nimport { SampleData } from \"i45-sample-data\";\n\n// ✅ Tree-shakeable - only bundles what you use (~2-10KB each)\nimport { Books } from \"i45-sample-data/collections\";\nimport { Astronomy } from \"i45-sample-data/lists\";\nimport { DataHelpers } from \"i45-sample-data/helpers\";\n```\n\n**Tips for minimal bundle size:**\n\n- Use individual imports (`/collections`, `/lists`, etc.) instead of the main entry point\n- Only import the datasets you actually use\n- Helper methods add ~2KB when imported\n\n**Package marked with `sideEffects: false`** for optimal tree-shaking with modern bundlers (webpack, Rollup, Vite, esbuild).\n\n## Usage\n\n### Standard Import (Full Library)\n\n```javascript\nimport { SampleData } from \"i45-sample-data\";\n\n// Lists - Simple string arrays\nconsole.log(\"Astronomy\", SampleData.Lists.Astronomy);\nconsole.log(\"States\", SampleData.Lists.States);\n\n// Dictionaries - Key-value pairs\nconsole.log(\"States\", SampleData.Dictionaries.States);\nconsole.log(\"Countries\", SampleData.Dictionaries.Countries);\n\n// Collections - Arrays of objects\nconsole.log(\"Books\", SampleData.Collections.Books);\nconsole.log(\"Students\", SampleData.Collections.Students);\nconsole.log(\"Countries\", SampleData.Collections.Countries);\nconsole.log(\"TriviaQuestions\", SampleData.Collections.TriviaQuestions);\nconsole.log(\"Albums\", SampleData.Collections.Albums);\nconsole.log(\"Songs\", SampleData.Collections.Songs);\nconsole.log(\"Players\", SampleData.Collections.Players);\nconsole.log(\"Recipes\", SampleData.Collections.Recipes);\nconsole.log(\"States\", SampleData.Collections.States);\nconsole.log(\"DailyWeather\", SampleData.Collections.DailyWeather);\n\n// Objects - Structured data\nconsole.log(\"KeyCodes\", SampleData.Objects.KeyCodes);\nconsole.log(\"States\", SampleData.Objects.States);\nconsole.log(\"Movies\", SampleData.Objects.Movies);\n```\n\n### Tree-Shakeable Imports (Optimized Bundle Size)\n\nImport only the datasets you need to minimize your bundle size:\n\n```javascript\n// Import specific collections\nimport { Books, TriviaQuestions, Students } from \"i45-sample-data/collections\";\n\n// Import specific lists\nimport { Astronomy, States } from \"i45-sample-data/lists\";\n\n// Import specific dictionaries\nimport { Countries } from \"i45-sample-data/dictionaries\";\n\n// Import specific objects\nimport { KeyCodes, Movies } from \"i45-sample-data/objects\";\n\nconsole.log(\"Books:\", Books);\nconsole.log(\"Astronomy:\", Astronomy);\n```\n\n### TypeScript with Tree-Shaking\n\n```typescript\nimport { Books, type Book } from \"i45-sample-data/collections\";\nimport { Astronomy } from \"i45-sample-data/lists\";\n\n// Type-safe access with minimal bundle size\nconst books: Book[] = Books;\nconst astronomyTerms: string[] = Astronomy;\n\nconsole.log(books[0].title);\n```\n\n### TypeScript (Standard Import)\n\n```javascript\nimport { SampleData } from \"i45-sample-data\";\n\n// Lists - Simple string arrays\nconsole.log(\"Astronomy\", SampleData.Lists.Astronomy);\nconsole.log(\"States\", SampleData.Lists.States);\n\n// Dictionaries - Key-value pairs\nconsole.log(\"States\", SampleData.Dictionaries.States);\nconsole.log(\"Countries\", SampleData.Dictionaries.Countries);\n\n// Collections - Arrays of objects\nconsole.log(\"Books\", SampleData.Collections.Books);\nconsole.log(\"Students\", SampleData.Collections.Students);\nconsole.log(\"Countries\", SampleData.Collections.Countries);\nconsole.log(\"TriviaQuestions\", SampleData.Collections.TriviaQuestions);\nconsole.log(\"Albums\", SampleData.Collections.Albums);\nconsole.log(\"Songs\", SampleData.Collections.Songs);\nconsole.log(\"Players\", SampleData.Collections.Players);\nconsole.log(\"Recipes\", SampleData.Collections.Recipes);\nconsole.log(\"States\", SampleData.Collections.States);\nconsole.log(\"DailyWeather\", SampleData.Collections.DailyWeather);\n\n// Objects - Structured data\nconsole.log(\"KeyCodes\", SampleData.Objects.KeyCodes);\nconsole.log(\"States\", SampleData.Objects.States);\nconsole.log(\"Movies\", SampleData.Objects.Movies);\n```\n\n### TypeScript\n\n```typescript\nimport {\n  SampleData,\n  type Book,\n  type TriviaQuestion,\n  type Student,\n} from \"i45-sample-data\";\n\n// Type-safe access to data\nconst books: Book[] = SampleData.Collections.Books;\nconst firstBook: Book = books[0];\n\n// Intellisense works perfectly\nconsole.log(firstBook.title, firstBook.author, firstBook.isbn);\n\n// Type-safe function parameters\nfunction displayQuestion(question: TriviaQuestion): void {\n  console.log(`${question.category}: ${question.question}`);\n  console.log(`Difficulty: ${question.difficulty}`);\n}\n\n// Generic fetch with type parameter\ntype ApiResponse = { data: Student[] };\nconst result = await SampleData.fetch\u003cApiResponse\u003e(\n  \"https://api.example.com/students\"\n);\n```\n\n## Helper Methods\n\n### SampleData Helper Methods\n\nConvenience methods for working with sample data:\n\n```typescript\nimport { SampleData } from \"i45-sample-data\";\n\n// Get a random book\nconst randomBook = SampleData.random(SampleData.Collections.Books);\n\n// Get 3 random trivia questions\nconst questions = SampleData.randomMultiple(\n  SampleData.Collections.TriviaQuestions,\n  3\n);\n\n// Shuffle the states list\nconst shuffledStates = SampleData.shuffle(SampleData.Lists.States);\n```\n\n### DataHelpers for Advanced Manipulation\n\nImport `DataHelpers` for advanced data manipulation utilities:\n\n```typescript\nimport { TriviaQuestions, Books } from \"i45-sample-data/collections\";\nimport { DataHelpers } from \"i45-sample-data/helpers\";\n\n// Filter by difficulty\nconst easyQuestions = DataHelpers.filterBy(\n  TriviaQuestions,\n  \"difficulty\",\n  \"easy\"\n);\n\n// Filter with custom function\nconst intermediateQuestions = DataHelpers.filterWhere(\n  TriviaQuestions,\n  (i) =\u003e i.difficulty == \"easy\" || i.difficulty == \"medium\"\n);\n\n// Filter where property values are between a min and max value.\nconst longBooks = DataHelpers.range(Books, \"pages\", 300, 400);\n\n// Search across multiple fields\nconst science = DataHelpers.search(TriviaQuestions, \"science\", [\n  \"category\",\n  \"question\",\n]);\n\n// Group by difficulty\nconst grouped = DataHelpers.groupBy(TriviaQuestions, \"difficulty\");\n// { easy: [...], medium: [...], hard: [...] }\n\n// Paginate results\nconst page1 = DataHelpers.paginate(TriviaQuestions, 1, 5);\n// { data: [...5 items], page: 1, total: 10, hasNext: true, ... }\n\n// Sort by property\nconst sorted = DataHelpers.sortBy(TriviaQuestions, \"difficulty\", \"asc\");\n\n// Get unique values\nconst difficulties = DataHelpers.unique(TriviaQuestions, \"difficulty\");\n\n// Extract specific fields\nconst simplified = DataHelpers.pluck(TriviaQuestions, \"question\", \"difficulty\");\n```\n\n**Available DataHelper methods:**\n\n- `filterBy()` - Filter by property value\n- `search()` - Search across string fields\n- `filterWhere()` - Filter with custom function\n- `range()` - Filter by property value within min and max\n- `groupBy()` - Group by property\n- `countBy()` - Count occurrences\n- `sortBy()` - Sort by property\n- `paginate()` - Paginate with metadata\n- `unique()` - Get unique values\n- `pluck()` - Extract properties\n\n## Available Types\n\nAll TypeScript interfaces are exported for use in your projects:\n\n- `Book` - ISBN, title, author, publisher details\n- `TriviaQuestion` - Trivia questions with difficulty and category\n- `Album` - Music album information\n- `Song` - Song metadata with audio features\n- `Player` - Soccer player data\n- `Recipe` - Cooking recipes with ingredients and instructions\n- `Student` - Student records with grades\n- `State` - US state information\n- `Country` - Country data with currency and language\n- `DailyWeather` - Weather forecast data\n- `KeyCodes` - Keyboard key code mappings\n- `Movie` - Movie metadata\n- And more...\n\n## Sample Output\n\n```javascript\nconsole.log(SampleData.Collections.TriviaQuestions);\n\n// output\n[\n  {\n    type: \"multiple\",\n    difficulty: \"easy\",\n    category: \"Science \u0026amp; Nature\",\n    question:\n      \"The element involved in making human blood red is which of the following?\",\n    correct_answer: \"Iron\",\n    incorrect_answers: [\"Copper\", \"Iridium\", \"Gold\"],\n  },\n  {\n    type: \"multiple\",\n    difficulty: \"easy\",\n    category: \"Entertainment: Video Games\",\n    question:\n      \"How many flagship monsters appear in Monster Hunter Gernerations?\",\n    correct_answer: \"4\",\n    incorrect_answers: [\"3\", \"5\", \"6\"],\n  },\n  {\n    type: \"multiple\",\n    difficulty: \"hard\",\n    category: \"Entertainment: Video Games\",\n    question:\n      \"'Gimmick!' is a Japanese Famicom game in the cartridge. What is it called?\",\n    correct_answer: \"FME-7\",\n    incorrect_answers: [\"VRC6\", \"VRC7\", \"MMC5\"],\n  },\n  {\n    type: \"boolean\",\n    difficulty: \"medium\",\n    category: \"Animals\",\n    question: \"Finnish Lapphund dogs were used for herding reindeer.\",\n    correct_answer: \"True\",\n    incorrect_answers: [\"False\"],\n  },\n];\n```\n\n## Using in React Component (App.tsx)\n\n```typescript\nimport \"./App.css\";\nimport { SampleData, type TriviaQuestion } from \"i45-sample-data\";\n\nfunction App() {\n  const questions: TriviaQuestion[] = SampleData.Collections.TriviaQuestions;\n\n  return (\n    \u003c\u003e\n      \u003cdiv\u003e\n        {questions.map((question, index) =\u003e (\n          \u003cdiv id={`q-${index}`} key={index} className=\"question-div\"\u003e\n            \u003ch3\u003e{question.question}\u003c/h3\u003e\n            \u003cp\u003eCategory: {question.category}\u003c/p\u003e\n            \u003cp\u003eDifficulty: {question.difficulty}\u003c/p\u003e\n            \u003cp\u003eType: {question.type}\u003c/p\u003e\n            \u003cp\u003eCorrect Answer: {question.correct_answer}\u003c/p\u003e\n            \u003cp\u003eIncorrect Answers: {question.incorrect_answers.join(\", \")}\u003c/p\u003e\n          \u003c/div\u003e\n        ))}\n      \u003c/div\u003e\n    \u003c/\u003e\n  );\n}\n\nexport default App;\n```\n\n## Simple API Call\n\nThe **from** method makes a get request using the [fetch api](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch) and returns the results in JSON format.\n\nThe `apiKey` parameter is optional - only provide it if your API requires authentication.\n\n**Signature:** `SampleData.from(uri: string, apiKey?: string): Promise\u003cany\u003e`\n\nNOTE: This method makes an HTTP Get request and, if an API key is provided, passes it in the `x-api-key` request header. To make an HTTP Post request, or to include other headers such as custom content types, see the section [API Call with Custom Headers](#api-call-with-custom-headers).\n\n```javascript\nimport { SampleData } from \"i45-sample-data\";\n\n// Make an async API call to a public endpoint (no API key needed)\nconst data = await SampleData.from(\n  \"https://jsonplaceholder.typicode.com/posts\"\n);\nconsole.log(data);\n\n// Or with an API key for authenticated endpoints\nconst protectedData = await SampleData.from(\n  \"https://api.example.com/protected\",\n  \"YOUR_API_KEY\"\n);\nconsole.log(protectedData);\n```\n\n## API Call with Custom Headers\n\noptions object, and returns a typed [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response).\n\nSee the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch) MDN Web Docs for more information.\n\n```typescript\nimport { SampleData } from \"i45-sample-data\";\n\n// With TypeScript, you can specify the response type\ntype Post = { id: number; title: string; body: string; userId: number };\n\nconst data = await SampleData.fetch\u003cPost[]\u003e(\n  \"https://jsonplaceholder.typicode.com/posts\",\n  {\n    headers: {\n      \"Content-Type\": \"application/json\",\n      \"x-api-key\": \"YOUR_API_KEY\",\n    },\n  }\n);\n\n// data is now typed as Post[]\nconsole.log(\"Data from API\", data);\n```\n\n## Backward Compatibility\n\nThe following deprecated properties are still available but not recommended:\n\n```javascript\n// ⚠️ Deprecated - Use Collections instead\nSampleData.JsonData.Books;\n\n// ⚠️ Deprecated - Use Dictionaries instead\nSampleData.KeyValueLists.States;\n\n// ✅ Recommended\nSampleData.Collections.Books;\nSampleData.Dictionaries.States;\n```\n\n## License\n\nISC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxnodeoncode%2Fi45-sample-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxnodeoncode%2Fi45-sample-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxnodeoncode%2Fi45-sample-data/lists"}