diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/load-json-file | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/load-json-file')
-rw-r--r-- | node_modules/load-json-file/index.js | 26 | ||||
-rw-r--r-- | node_modules/load-json-file/node_modules/strip-bom/index.js | 14 | ||||
-rw-r--r-- | node_modules/load-json-file/node_modules/strip-bom/license | 21 | ||||
-rw-r--r-- | node_modules/load-json-file/node_modules/strip-bom/package.json | 40 | ||||
-rw-r--r-- | node_modules/load-json-file/node_modules/strip-bom/readme.md | 36 | ||||
-rw-r--r-- | node_modules/load-json-file/package.json | 13 | ||||
-rw-r--r-- | node_modules/load-json-file/readme.md | 4 |
7 files changed, 28 insertions, 126 deletions
diff --git a/node_modules/load-json-file/index.js b/node_modules/load-json-file/index.js index b2767e302..96d4d9f6f 100644 --- a/node_modules/load-json-file/index.js +++ b/node_modules/load-json-file/index.js @@ -1,11 +1,21 @@ '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'); +var path = require('path'); +var fs = require('graceful-fs'); +var stripBom = require('strip-bom'); +var parseJson = require('parse-json'); +var Promise = require('pinkie-promise'); +var pify = require('pify'); -const parse = (data, fp) => parseJson(stripBom(data), path.relative('.', fp)); +function parse(x, fp) { + return parseJson(stripBom(x), path.relative(process.cwd(), fp)); +} -module.exports = fp => pify(fs.readFile)(fp, 'utf8').then(data => parse(data, fp)); -module.exports.sync = fp => parse(fs.readFileSync(fp, 'utf8'), fp); +module.exports = function (fp) { + return pify(fs.readFile, Promise)(fp, 'utf8').then(function (data) { + return parse(data, fp); + }); +}; + +module.exports.sync = function (fp) { + return parse(fs.readFileSync(fp, 'utf8'), fp); +}; diff --git a/node_modules/load-json-file/node_modules/strip-bom/index.js b/node_modules/load-json-file/node_modules/strip-bom/index.js deleted file mode 100644 index b00feb9a4..000000000 --- a/node_modules/load-json-file/node_modules/strip-bom/index.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; -module.exports = x => { - if (typeof x !== 'string') { - throw new TypeError('Expected a string, got ' + typeof x); - } - - // Catches EFBBBF (UTF-8 BOM) because the buffer-to-string - // conversion translates it to FEFF (UTF-16 BOM) - if (x.charCodeAt(0) === 0xFEFF) { - return x.slice(1); - } - - return x; -}; diff --git a/node_modules/load-json-file/node_modules/strip-bom/license b/node_modules/load-json-file/node_modules/strip-bom/license deleted file mode 100644 index 654d0bfe9..000000000 --- a/node_modules/load-json-file/node_modules/strip-bom/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus <sindresorhus@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/node_modules/load-json-file/node_modules/strip-bom/package.json b/node_modules/load-json-file/node_modules/strip-bom/package.json deleted file mode 100644 index 10f8fdd7e..000000000 --- a/node_modules/load-json-file/node_modules/strip-bom/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "strip-bom", - "version": "3.0.0", - "description": "Strip UTF-8 byte order mark (BOM) from a string", - "license": "MIT", - "repository": "sindresorhus/strip-bom", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js" - ], - "keywords": [ - "strip", - "bom", - "byte", - "order", - "mark", - "unicode", - "utf8", - "utf-8", - "remove", - "delete", - "trim", - "text", - "string" - ], - "devDependencies": { - "ava": "*", - "xo": "*" - } -} diff --git a/node_modules/load-json-file/node_modules/strip-bom/readme.md b/node_modules/load-json-file/node_modules/strip-bom/readme.md deleted file mode 100644 index 812a98071..000000000 --- a/node_modules/load-json-file/node_modules/strip-bom/readme.md +++ /dev/null @@ -1,36 +0,0 @@ -# strip-bom [](https://travis-ci.org/sindresorhus/strip-bom) - -> Strip UTF-8 [byte order mark](http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8) (BOM) from a string - -From Wikipedia: - -> The Unicode Standard permits the BOM in UTF-8, but does not require nor recommend its use. Byte order has no meaning in UTF-8. - - -## Install - -``` -$ npm install --save strip-bom -``` - - -## Usage - -```js -const stripBom = require('strip-bom'); - -stripBom('\uFEFFunicorn'); -//=> 'unicorn' -``` - - -## Related - -- [strip-bom-cli](https://github.com/sindresorhus/strip-bom-cli) - CLI for this module -- [strip-bom-buf](https://github.com/sindresorhus/strip-bom-buf) - Buffer version of this module -- [strip-bom-stream](https://github.com/sindresorhus/strip-bom-stream) - Stream version of this module - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/load-json-file/package.json b/node_modules/load-json-file/package.json index e5809e515..b44c8a128 100644 --- a/node_modules/load-json-file/package.json +++ b/node_modules/load-json-file/package.json @@ -1,6 +1,6 @@ { "name": "load-json-file", - "version": "2.0.0", + "version": "1.1.0", "description": "Read and parse a JSON file", "license": "MIT", "repository": "sindresorhus/load-json-file", @@ -10,7 +10,7 @@ "url": "sindresorhus.com" }, "engines": { - "node": ">=4" + "node": ">=0.10.0" }, "scripts": { "test": "xo && ava" @@ -19,8 +19,8 @@ "index.js" ], "keywords": [ - "read", "json", + "read", "parse", "file", "fs", @@ -31,13 +31,16 @@ "graceful-fs": "^4.1.2", "parse-json": "^2.2.0", "pify": "^2.0.0", - "strip-bom": "^3.0.0" + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" }, "devDependencies": { "ava": "*", "xo": "*" }, "xo": { - "esnext": true + "ignores": [ + "test.js" + ] } } diff --git a/node_modules/load-json-file/readme.md b/node_modules/load-json-file/readme.md index 3319c266c..fa982b549 100644 --- a/node_modules/load-json-file/readme.md +++ b/node_modules/load-json-file/readme.md @@ -28,7 +28,7 @@ loadJsonFile('foo.json').then(json => { ### loadJsonFile(filepath) -Returns a promise for the parsed JSON. +Returns a promise that resolves to the parsed JSON. ### loadJsonFile.sync(filepath) @@ -42,4 +42,4 @@ Returns the parsed JSON. ## License -MIT © [Sindre Sorhus](https://sindresorhus.com) +MIT © [Sindre Sorhus](http://sindresorhus.com) |