[Pkg-javascript-commits] [node-load-json-file] 01/03: Import Upstream version 2.0.0

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Fri Oct 28 05:59:37 UTC 2016


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository node-load-json-file.

commit 37974cf3bb2d0602ebfed50aeba4bd3c48466270
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Fri Oct 28 10:48:03 2016 +0530

    Import Upstream version 2.0.0
---
 .editorconfig  | 12 ++++++++++++
 .gitattributes |  1 +
 .gitignore     |  1 +
 .travis.yml    |  4 ++++
 index.js       | 11 +++++++++++
 license        | 21 +++++++++++++++++++++
 package.json   | 43 +++++++++++++++++++++++++++++++++++++++++++
 readme.md      | 45 +++++++++++++++++++++++++++++++++++++++++++++
 test.js        | 14 ++++++++++++++
 9 files changed, 152 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..98a761d
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[{package.json,*.yml}]
+indent_style = space
+indent_size = 2
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..176a458
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text=auto
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..97519af
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+  - '6'
+  - '4'
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..b2767e3
--- /dev/null
+++ b/index.js
@@ -0,0 +1,11 @@
+'use strict';
+const path = require('path');
+const fs = require('graceful-fs');
+const stripBom = require('strip-bom');
+const parseJson = require('parse-json');
+const pify = require('pify');
+
+const parse = (data, fp) => parseJson(stripBom(data), path.relative('.', fp));
+
+module.exports = fp => pify(fs.readFile)(fp, 'utf8').then(data => parse(data, fp));
+module.exports.sync = fp => parse(fs.readFileSync(fp, 'utf8'), fp);
diff --git a/license b/license
new file mode 100644
index 0000000..654d0bf
--- /dev/null
+++ b/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus at gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..e5809e5
--- /dev/null
+++ b/package.json
@@ -0,0 +1,43 @@
+{
+  "name": "load-json-file",
+  "version": "2.0.0",
+  "description": "Read and parse a JSON file",
+  "license": "MIT",
+  "repository": "sindresorhus/load-json-file",
+  "author": {
+    "name": "Sindre Sorhus",
+    "email": "sindresorhus at gmail.com",
+    "url": "sindresorhus.com"
+  },
+  "engines": {
+    "node": ">=4"
+  },
+  "scripts": {
+    "test": "xo && ava"
+  },
+  "files": [
+    "index.js"
+  ],
+  "keywords": [
+    "read",
+    "json",
+    "parse",
+    "file",
+    "fs",
+    "graceful",
+    "load"
+  ],
+  "dependencies": {
+    "graceful-fs": "^4.1.2",
+    "parse-json": "^2.2.0",
+    "pify": "^2.0.0",
+    "strip-bom": "^3.0.0"
+  },
+  "devDependencies": {
+    "ava": "*",
+    "xo": "*"
+  },
+  "xo": {
+    "esnext": true
+  }
+}
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..3319c26
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,45 @@
+# load-json-file [![Build Status](https://travis-ci.org/sindresorhus/load-json-file.svg?branch=master)](https://travis-ci.org/sindresorhus/load-json-file)
+
+> Read and parse a JSON file
+
+[Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom), uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs), and throws more [helpful JSON errors](https://github.com/sindresorhus/parse-json).
+
+
+## Install
+
+```
+$ npm install --save load-json-file
+```
+
+
+## Usage
+
+```js
+const loadJsonFile = require('load-json-file');
+
+loadJsonFile('foo.json').then(json => {
+	console.log(json);
+	//=> {foo: true}
+});
+```
+
+
+## API
+
+### loadJsonFile(filepath)
+
+Returns a promise for the parsed JSON.
+
+### loadJsonFile.sync(filepath)
+
+Returns the parsed JSON.
+
+
+## Related
+
+- [write-json-file](https://github.com/sindresorhus/write-json-file) - Stringify and write JSON to a file atomically
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..c84038f
--- /dev/null
+++ b/test.js
@@ -0,0 +1,14 @@
+import path from 'path';
+import test from 'ava';
+import m from './';
+
+const fixture = path.join(__dirname, 'package.json');
+
+test('async', async t => {
+	const data = await m(fixture);
+	t.is(data.name, 'load-json-file');
+});
+
+test('sync', t => {
+	t.is(m.sync(fixture).name, 'load-json-file');
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-load-json-file.git



More information about the Pkg-javascript-commits mailing list