{"id":21033467,"url":"https://github.com/electerious/key-value-replace","last_synced_at":"2025-05-15T13:32:08.620Z","repository":{"id":14129238,"uuid":"76075882","full_name":"electerious/key-value-replace","owner":"electerious","description":"Replace key/value pairs in a string.","archived":false,"fork":false,"pushed_at":"2022-10-01T13:59:14.000Z","size":34,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-24T01:07:14.142Z","etag":null,"topics":["key-value","replace","string","template"],"latest_commit_sha":null,"homepage":"","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/electerious.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-12-09T22:44:45.000Z","updated_at":"2025-03-10T16:26:15.000Z","dependencies_parsed_at":"2023-01-11T18:44:58.600Z","dependency_job_id":null,"html_url":"https://github.com/electerious/key-value-replace","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electerious%2Fkey-value-replace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electerious%2Fkey-value-replace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electerious%2Fkey-value-replace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electerious%2Fkey-value-replace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electerious","download_url":"https://codeload.github.com/electerious/key-value-replace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254349466,"owners_count":22056352,"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":["key-value","replace","string","template"],"created_at":"2024-11-19T12:57:14.732Z","updated_at":"2025-05-15T13:32:08.147Z","avatar_url":"https://github.com/electerious.png","language":"JavaScript","readme":"# key-value-replace\n\n![Build](https://github.com/electerious/key-value-replace/workflows/Build/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/electerious/key-value-replace/badge.svg?branch=master)](https://coveralls.io/github/electerious/key-value-replace?branch=master)\n\nReplace key/value pairs in a string.\n\n## Install\n\n```\nnpm install key-value-replace\n```\n\n## Usage\n\n```js\nconst replace = require('key-value-replace')\n\nreplace('hello {{ name }}', { name: 'world' }) // hello world\nreplace('{{ greeting }} {{ name }}', { greeting: 'hi', name: 'world' }) // hi world\nreplace('hello {{ name }}', { name: (key, i, data, str) =\u003e key }) // hello name\nreplace('hello !! name !!', { name: 'world' }, [ '!! ', ' !!' ]) // hello world\n```\n\n## Parameters\n\n- `str` `{String}` - A string to replace the contents of.\n- `obj` `{Object}` - Key/value pairs, where value must be a function or a string.\n- `delimiter` `{Array}` - Optional array with a start and end delimiter.\n\t- `{String}` Start delimiter. Defaults to `'{{ '`.\n\t- `{String}` End delimiter. Defaults to `' }}'`.\n\n## Returns\n\n- `{String}` - A string with replaced content.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felecterious%2Fkey-value-replace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felecterious%2Fkey-value-replace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felecterious%2Fkey-value-replace/lists"}