{"id":17445962,"url":"https://github.com/jamen/lazy-template","last_synced_at":"2025-07-28T23:34:29.048Z","repository":{"id":57289818,"uuid":"67094124","full_name":"jamen/lazy-template","owner":"jamen","description":"Create template strings that are lazy and reusable.","archived":false,"fork":false,"pushed_at":"2017-01-29T02:15:35.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-12T05:39:02.349Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-01T03:18:51.000Z","updated_at":"2021-12-19T15:40:37.000Z","dependencies_parsed_at":"2022-08-28T10:40:38.664Z","dependency_job_id":null,"html_url":"https://github.com/jamen/lazy-template","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jamen/lazy-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Flazy-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Flazy-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Flazy-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Flazy-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamen","download_url":"https://codeload.github.com/jamen/lazy-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Flazy-template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267604324,"owners_count":24114522,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-17T18:18:58.851Z","updated_at":"2025-07-28T23:34:29.026Z","avatar_url":"https://github.com/jamen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lazy-template [![NPM version](https://badge.fury.io/js/lazy-template.svg)](https://npmjs.org/package/lazy-template) [![Build Status](https://travis-ci.org/jamen/lazy-template.svg?branch=master)](https://travis-ci.org/jamen/lazy-template)\n\n\u003e Create template strings that are lazy and reusable.\n\n```js\nconst lazy = require('lazy-template')\n\n// Create a lazy template string.\nconst greet = lazy`Hello ${0}. How is ${1}?`\n// Use the returned function to compile.\n\ngreet([ 'Earth', 'the weather' ])\n// =\u003e 'Hello Earth. How is the weather?'\n\ngreet([ 'Mars', 'Jamen' ])\n// =\u003e 'Hello Mars.  How is Jamen?'\n```\n\nThis module is built with [`pixie`](https://github.com/jamen/pixie).  You can use array indexes or object keys for the points.  Or just provide a different `compile` function all together.\n\n## Installation\n\n```sh\n$ npm install --save lazy-template\n```\n\n## Usage\n\n### `lazy`\n\nCreate a lazy template string.  Returns a `compile` function, which when called returns the concatenated string.\n\n```javascript\n// Using array indexes:\nconst compile = lazy`Hello ${0}. How are ${1}?`\n\n// Using object keys:\nconst compile = lazy`Hello ${'world'}.  How is ${'thing'}?`\n```\n\n### `compile(data, [compile])`\n\nCompile the \"lazy string\" using some data.  Returns resulting string.\n\n - data (`Array`|`Object`): Data to use in your template.\n - compile (`Function`): A custom function to replace [`pixie.compile`](https://github.com/jamen/pixie#pixie_compile)\n\n```js\nconst compile = lazy`Hello ${0}.`\ncompile([ 'Earth' ])\n// =\u003e 'Hello Earth.'\n\nconst compile = lazy`Hello ${'world'}.`\ncompile({ world: 'Mars' });\n// =\u003e 'Hello Mars.'\n\nconst compile = lazy`Hello ${0}.  How is ${1}?`\ncompile([ 'Pluto', 'Jamen' ], function (template, data) {\n  // Compile `template` and `data`\n  // Return result\n})\n```\n\n## License\n\nMIT © [Jamen Marz](https://github.com/jamen)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Flazy-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamen%2Flazy-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Flazy-template/lists"}