Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
jio
Commits
608e6830
Commit
608e6830
authored
Aug 23, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util.arrayInsert added
parent
1d2ab53f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
src/jio/core/util.js
src/jio/core/util.js
+17
-0
No files found.
src/jio/core/util.js
View file @
608e6830
...
...
@@ -356,3 +356,20 @@ function arrayExtend(array) { // args*
return
array
;
}
exports
.
util
.
arrayExtend
=
arrayExtend
;
/**
* Acts like `Array.prototype.concat` but does not create a copy of the original
* array. It extends the original array from a specific position and return it.
*
* @param {Array} array The array to extend
* @param {Number} position The position where to extend
* @param {Any} [args]* Values to add in the array
* @return {Array} The original array
*/
function
arrayInsert
(
array
,
position
)
{
// args*
var
array_part
=
array
.
splice
(
position
,
array
.
length
-
position
);
arrayExtend
.
apply
(
null
,
arrayExtend
([
],
[
array
],
Array
.
prototype
.
slice
.
call
(
arguments
,
2
)));
return
arrayExtend
(
array
,
array_part
);
}
exports
.
util
.
arrayInsert
=
arrayInsert
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment