aboutsummaryrefslogtreecommitdiff
path: root/node_modules/nice-try
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/nice-try
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/nice-try')
-rw-r--r--node_modules/nice-try/CHANGELOG.md21
-rw-r--r--node_modules/nice-try/LICENSE21
-rw-r--r--node_modules/nice-try/README.md32
-rw-r--r--node_modules/nice-try/package.json33
-rw-r--r--node_modules/nice-try/src/index.js12
5 files changed, 119 insertions, 0 deletions
diff --git a/node_modules/nice-try/CHANGELOG.md b/node_modules/nice-try/CHANGELOG.md
new file mode 100644
index 00000000..9e6baf2f
--- /dev/null
+++ b/node_modules/nice-try/CHANGELOG.md
@@ -0,0 +1,21 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+
+## [1.0.5] - 2018-08-25
+
+### Changed
+
+- Removed `prepublish` script from `package.json`
+
+## [1.0.4] - 2017-08-08
+
+### New
+
+- Added a changelog
+
+### Changed
+
+- Ignore `yarn.lock` and `package-lock.json` files \ No newline at end of file
diff --git a/node_modules/nice-try/LICENSE b/node_modules/nice-try/LICENSE
new file mode 100644
index 00000000..681c8f50
--- /dev/null
+++ b/node_modules/nice-try/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2018 Tobias Reich
+
+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/nice-try/README.md b/node_modules/nice-try/README.md
new file mode 100644
index 00000000..5b83b788
--- /dev/null
+++ b/node_modules/nice-try/README.md
@@ -0,0 +1,32 @@
+# nice-try
+
+[![Travis Build Status](https://travis-ci.org/electerious/nice-try.svg?branch=master)](https://travis-ci.org/electerious/nice-try) [![AppVeyor Status](https://ci.appveyor.com/api/projects/status/8tqb09wrwci3xf8l?svg=true)](https://ci.appveyor.com/project/electerious/nice-try) [![Coverage Status](https://coveralls.io/repos/github/electerious/nice-try/badge.svg?branch=master)](https://coveralls.io/github/electerious/nice-try?branch=master) [![Dependencies](https://david-dm.org/electerious/nice-try.svg)](https://david-dm.org/electerious/nice-try#info=dependencies) [![Greenkeeper badge](https://badges.greenkeeper.io/electerious/nice-try.svg)](https://greenkeeper.io/)
+
+A function that tries to execute a function and discards any error that occurs.
+
+## Install
+
+```
+npm install nice-try
+```
+
+## Usage
+
+```js
+const niceTry = require('nice-try')
+
+niceTry(() => JSON.parse('true')) // true
+niceTry(() => JSON.parse('truee')) // undefined
+niceTry() // undefined
+niceTry(true) // undefined
+```
+
+## API
+
+### Parameters
+
+- `fn` `{Function}` Function that might or might not throw an error.
+
+### Returns
+
+- `{?*}` Return-value of the function when no error occurred. \ No newline at end of file
diff --git a/node_modules/nice-try/package.json b/node_modules/nice-try/package.json
new file mode 100644
index 00000000..d3d8887e
--- /dev/null
+++ b/node_modules/nice-try/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "nice-try",
+ "version": "1.0.5",
+ "authors": [
+ "Tobias Reich <tobias@electerious.com>"
+ ],
+ "description": "Tries to execute a function and discards any error that occurs",
+ "main": "src/index.js",
+ "keywords": [
+ "try",
+ "catch",
+ "error"
+ ],
+ "license": "MIT",
+ "homepage": "https://github.com/electerious/nice-try",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/electerious/nice-try.git"
+ },
+ "files": [
+ "src"
+ ],
+ "scripts": {
+ "coveralls": "nyc report --reporter=text-lcov | coveralls",
+ "test": "nyc node_modules/mocha/bin/_mocha"
+ },
+ "devDependencies": {
+ "chai": "^4.1.2",
+ "coveralls": "^3.0.0",
+ "nyc": "^12.0.1",
+ "mocha": "^5.1.1"
+ }
+}
diff --git a/node_modules/nice-try/src/index.js b/node_modules/nice-try/src/index.js
new file mode 100644
index 00000000..837506f2
--- /dev/null
+++ b/node_modules/nice-try/src/index.js
@@ -0,0 +1,12 @@
+'use strict'
+
+/**
+ * Tries to execute a function and discards any error that occurs.
+ * @param {Function} fn - Function that might or might not throw an error.
+ * @returns {?*} Return-value of the function when no error occurred.
+ */
+module.exports = function(fn) {
+
+ try { return fn() } catch (e) {}
+
+} \ No newline at end of file