Skip to content

Allow using negative indexes in JavaScript/TypeScript Arrays

License

Notifications You must be signed in to change notification settings

Bigismall/safe-js-array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Safe Array class

Allow using negative indexes in JavaScript/TypeScript Arrays

Example

 const sampleSafeArray = new SafeArray(0, 1, 2, 3, 4, 5);
  //or 
 // const sampleSafeArray = new SafeArray(...[0, 1, 2, 3, 4, 5]);

 sampleSafeArray[-6]   //0
 sampleSafeArray[-5]   //1
 sampleSafeArray[-4]   //2

 sampleSafeArray[0]   //0
 sampleSafeArray[1]   //1
 sampleSafeArray[2]   //2

See test directory for more detailed explanations

About

Allow using negative indexes in JavaScript/TypeScript Arrays

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published