# placeholders

> Replace placeholder values in a file path.

Latest version **1.0.0** (published 2017-06-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install placeholders
pnpm add placeholders
yarn add placeholders
bun add placeholders
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-06-17 |
| First published | 2015-08-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Jon Schlinkert |
| Maintainers | doowb, jonschlinkert |
| Keywords | dot, dot-notation, file, filepath, interpolate, notation, param, parameter, path, permalink, placeholder, prop, rewrite, url |

## Links

- npm: https://www.npmjs.com/package/placeholders
- Repository: https://github.com/jonschlinkert/placeholders
- Issues: https://github.com/jonschlinkert/placeholders/issues
- npm.io page: https://npm.io/package/placeholders

## Dependencies (2)

- [expand](https://npm.io/package/expand.md) ^0.5.0
- [assign-deep](https://npm.io/package/assign-deep.md) ^0.4.5

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-06-17
- 0.3.0 — 2016-07-11
- 0.2.0 — 2015-09-17
- 0.1.1 — 2015-09-16
- 0.1.0 — 2015-08-31

## README

# placeholders [![NPM version](https://img.shields.io/npm/v/placeholders.svg?style=flat)](https://www.npmjs.com/package/placeholders) [![NPM monthly downloads](https://img.shields.io/npm/dm/placeholders.svg?style=flat)](https://npmjs.org/package/placeholders)  [![NPM total downloads](https://img.shields.io/npm/dt/placeholders.svg?style=flat)](https://npmjs.org/package/placeholders) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/placeholders.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/placeholders) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/placeholders.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/placeholders)

> Replace placeholder values in a file path.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save placeholders
```

Install with [yarn](https://yarnpkg.com):

```sh
$ yarn add placeholders
```

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save placeholders
```

## Usage

```js
var placeholders = require('placeholders')(options);

placeholders('/site/blog/:path', {path: 'foo-bar.md'});
//=> '/site/blog/foo-bar.md'
```

## Options

Options may be passed to the main function.

```js
var placeholders = require('placeholders')(options);
```

### options.regex

Pass a custom regex to use for replacements.

**Type**: `{RegExp}`

**Default**: the default regex matches es6 delimiters and lodash template syntax.

**Example**

Match [printf-like](https://en.wikipedia.org/wiki/Printf_format_string) strings:

```js
var placeholders = require('placeholders')({
  regex: /%([^%]+)%/
});
```

### options.data

Pass a `data` object on the main function to use for resolving values.

**Type**: `{Object}`

**Default**: `undefined`

**Example**

```js
var placeholders = require('placeholders')({
  data: {foo: 'one', bar: 'two'}
});

placeholders(':foo/:bar/:baz', {baz: 'three'})
//=> 'one/two/three'
```

### returns a function when no data is passed

This allows you to reuse the same pattern with different data,
like a compiled template.

```js
var placeholders = require('placeholders')({
  regex: /%([^%]+)%/
});

var fn = placeholders('foo/%bar%/%baz%');
fn({bar: 'one', baz: 'two'})
//=> 'foo/one/two'
fn({bar: 'a', baz: 'b'})
//=> 'foo/a/b'
```

## About

### Related projects

* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target… [more](https://github.com/jonschlinkert/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep "Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target (first) object.")
* [expand](https://www.npmjs.com/package/expand): Recursively resolve templates in an object, string or array. | [homepage](https://github.com/jonschlinkert/expand "Recursively resolve templates in an object, string or array.")

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

### Contributors

| **Commits** | **Contributor** |  
| --- | --- |  
| 13 | [jonschlinkert](https://github.com/jonschlinkert) |  
| 8  | [doowb](https://github.com/doowb) |  

### Building docs

_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_

To generate the readme, run the following command:

```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```

### Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

```sh
$ npm install && npm test
```

### Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)

### License

Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 17, 2017._

---
_Source: https://npm.io/package/placeholders · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
