{"_rev":"3-50997ba1e3b152fb104e5ecb77f0f6c8","time":{"created":"2025-05-28T13:51:57.838Z","modified":"2025-05-28T13:51:58.281Z","2.0.0":"2025-05-27T11:31:18.884Z","2.2.0":"2025-05-28T13:51:58.078Z"},"_id":"handlebars-helpers-v2","name":"handlebars-helpers-v2","dist-tags":{"latest":"2.2.0"},"versions":{"2.2.0":{"name":"handlebars-helpers-v2","description":"Essential Handlebars helpers in TypeScript. A modernized collection of 8 core helper categories with TypeScript support and ESM compatibility.","version":"2.2.0","homepage":"https://github.com/nocodb/handlebars-helpers","author":{"name":"Anbarasu","url":"https://github.com/DarkPhoenix2704"},"contributors":[{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},{"name":"Adrián Mugnolo","url":"https://github.com/xymbol"},{"name":"Aleš Kotnik","url":"www.draagle.com"},{"name":"Alex Hunt","url":"https://alexhunt.io"},{"name":"Ali Sheehan-Dare","url":"https://github.com/alisd23"},{"name":"Anders D. Johnson","url":"https://andrz.me"},{"name":"Arthur Cinader","url":"http://github.com/acinader"},{"name":"Brian Woodward","url":"https://twitter.com/doowb"},{"name":"Dan Dascalescu","url":"http://dandascalescu.com"},{"name":"Dan Gorby","url":"https://plus.google.com/+GreenRaccoon23"},{"name":"Dane Petersen","url":"https://thegreatsunra.com"},{"name":"Daniel Wabyick","url":"https://github.com/dwabyick"},{"name":"Dennis Borisevich","url":"https://github.com/DenSpirit"},{"name":"Foundy","url":"http://foundy.io"},{"name":"GONZO","url":"https://github.com/why2pac"},{"name":"GracefulLight","url":"https://brendaniel.github.io"},{"name":"Hariadi Hinta","url":"http://www.hariadi.org"},{"name":"James Tsuyuki","url":"https://github.com/jtsuyuki"},{"name":"Jan Stola","url":"https://github.com/iamstolis"},{"name":"Jason Bellamy","url":"http://jasonbellamy.com"},{"name":"Jeffrey Froom","url":"http://jfroom.com"},{"name":"Jocelyn Badgley","url":"http://www.chipersoft.com"},{"name":"Joey Baker","url":"https://www.byjoeybaker.com"},{"name":"Jon Schlinkert","url":"http://twitter.com/jonschlinkert"},{"name":"Kevin Davis","url":"kevindav.us"},{"name":"Laurent Goderre","url":"https://github.com/LaurentGoderre"},{"name":"Liam Moat","url":"http://www.liammoat.com"},{"name":"Makoto Tateno","url":"https://github.com/makotot"},{"name":"Marie Hogebrandt","url":"http://mariehogebrandt.se"},{"name":"Mark Perkins","url":"http://allmarkedup.com"},{"name":"Martyn Rushton","url":"http://swapnull.co.uk"},{"name":"Max Albrecht","url":"178.is"},{"name":"Michael Sheedy","url":"michaelsheedy.com"},{"name":"Mikko Tapionlinna","url":"http://mikko.tapionlinna.fi"},{"name":"Nathan Jessen","url":"http://nathanjessen.github.io"},{"name":"Nathaniel Furniss","url":"https://github.com/nlfurniss"},{"name":"Oleg Orlov","url":"https://github.com/efender"},{"name":"Omesh","url":"https://github.com/omeshp"},{"name":"Patrick Burtchaell","url":"https://pburtchaell.com"},{"name":"Paul Welsh","url":"paulwelsh.info"},{"name":"Raymond Camden","url":"https://www.raymondcamden.com"},{"name":"Rob","url":"https://github.com/robsilva"},{"name":"Sam Tiffin","url":"https://samtiffin.com"},{"name":"Shannon Moeller","url":"http://shannonmoeller.com"},{"name":"Spud Hsu","url":"http://spud.in"},{"name":"Stephen Way","url":"http://stephenway.net"},{"name":"Thomas Jaggi","url":"http://responsive.ch"},{"name":"Tim Douglas","url":"https://github.com/timdouglas"},{"url":"https://github.com/homersimpsons"}],"repository":{"type":"git","url":"git+https://github.com/nocodb/handlebars-helpers.git"},"bugs":{"url":"https://github.com/nocodb/handlebars-helpers/issues"},"license":"MIT","main":"dist/index.js","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","require":"./dist/index.js","types":"./dist/index.d.ts"}},"engines":{"node":">=20.0.0"},"dependencies":{"array-sort":"^1.0.0","create-frame":"^1.0.0","for-in":"^1.0.2","for-own":"^1.0.0","get-value":"^2.0.6","handlebars-utils":"^1.0.6","has-value":"^1.0.0","helper-date":"^1.0.1","semver":"^7.7.2","year":"^0.2.1"},"devDependencies":{"@types/node":"^20.0.0","handlebars":"^4.7.8","mocha":"^10.0.0","typescript":"^5.0.0"},"keywords":["array","collection","comparison","date","handlebars","helper","helpers","math","number","string","template","typescript","url","utility"],"scripts":{"build":"tsc","dev":"tsc --watch","test":"pnpm build && mocha test/*.js","lint":"echo 'Linting not configured yet'","typecheck":"tsc --noEmit","clean":"rm -rf dist","prebuild":"pnpm clean","pretest":"pnpm build","release":"scripts/release.sh","pack:test":"npm pack --dry-run","pack:real":"npm pack"},"_id":"handlebars-helpers-v2@2.2.0","_integrity":"sha512-Tr7c1S5pFgiAfteQ5Oay3UVT7ybkhU+HSA97qToXkWVt7QKjOSNgPh14qKu0ZROVl0n5JxYGFsezsgqsNeQpGA==","_resolved":"/private/var/folders/y1/rvghq65s21593x5fq6f2h8w00000gn/T/fa323bd64da9292f0536a5ff83b8578e/handlebars-helpers-v2-2.2.0.tgz","_from":"file:handlebars-helpers-v2-2.2.0.tgz","_nodeVersion":"22.13.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-Tr7c1S5pFgiAfteQ5Oay3UVT7ybkhU+HSA97qToXkWVt7QKjOSNgPh14qKu0ZROVl0n5JxYGFsezsgqsNeQpGA==","shasum":"ca9ba3079c9e6aa0fae4f7535258ceba91b5d1d0","tarball":"https://registry.npmjs.org/handlebars-helpers-v2/-/handlebars-helpers-v2-2.2.0.tgz","fileCount":47,"unpackedSize":163931,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC3GlT8tLPazVF8oO0va5xNvlVF2Axo7HjTE9KVESb+LQIhAIY4gfwmuDmqS3BycYlSW63KXR7EaUYKXjn7/yyNIRgg"}]},"_npmUser":{"name":"darkphoenix2704","email":"anbarasun123@gmail.com"},"directories":{},"maintainers":[{"name":"darkphoenix2704","email":"anbarasun123@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/handlebars-helpers-v2_2.2.0_1748440317893_0.17745367099871978"},"_hasShrinkwrap":false}},"maintainers":[{"name":"darkphoenix2704","email":"anbarasun123@gmail.com"}],"description":"Essential Handlebars helpers in TypeScript. A modernized collection of 8 core helper categories with TypeScript support and ESM compatibility.","homepage":"https://github.com/nocodb/handlebars-helpers","keywords":["array","collection","comparison","date","handlebars","helper","helpers","math","number","string","template","typescript","url","utility"],"repository":{"type":"git","url":"git+https://github.com/nocodb/handlebars-helpers.git"},"contributors":[{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},{"name":"Adrián Mugnolo","url":"https://github.com/xymbol"},{"name":"Aleš Kotnik","url":"www.draagle.com"},{"name":"Alex Hunt","url":"https://alexhunt.io"},{"name":"Ali Sheehan-Dare","url":"https://github.com/alisd23"},{"name":"Anders D. Johnson","url":"https://andrz.me"},{"name":"Arthur Cinader","url":"http://github.com/acinader"},{"name":"Brian Woodward","url":"https://twitter.com/doowb"},{"name":"Dan Dascalescu","url":"http://dandascalescu.com"},{"name":"Dan Gorby","url":"https://plus.google.com/+GreenRaccoon23"},{"name":"Dane Petersen","url":"https://thegreatsunra.com"},{"name":"Daniel Wabyick","url":"https://github.com/dwabyick"},{"name":"Dennis Borisevich","url":"https://github.com/DenSpirit"},{"name":"Foundy","url":"http://foundy.io"},{"name":"GONZO","url":"https://github.com/why2pac"},{"name":"GracefulLight","url":"https://brendaniel.github.io"},{"name":"Hariadi Hinta","url":"http://www.hariadi.org"},{"name":"James Tsuyuki","url":"https://github.com/jtsuyuki"},{"name":"Jan Stola","url":"https://github.com/iamstolis"},{"name":"Jason Bellamy","url":"http://jasonbellamy.com"},{"name":"Jeffrey Froom","url":"http://jfroom.com"},{"name":"Jocelyn Badgley","url":"http://www.chipersoft.com"},{"name":"Joey Baker","url":"https://www.byjoeybaker.com"},{"name":"Jon Schlinkert","url":"http://twitter.com/jonschlinkert"},{"name":"Kevin Davis","url":"kevindav.us"},{"name":"Laurent Goderre","url":"https://github.com/LaurentGoderre"},{"name":"Liam Moat","url":"http://www.liammoat.com"},{"name":"Makoto Tateno","url":"https://github.com/makotot"},{"name":"Marie Hogebrandt","url":"http://mariehogebrandt.se"},{"name":"Mark Perkins","url":"http://allmarkedup.com"},{"name":"Martyn Rushton","url":"http://swapnull.co.uk"},{"name":"Max Albrecht","url":"178.is"},{"name":"Michael Sheedy","url":"michaelsheedy.com"},{"name":"Mikko Tapionlinna","url":"http://mikko.tapionlinna.fi"},{"name":"Nathan Jessen","url":"http://nathanjessen.github.io"},{"name":"Nathaniel Furniss","url":"https://github.com/nlfurniss"},{"name":"Oleg Orlov","url":"https://github.com/efender"},{"name":"Omesh","url":"https://github.com/omeshp"},{"name":"Patrick Burtchaell","url":"https://pburtchaell.com"},{"name":"Paul Welsh","url":"paulwelsh.info"},{"name":"Raymond Camden","url":"https://www.raymondcamden.com"},{"name":"Rob","url":"https://github.com/robsilva"},{"name":"Sam Tiffin","url":"https://samtiffin.com"},{"name":"Shannon Moeller","url":"http://shannonmoeller.com"},{"name":"Spud Hsu","url":"http://spud.in"},{"name":"Stephen Way","url":"http://stephenway.net"},{"name":"Thomas Jaggi","url":"http://responsive.ch"},{"name":"Tim Douglas","url":"https://github.com/timdouglas"},{"url":"https://github.com/homersimpsons"}],"author":{"name":"Anbarasu","url":"https://github.com/DarkPhoenix2704"},"bugs":{"url":"https://github.com/nocodb/handlebars-helpers/issues"},"license":"MIT","readme":"# handlebars-helpers-v2\n\n> Essential Handlebars helpers in TypeScript. A modernized collection of 8 core helper categories with TypeScript support and ESM compatibility.\n\n## Features\n\n- ✅ **TypeScript Native** - Written in TypeScript with full type support\n- ✅ **ESM & CommonJS** - Supports both module systems\n- ✅ **Security First** - No security vulnerabilities, minimal dependencies\n- ✅ **Performance Focused** - Native implementations instead of heavy dependencies\n- ✅ **Well Tested** - 315+ comprehensive tests covering all helpers\n- ✅ **Modern Tooling** - Built with pnpm, compiled with TypeScript\n\n## Install\n\nInstall with npm:\n\n```sh\nnpm install handlebars-helpers-v2\n```\n\nInstall with pnpm:\n\n```sh\npnpm add handlebars-helpers-v2\n```\n\nInstall with yarn:\n\n```sh\nyarn add handlebars-helpers-v2\n```\n\n## Usage\n\n### ES Modules (Recommended)\n\n```js\nimport { array, string, math } from 'handlebars-helpers-v2';\nimport Handlebars from 'handlebars';\n\n// Register specific helper categories\nObject.keys(array).forEach(name => {\n  Handlebars.registerHelper(name, array[name]);\n});\n\nObject.keys(string).forEach(name => {\n  Handlebars.registerHelper(name, string[name]);\n});\n```\n\n### Using Default Export\n\n```js\nimport handlebarsHelpers from 'handlebars-helpers-v2';\nimport Handlebars from 'handlebars';\n\n// Register all helpers automatically\nhandlebarsHelpers({ handlebars: Handlebars });\n\n// Or get specific collections\nconst arrayHelpers = handlebarsHelpers(['array']);\nconst stringAndMathHelpers = handlebarsHelpers(['string', 'math']);\n\n// Or get all helpers as an object\nconst allHelpers = handlebarsHelpers();\n```\n\n### Using Getter Functions\n\n```js\nimport handlebarsHelpers from 'handlebars-helpers-v2';\nimport Handlebars from 'handlebars';\n\n// Auto-register specific category\nhandlebarsHelpers.array({ handlebars: Handlebars });\nhandlebarsHelpers.string({ handlebars: Handlebars });\n\n// Or just get the helpers without registering\nconst arrayHelpers = handlebarsHelpers.array();\nconst stringHelpers = handlebarsHelpers.string();\n```\n\n### CommonJS\n\n```js\nconst { array, string, math } = require('handlebars-helpers-v2');\nconst Handlebars = require('handlebars');\n\n// Register specific helper categories\nObject.keys(array).forEach(name => {\n  Handlebars.registerHelper(name, array[name]);\n});\n\nObject.keys(string).forEach(name => {\n  Handlebars.registerHelper(name, string[name]);\n});\n```\n\n### CommonJS with Default Export\n\n```js\nconst handlebarsHelpers = require('handlebars-helpers-v2').default;\nconst Handlebars = require('handlebars');\n\n// Register all helpers automatically\nhandlebarsHelpers({ handlebars: Handlebars });\n\n// Or use getter functions\nhandlebarsHelpers.array({ handlebars: Handlebars });\nhandlebarsHelpers.string({ handlebars: Handlebars });\n```\n\n### TypeScript\n\n```ts\nimport { array, string, math } from 'handlebars-helpers-v2';\nimport handlebarsHelpers from 'handlebars-helpers-v2';\nimport * as Handlebars from 'handlebars';\n\n// Import named exports with full type support\nObject.entries(array).forEach(([name, helper]) => {\n  Handlebars.registerHelper(name, helper);\n});\n\n// Or use default export with auto-registration\nhandlebarsHelpers({ handlebars: Handlebars });\n\n// Or use getter functions with types\nconst arrayHelpers = handlebarsHelpers.array();\nconst stringHelpers = handlebarsHelpers.string();\n```\n\n## Helper Categories\n\nThis package includes **8 essential helper categories**:\n\n| Category | Helpers | Description |\n|----------|---------|-------------|\n| **[array](#array)** | 25+ | Array manipulation and iteration |\n| **[collection](#collection)** | 2+ | Object and collection utilities |\n| **[comparison](#comparison)** | 15+ | Logical comparisons and conditionals |\n| **[date](#date)** | 5+ | Date formatting and manipulation |\n| **[math](#math)** | 10+ | Mathematical operations |\n| **[number](#number)** | 10+ | Number formatting and utilities |\n| **[string](#string)** | 30+ | String manipulation and formatting |\n| **[url](#url)** | 5+ | URL parsing and manipulation |\n\n## Examples\n\n### Array Helpers\n\n```handlebars\n<!-- Array manipulation -->\n{{#each (after items 2)}}\n  <li>{{this}}</li>\n{{/each}}\n\n<!-- Array filtering -->\n{{#filter items \"age\" 21}}\n  <p>{{name}} is old enough</p>\n{{/filter}}\n\n<!-- Array length check -->\n{{#lengthEqual items 5}}\n  <p>Exactly 5 items!</p>\n{{/lengthEqual}}\n```\n\n### String Helpers\n\n```handlebars\n<!-- String formatting -->\n<h1>{{titleize \"hello world\"}}</h1>\n<!-- Output: <h1>Hello World</h1> -->\n\n<!-- String manipulation -->\n<p>{{truncate description 100}}</p>\n<span>{{capitalize name}}</span>\n\n<!-- Case conversion -->\n{{pascalcase \"foo-bar-baz\"}} <!-- FooBarBaz -->\n{{camelcase \"foo bar baz\"}}   <!-- fooBarBaz -->\n{{snakecase \"foo bar baz\"}}   <!-- foo_bar_baz -->\n```\n\n### Math Helpers\n\n```handlebars\n<!-- Mathematical operations -->\n<p>Total: ${{add price tax}}</p>\n<p>Average: {{avg scores}}</p>\n<p>{{#gt score 85}}Grade: A{{else}}Grade: B{{/gt}}</p>\n\n<!-- Number formatting -->\n<span>{{toFixed percentage 2}}%</span>\n```\n\n### Comparison Helpers\n\n```handlebars\n<!-- Logical comparisons -->\n{{#and user.active user.verified}}\n  <span class=\"verified\">✓ Active & Verified</span>\n{{/and}}\n\n<!-- Value checking -->\n{{#isFalsey value}}\n  <p>Value is falsey (including 'nope', 'nil', etc.)</p>\n{{/isFalsey}}\n\n<!-- Contains checking -->\n{{#contains tags \"featured\"}}\n  <span class=\"featured\">⭐ Featured</span>\n{{/contains}}\n```\n\n### Date Helpers\n\n```handlebars\n<!-- Date formatting -->\n<time>{{formatDate createdAt \"YYYY-MM-DD\"}}</time>\n<span>{{timeago publishedAt}}</span>\n\n<!-- Date comparisons -->\n{{#isAfter endDate startDate}}\n  <p>Event is valid</p>\n{{/isAfter}}\n```\n\n### URL Helpers\n\n```handlebars\n<!-- URL manipulation -->\n<a href=\"{{stripProtocol website}}\">{{domain}}</a>\n\n<!-- URL parsing -->\n{{#with (urlParse \"https://example.com/path?q=search\")}}\n  <p>Host: {{hostname}}</p>\n  <p>Path: {{pathname}}</p>\n  <p>Query: {{query}}</p>\n{{/with}}\n```\n\n## API Reference\n\n### Helper Categories\n\nEach category is exported as a separate object:\n\n```js\nimport { \n  array,      // Array helpers\n  collection, // Collection helpers  \n  comparison, // Comparison helpers\n  date,       // Date helpers\n  math,       // Math helpers\n  number,     // Number helpers\n  string,     // String helpers\n  url         // URL helpers\n} from 'handlebars-helpers-v2';\n```\n\n### Individual Helpers\n\nYou can also import individual helpers:\n\n```js\n// Array helpers\nconst { first, last, join, sort } = array;\n\n// String helpers  \nconst { capitalize, truncate, replace } = string;\n\n// Math helpers\nconst { add, subtract, multiply, divide } = math;\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b my-new-feature`\n3. Make your changes and add tests\n4. Run tests: `pnpm test`\n5. Build: `pnpm build`\n6. Commit: `git commit -am 'Add some feature'`\n7. Push: `git push origin my-new-feature`\n8. Submit a pull request\n\n## Development\n\n```sh\n# Install dependencies\npnpm install\n\n# Run tests\npnpm test\n\n# Build TypeScript\npnpm build\n\n# Run linting\npnpm lint\n\n# Run type checking\npnpm typecheck\n```\n\n## Version History\n\n### v1.0.0 (TypeScript Rewrite)\n- Complete TypeScript rewrite\n- Modern ESM/CommonJS dual package\n- Reduced from 130+ to 80+ essential helpers\n- Zero security vulnerabilities  \n- Native implementations replace heavy dependencies\n- 315+ comprehensive tests\n- Full type safety\n\n## License\n\nReleased under the [MIT License](LICENSE).\n\n## Credits\n\nThis project is a TypeScript rewrite and modernization of the original [handlebars-helpers](https://github.com/helpers/handlebars-helpers) by [Jon Schlinkert](https://github.com/jonschlinkert) and contributors. The original project provided the foundation and inspiration for this modern implementation.\n\n**Original Repository**: https://github.com/helpers/handlebars-helpers  \n**Original Author**: Jon Schlinkert  \n**License**: MIT (maintained)\n\n## Related\n\n- [handlebars](https://handlebarsjs.com/) - The semantic template language\n- [template-helpers](https://github.com/jonschlinkert/template-helpers) - Generic template helpers\n- [handlebars-helpers](https://github.com/helpers/handlebars-helpers) - Original handlebars-helpers project\n\n---\n\n**Modernized with ❤️ for the TypeScript era**","readmeFilename":"README.md"}