Skip to content

Commit

Permalink
version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LahiruSammika95 committed Nov 4, 2021
0 parents commit 62c2fc5
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
44 changes: 44 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const array={

createMultiDimensionNumArray:(rows,columns,startIndex=0,skip=1)=>{

let arr=Array.from({length:rows},()=>{
startValue=startIndex
startValue-=skip
return Array.from({length:columns},()=>{
startValue+=skip
return startValue;
})
})
return arr
},
createNumArray:(length,startIndex=0,skip=1)=>{
startIndex-=skip
let arr=Array.from({length:length},()=>{
startIndex+=skip
return startIndex;
})
return arr
},
createObjArray:(length,obj={})=>{

let arr=Array.from({length:length},()=>(obj))
return arr
},
createMultiDimensionObjArray:(rows,columns,obj={})=>{

let arr=Array.from({length:rows},()=>{

return Array.from({length:columns},()=>{

return obj;
})
})
return arr
},
createMap:(strArr=[])=>{
return new Map(strArr.entries());
}

}
module.exports = array;
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "data-struct-npm",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}

0 comments on commit 62c2fc5

Please sign in to comment.