Skip to content

Commit fc87874

Browse files
committed
Improved array_unshift
1 parent 6e6302b commit fc87874

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

functions/array/array_unshift.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ function array_unshift (array) {
22
// http://kevin.vanzonneveld.net
33
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
44
// + improved by: Martijn Wieringa
5+
// + improved by: jmweb
56
// % note 1: Currently does not handle objects
67
// * example 1: array_unshift(['van', 'Zonneveld'], 'Kevin');
78
// * returns 1: 3
89

9-
var argc = arguments.length, argv = arguments, i;
10-
11-
for (i = 1; i < argc; i++) {
12-
array.unshift(argv[i]);
13-
}
14-
15-
return (array.length);
10+
var i = arguments.length;
11+
12+
while(--i !== 0){
13+
arguments[0].unshift(arguments[i]);
14+
}
15+
16+
return arguments[0].length;
1617
}

gittyup.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,5 @@ echo "${COMMENT}" > ~/.gitup.dat
116116
echo "Committing: ${COMMENT}..."
117117
git commit -a -m "${COMMENT}" && git push origin
118118

119-
120-
echo "https://github.com/"`git config remote.origin.url`
121-
122-
exit 1
123-
124-
hub =! echo "https://github.com/"`git config remote.origin.url` | sed -E s/[a-z]+@github\.com:// | sed s/\.git$//
125-
url =!sh -c 'HEAD=`git rev-parse HEAD` && SHA1=`[ "$0" = "sh" ] && echo $HEAD || echo $0` && echo `git hub`"/commit/"${SHA1i}'
119+
echo ""
120+
echo "Fixed: https://github.com/"`git config remote.origin.url`"/commit/"`git rev-parse HEAD`| sed -E s/[a-z]+@github\.com:// | sed 's#\.git##g'

0 commit comments

Comments
 (0)