Skip to content

Commit

Permalink
Merge pull request #1 from ez-libs/dev-1.0.0
Browse files Browse the repository at this point in the history
Dev 1.0.0
  • Loading branch information
Destinate authored Aug 12, 2019
2 parents 676440e + 6d95399 commit 390c8d4
Show file tree
Hide file tree
Showing 6 changed files with 1,038 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ typings/

# next.js build output
.next

# dir for "compiled" files
dist/
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
language: node_js
node_js:
- "node"
script:
- npm test
- npm run build
cache: npm

#before_deploy: "npm run build"
deploy:
#npmjs.org tarball upload
- provider: npm
skip_cleanup: true
api_key: $NPM_TOKEN
email: $NPM_EMAIL
on:
branch: master
#GitHub release upload
- provider: releases
api_key: $GITHUB_OAUTH_TOKEN
skip_cleanup: true
on:
branch: master
15 changes: 15 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//declaration
interface Array<T> {
ezEach(callback: (value: any, index: number) => void): void;
}

//implementation
/**
* Performs the specified action for each element in an array synchronously.
* @param callback A function that accepts two arguments. ezEach calls the function one time for each element in the array.
*/
Array.prototype.ezEach = function (callback: (value: any, index?: number) => void) { //note to self: using ES6 arrow functions would rip `this` out of it's context
for (let i = 0; i < this.length; i++) {
callback(this[i], i);
}
}
Loading

0 comments on commit 390c8d4

Please sign in to comment.