nice-try

WebJar for nice-try

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

nice-try
Last Version

Last Version

1.0.5
Release Date

Release Date

Type

Type

jar
Description

Description

nice-try
WebJar for nice-try
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/electerious/nice-try

Download nice-try

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/nice-try/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>nice-try</artifactId>
    <version>1.0.5</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/nice-try/
implementation 'org.webjars.npm:nice-try:1.0.5'
// https://jarcasting.com/artifacts/org.webjars.npm/nice-try/
implementation ("org.webjars.npm:nice-try:1.0.5")
'org.webjars.npm:nice-try:jar:1.0.5'
<dependency org="org.webjars.npm" name="nice-try" rev="1.0.5">
  <artifact name="nice-try" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='nice-try', version='1.0.5')
)
libraryDependencies += "org.webjars.npm" % "nice-try" % "1.0.5"
[org.webjars.npm/nice-try "1.0.5"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

nice-try

Travis Build Status Coverage Status Dependencies Greenkeeper badge

A function that tries to execute a function and discards any error that occurs.

Install

npm install nice-try

Usage

const niceTry = require('nice-try')

niceTry(() => JSON.parse('true')) // true
niceTry(() => JSON.parse('truee')) // undefined
niceTry() // undefined
niceTry(true) // undefined

await niceTry.promise(async () => JSON.parse('true')) // true
await niceTry.promise(async () => JSON.parse('truee')) // undefined

API

Parameters

  • fn {Function} Function that might or might not throw an error.

Returns

  • {?*} Return-value of the function when no error occurred.

Versions

Version
1.0.5