# props

> extract json/yaml from the beginning of text files

Latest version **0.3.0** (published 2012-08-09) · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2012-08-09 |
| First published | 2011-08-09 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Paul Vorbach |
| Maintainers | pvorb |

## Links

- npm: https://www.npmjs.com/package/props
- Repository: https://github.com/pvorb/node-props
- Issues: http://github.com/pvorb/node-props/issues
- npm.io page: https://npm.io/package/props

## Dependencies (2)

- [jsml](https://npm.io/package/jsml.md) <0.1.0
- [js-yaml](https://npm.io/package/js-yaml.md) >=0.3.5 <1.1.0

## Recent versions

- 0.3.0 (latest) — 2012-08-09
- 0.2.4 — 2012-08-09
- 0.2.3 — 2012-02-08
- 0.2.2 — 2011-12-30
- 0.2.1 — 2011-12-30
- 0.2.0 — 2011-12-30
- 0.1.1 — 2011-12-22
- 0.1.0 — 2011-08-22
- 0.0.3 — 2011-08-14
- 0.0.2 — 2011-08-13
- 0.0.1 — 2011-08-09

## README

# props

a module for node that is able to extract either JSON or YAML from the beginning
of a string

## Installation

`npm install props` or `npm install -g props`

## Usage

```js
var props = require("props");

// Use JSON

var json =
'{\n\
  "title": "How to use node.js",\n\
  "date": "2011-08-09T17:56:00",\n\
  "tags": [ "example", "node.js" ]\n\
}\n\
\n\
\n\
Node.js is a new technology...';

console.log(props(json));

// or YAML

var yaml =
'title: How to use node.js\n\
date: 2011-08-09T17:56:00\n\
tags:\n\
  - example\n\
  - node.js\n\
\n\
\n\
Node.js is a new technology...';

console.log(props(yaml));
```

This will print nearly the same object twice, since `json` and `yaml` define the
same object:

_JSON_:

```js
{ title: 'How to use node.js',
  date: '2011-08-09T17:56:00',
  tags: [ 'example', 'node.js' ],
  __content: 'Node.js is a new technology...' }

```

_YAML_:

```js
{ title: 'How to use node.js',
  date: Tue, 09 Aug 2011 15:56:00 GMT,
  tags: [ 'example', 'node.js' ],
  __content: 'Node.js is a new technology...' }
```

The difference is that, due to it's JS implementation, the Date is parsed in the
YAML version.

The JSON/YAML part has to be **always** seperated from the content by three
newline characters (`\n\n\n` or `\r\n\r\n\r\n`).

## Bugs and Issues

If you encounter any bugs or issues, feel free to open an issue at
[github](//github.com/pvorb/node-props/issues).

## License

The [MIT license](http://vorb.de/license/mit.html).

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