-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updates in: .gitignore, .eslintrc, readme. JSDocs and version for bro…
…wsers
- Loading branch information
Showing
7 changed files
with
76 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,8 @@ jspm_packages | |
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# IDE directories | ||
.vscode | ||
.idea | ||
.settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Last callback selects last passed argument. | ||
* If this last argument is a function, it will be invoke with | ||
* given context, and arguments. | ||
* | ||
* Last callback returns safe function ready to call. | ||
* Basicly last-callback it's a wrapper around your callback function. | ||
* | ||
* @function last-callback | ||
* @author Paweł Zadrożny <[email protected]> (https://pawelzny.com/) | ||
* @copyright Paweł Zadrożny 2016 | ||
* @license MIT | ||
* @version 1.0.3 | ||
* | ||
* @example | ||
* var callback = lastCallback.apply(null, arguments); // set callback | ||
* callback.apply(this, arguments); // invoke callback with arguments | ||
* | ||
* @returns {Function} callback wrapper | ||
*/ | ||
function lastCallback () { | ||
var last = arguments[arguments.length - 1]; | ||
|
||
return function callback () { | ||
if (typeof last === 'function') { | ||
last.apply(this, arguments); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
function lastCallback(){var n=arguments[arguments.length-1];return function(){"function"==typeof n&&n.apply(this,arguments)}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
/** | ||
* Get last argument and call if it is a function. | ||
* Last callback selects last passed argument. | ||
* If this last argument is a function, it will be invoke with | ||
* given context, and arguments. | ||
* | ||
* @returns {Function} | ||
* Last callback returns safe function ready to call. | ||
* Basicly last-callback it's a wrapper around your callback function. | ||
* | ||
* @module last-callback | ||
* @author Paweł Zadrożny <[email protected]> (https://pawelzny.com/) | ||
* @copyright Paweł Zadrożny 2016 | ||
* @license MIT | ||
* @version 1.0.3 | ||
* | ||
* @example | ||
* const callback = lastCallback(...arguments); // set callback | ||
* callback(...arguments); // invoke callback with arguments | ||
* | ||
* @returns {Function} callback wrapper | ||
*/ | ||
module.exports = function lastCallback () { | ||
var last = arguments[arguments.length -1]; | ||
var last = arguments[arguments.length - 1]; | ||
|
||
return function callback () { | ||
if (typeof last === 'function') { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "last-callback", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"author": "Paweł Zadrożny <[email protected]> (http://pawelzny.com/npm/env)", | ||
"description": "Get and call last given argument if is a function.", | ||
"keywords": [ | ||
|