Skip to content

Commit 7cefbc5

Browse files
committed
readmy update, badges, package.json homepage update
1 parent 38f5e96 commit 7cefbc5

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
# last-callback v1.0.0
1+
# last-callback v1.0.1
22

33
## Description
44

5-
Easly get last argument and call if it is a function.
6-
You do not need to check last argument manually any more.
5+
Get and call last given argument if is a function. You do not need to check last argument manually any more.
6+
All you need to do is to pass arguments array to this little module, then call it, or bind with `this` context.
7+
Last-callback always return a function with build in validation. Last not callable argument will be omitted without throwing any exception.
78

8-
All you need to do is to pass arguments array to this little module,
9-
then call it, or bind with `this` context.
9+
last-callback is compatybile with ES5 and latest.
1010

11-
It is compatybile with ES5 and above.
11+
[![npm](https://img.shields.io/npm/l/last-callback.svg?maxAge=2592000)]()
12+
[![npm](https://img.shields.io/npm/dt/last-callback.svg?maxAge=2592000)]()
13+
[![node](https://img.shields.io/node/v/last-callback.svg?maxAge=2592000)]()
14+
[![Maintenance](https://img.shields.io/maintenance/yes/2016.svg?maxAge=2592000)]()
15+
[![coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg)]()
1216

1317
## Requirements
1418

@@ -28,7 +32,7 @@ last-callback respects: bind, call, and apply methods;
2832

2933
### ES6 Style
3034

31-
If you are using NodeJS >= 6.2 You should definitly use ES6 style with spread operators.
35+
If you are using `NodeJS >= 6.2` You should definitly use __ES6 style__ with spread operators.
3236

3337
```javascript
3438
const lastCallback = require('last-callback');
@@ -46,7 +50,7 @@ myFunc('test value', function (param) {
4650

4751
### ES5 Style
4852

49-
If you are still using NodeJS < 6.2, i.e. NodeJS 4.4.7 LTS, you can use ES5 style.
53+
If you are still using `NodeJS < 6.2.0`, i.e. `NodeJS 4.4.7 LTS`, you can use __ES5 style__.
5054

5155

5256
```javascript
@@ -69,11 +73,11 @@ myFunc('test value', function (param) {
6973
var lastCallback = require('last-callback');
7074

7175
function myFunc (param1) {
72-
var callback = lastCallback.apply(null, arguments); // no need to bind context here
76+
var callback = lastCallback.apply(null, arguments);
7377

7478
this.contextVariable = 'this is my context';
7579

76-
callback.call(this, param1); // this is the place where you should bind context
80+
callback.call(this, param1); // bind context if you need it
7781
}
7882

7983
myFunc('test value', function (param) {
@@ -93,24 +97,24 @@ let
9397
iterator = 1,
9498
limit = 5;
9599

96-
function myFunc (number) {
100+
function myFunc (iterator) {
97101
let callback = lastCallback(...arguments);
98102

99-
callback(number);
103+
callback(iterator);
100104
}
101105

102-
function recursiveCallabck (number) {
103-
if (number === limit) {
106+
function recursiveCallabck (iterator) {
107+
if (iterator === limit) {
104108
return;
105109
}
106110

107-
console.log(number);
111+
console.log(iterator);
108112

109-
number += 1;
110-
recursiveCallabck(number);
113+
iterator += 1;
114+
recursiveCallabck(iterator);
111115
}
112116

113-
myFunc(number, recursiveCallabck);
117+
myFunc(iterator, recursiveCallabck);
114118
// console log:
115119
// 1
116120
// 2

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"name": "last-callback",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"author": "Paweł Zadrożny <pawel.zny@gmail.com> (http://pawelzny.com/npm/env)",
5-
"description": "Get last argument and call if it is a function.",
5+
"description": "Get and call last given argument if is a function.",
66
"keywords": [
77
"last",
88
"callback",
99
"function",
1010
"arguments"
1111
],
1212
"license": "MIT",
13-
"homepage": "https://pawelzny.com/npm/dotenv-loader",
13+
"homepage": "https://pawelzny.com/npm/last-callback",
1414
"repository": {
1515
"type": "git",
1616
"url": "git+https://github.com/pawelzny/last-callback.git"

0 commit comments

Comments
 (0)