{"id":21151649,"url":"https://github.com/ashirbadgudu/js-core","last_synced_at":"2026-02-08T09:04:32.170Z","repository":{"id":57099196,"uuid":"414674466","full_name":"AshirbadGudu/js-core","owner":"AshirbadGudu","description":"@ashirbad/js-core","archived":false,"fork":false,"pushed_at":"2025-02-08T10:36:51.000Z","size":125,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-08T20:54:18.892Z","etag":null,"topics":["format-currency","hacktoberfest2022","helper-functions","js-core","npm","object-to-array","utility-library"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@ashirbad/js-core","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/AshirbadGudu.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}},"created_at":"2021-10-07T16:19:43.000Z","updated_at":"2025-02-08T10:36:57.000Z","dependencies_parsed_at":"2025-05-07T03:42:58.172Z","dependency_job_id":null,"html_url":"https://github.com/AshirbadGudu/js-core","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AshirbadGudu/js-core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshirbadGudu%2Fjs-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshirbadGudu%2Fjs-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshirbadGudu%2Fjs-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshirbadGudu%2Fjs-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AshirbadGudu","download_url":"https://codeload.github.com/AshirbadGudu/js-core/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshirbadGudu%2Fjs-core/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263351226,"owners_count":23453433,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["format-currency","hacktoberfest2022","helper-functions","js-core","npm","object-to-array","utility-library"],"created_at":"2024-11-20T10:18:05.596Z","updated_at":"2026-02-08T09:04:32.128Z","avatar_url":"https://github.com/AshirbadGudu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @ashirbad/js-core\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003e\n    \u003ccode\u003e@ashirbad/js-core\u003c/code\u003e\n  \u003c/h1\u003e\n\n  \u003cdiv\u003eA lightweight, type-safe JavaScript utility library with zero dependencies.\u003c/div\u003e\n\n  \u003cbr /\u003e\n\n  \u003c!-- Badges --\u003e\n\n[![Open Source? Yes!](https://badgen.net/badge/Open%20Source%20%3F/Yes%21/blue?icon=github)](https://github.com/AshirbadGudu/js-core/issues)\n[![Maintained](https://badgen.net/badge/Maintained%20%3F/Yes%21/blue?icon=github)](https://github.com/AshirbadGudu/js-core/issues)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/@ashirbad/js-core)\n![npm](https://img.shields.io/npm/v/@ashirbad/js-core)\n![Downloads](https://img.shields.io/npm/dt/@ashirbad/js-core)\n![Test Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)\n![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue)\n\n  \u003cbr /\u003e\n\n  \u003cpre\u003enpm i \u003ca href=\"https://www.npmjs.com/package/@ashirbad/js-core\"\u003e@ashirbad/js-core\u003c/a\u003e\u003c/pre\u003e\n\n  \u003cbr /\u003e\n\u003c/div\u003e\n\n## Features\n\n- 🚀 **Zero Dependencies** - Lightweight and efficient\n- 💪 **Type Safe** - Written in TypeScript with full type definitions\n- 🔥 **Firebase Ready** - Built-in Firebase utilities\n- 💰 **Currency Formatting** - Support for 160+ currencies\n- 📅 **Date Utilities** - Comprehensive date manipulation tools\n- ✨ **Modern** - ES6+ ready\n- 🧪 **Well Tested** - 100% test coverage\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [API Reference](#api-reference)\n  - [Array Utilities](#array-utilities)\n  - [Currency Utilities](#currency-utilities)\n  - [Date Utilities](#date-utilities)\n- [Examples](#examples)\n- [TypeScript Support](#typescript-support)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Installation\n\n### npm\n\n```bash\nnpm install @ashirbad/js-core\n```\n\n### yarn\n\n```bash\nyarn add @ashirbad/js-core\n```\n\n### pnpm\n\n```bash\npnpm add @ashirbad/js-core\n```\n\n## Usage\n\nImport the functions you need:\n\n```typescript\nimport { formatCurrency, getDatesBetween } from '@ashirbad/js-core';\n```\n\n## API Reference\n\n### Array Utilities\n\n#### `getArrFromObj(object: Record\u003cstring, any\u003e, key?: string): Array\u003cany\u003e`\n\nConverts an object to an array with customizable ID field.\n\n```typescript\nconst obj = { '1': { name: 'John' }, '2': { name: 'Jane' } };\nconst arr = getArrFromObj(obj); // [{ id: \"1\", name: \"John\" }, { id: \"2\", name: \"Jane\" }]\n```\n\n#### `getArrFromSnap(snapshot: FirebaseSnapshot, key?: string): Array\u003cany\u003e`\n\nConverts a Firebase snapshot to an array.\n\n```typescript\nconst arr = getArrFromSnap(snapshot); // [{ id: \"doc1\", ...data }]\n```\n\n#### `getArrFromNestedSnap(snapshot: FirebaseSnapshot, primaryKey?: string, secondaryKey?: string): Array\u003cany\u003e`\n\nFlattens a nested Firebase snapshot into a single array. Useful for handling nested collections in Firebase.\n\n```typescript\n// Example Firebase nested data\nconst snapshot = {\n  val: () =\u003e ({\n    store1: {\n      order1: { product: 'A', quantity: 1 },\n      order2: { product: 'B', quantity: 2 },\n    },\n    store2: {\n      order3: { product: 'C', quantity: 3 },\n    },\n  }),\n  exists: () =\u003e true,\n};\n\n// Default keys\nconst result1 = getArrFromNestedSnap(snapshot);\n/* Output:\n[\n  { id: 'order1', _id: 'store1', product: 'A', quantity: 1 },\n  { id: 'order2', _id: 'store1', product: 'B', quantity: 2 },\n  { id: 'order3', _id: 'store2', product: 'C', quantity: 3 }\n]\n*/\n\n// Custom keys\nconst result2 = getArrFromNestedSnap(snapshot, 'orderId', 'storeId');\n/* Output:\n[\n  { orderId: 'order1', storeId: 'store1', product: 'A', quantity: 1 },\n  { orderId: 'order2', storeId: 'store1', product: 'B', quantity: 2 },\n  { orderId: 'order3', storeId: 'store2', product: 'C', quantity: 3 }\n]\n*/\n```\n\n### Currency Utilities\n\n#### `formatCurrency(amount: number, currency?: currency): string`\n\nFormats a number as currency with proper localization.\n\n```typescript\nformatCurrency(1000); // \"₹1,000.00\"\nformatCurrency(1000, 'USD'); // \"$1,000.00\"\nformatCurrency(1000, 'EUR'); // \"€1,000.00\"\n```\n\nSupports 160+ currencies including:\n\n- USD (US Dollar)\n- EUR (Euro)\n- GBP (British Pound)\n- JPY (Japanese Yen)\n- And many more...\n\n### Date Utilities\n\n#### `getFutureDays(numberOfDays?: number): Date[]`\n\nReturns an array of future dates.\n\n```typescript\ngetFutureDays(3); // Next 3 days as Date objects\n```\n\n#### `getDayName(dayIndex?: number): string`\n\nGets the name of a day by index (0-6).\n\n```typescript\ngetDayName(1); // \"Monday\"\ngetDayName(); // Current day name\n```\n\n#### `getDatesBetween(startDate: Date, endDate: Date, includeEndDate?: boolean): Date[]`\n\nReturns an array of dates between two dates.\n\n```typescript\nconst dates = getDatesBetween(new Date('2024-01-01'), new Date('2024-01-05'));\n```\n\n## TypeScript Support\n\nThis library is written in TypeScript and includes type definitions. Types are automatically imported when using TypeScript.\n\n```typescript\nimport { currency } from '@ashirbad/js-core';\n\nconst price: number = 1000;\nconst formattedPrice: string = formatCurrency(price, 'USD');\n```\n\n## Contributing\n\nContributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.\n\n1. Fork the repository\n2. Create your feature branch\n3. Commit your changes\n4. Push to the branch\n5. Create a Pull Request\n\n## License\n\nThis project is licensed under the ISC License - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\n- Star this repository\n- Report issues\n- Submit Pull Requests\n- Spread the word\n\n---\n\nMade with ❤️ by [Ashirbad Panigrahi](https://github.com/AshirbadGudu)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashirbadgudu%2Fjs-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashirbadgudu%2Fjs-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashirbadgudu%2Fjs-core/lists"}