Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

read-yaml

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-yaml - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

bower.json

2

.verbrc.md

@@ -9,3 +9,3 @@ ---

## Install
{%= include("install") %}
{%= include("install-npm", {save: true}) %}

@@ -12,0 +12,0 @@ ## API

@@ -12,29 +12,16 @@ /*!

var async = require('async');
var file = module.exports = {};
/**
* ## .readYAMLSync( filepath )
* ## async
*
* Read YAML file synchronously and parse content as JSON
* @param {String} `filepath`
* @return {Object}
*/
file.readYAMLSync = function (filepath) {
var str = fs.readFileSync(String(filepath), 'utf8');
try {
return YAML.load(str);
} catch (err) {
err.message = 'Failed to parse "' + filepath + '": ' + err.message;
throw err;
}
};
/**
* ## .readYAML( filepath )
*
* Read YAML file asynchronously and parse content as JSON
*
* **Example:**
*
* ```js
* var yaml = require('read-yaml');
* var config = yaml('config.yml');
* ```
*
* @param {String} `filepath`

@@ -44,3 +31,3 @@ * @return {Object}

file.readYAML = function (filepath, callback) {
module.exports = function (filepath, callback) {
async.waterfall([

@@ -56,4 +43,31 @@ function (next) { fs.readFile(String(filepath), 'utf8', next); },

}
],
callback);
};
], callback);
};
/**
* ## sync
*
* Read YAML file synchronously and parse content as JSON
*
* **Example:**
*
* ```js
* var yaml = require('read-yaml').sync;
* var config = yaml('config.yml');
* ```
*
* @param {String} `filepath`
* @return {Object}
*/
module.exports.sync = function (filepath) {
var str = fs.readFileSync(String(filepath), 'utf8');
try {
return YAML.load(str);
} catch (err) {
err.message = 'Failed to parse "' + filepath + '": ' + err.message;
throw err;
}
};
{
"name": "read-yaml",
"description": "Very thin wrapper around js-yaml for directly reading in YAML files.",
"version": "0.1.0",
"version": "0.2.0",
"homepage": "https://github.com/jonschlinkert/read-yaml",

@@ -24,9 +24,6 @@ "author": {

"keywords": [
"docs",
"documentation",
"generate",
"generator",
"markdown",
"templates",
"verb"
"yaml",
"data",
"parse",
"read"
],

@@ -48,5 +45,4 @@ "main": "index.js",

"async": "^0.9.0",
"js-yaml": "^3.0.2",
"read-file": "^0.1.2"
"js-yaml": "^3.0.2"
}
}

@@ -6,13 +6,20 @@ # read-yaml [![NPM version](https://badge.fury.io/js/read-yaml.png)](http://badge.fury.io/js/read-yaml)

## Install
Install with [npm](npmjs.org):
#### [npm](npmjs.org)
```bash
npm i read-yaml --save-dev
npm i read-yaml --save
```
## API
### .readYAMLSync ( filepath )
### async
Read YAML file synchronously and parse content as JSON
Read YAML file asynchronously and parse content as JSON
**Example:**
```js
var yaml = require('read-yaml');
var config = yaml('config.yml');
```
* `filepath` {String}:

@@ -22,6 +29,13 @@ * `return` {Object}

### .readYAML ( filepath )
### sync
Read YAML file asynchronously and parse content as JSON
Read YAML file synchronously and parse content as JSON
**Example:**
```js
var yaml = require('read-yaml').sync;
var config = yaml('config.yml');
```
* `filepath` {String}:

@@ -43,2 +57,2 @@ * `return` {Object}

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 10, 2014._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 18, 2014._

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc