# match-template

> Filter out objects using a predefined template object.

Latest version **0.1.0** (published 2016-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install match-template
pnpm add match-template
yarn add match-template
bun add match-template
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-04-23 |
| First published | 2016-02-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Martin Kubat |
| Maintainers | martinkubat |
| Keywords | template, object, match, javascript, whitelist, keys |

## Links

- npm: https://www.npmjs.com/package/match-template
- Repository: https://github.com/martinkubat/match-template
- Homepage: https://github.com/martinkubat/match-template#readme
- Issues: https://github.com/martinkubat/match-template/issues
- npm.io page: https://npm.io/package/match-template

## Dependencies (1)

- [underscore](https://npm.io/package/underscore.md) ^1.8.3

## Recent versions

- 0.1.0 (latest) — 2016-04-23
- 0.0.2 — 2016-02-13
- 0.0.1 — 2016-02-13

## README

#match-template

A function which filters out an object according to set template object.

##Installation

```bash
npm install match-template
```

##Usage

```javascript
var matchTemplate = require('match-template');

var template = {
    id: true,
    name: true,
    location: {
        town: true,
    }
};

var object = {
    id: 5,
    name: 'Tom',
    surname: 'Smith',
    isMember: false,
    location: {
        town: 'Manchester, UK',
        address: '32 Baker Street',
        postcode: 'M25 HA2',
    },
};

var filteredObject = matchTemplate(object, template);

console.log(filteredObject);
/**
{
    id: 5,
    name: 'Tom',
    location: {
        town: 'Manchester, UK',
    },
}
*/
```

##Todo

- Add unit testing
- Make more clear documentation
- Comment the code

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