-
Notifications
You must be signed in to change notification settings - Fork 0
Array implementation #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
71fa857
chore(pad-array): create initial structure
maasencioh fa798a9
feat(pad-array): implement method for array case
maasencioh f2995c5
docs(pad-array): update README docs
maasencioh 4ac1c79
chore(arrayCase): uses isArray, opt. conditions and no diff vars
maasencioh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
chore(pad-array): create initial structure
- Loading branch information
commit 71fa8578af4204308c56901a06579b46c7dcce4f
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| node_modules | ||
| .idea |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| language: node_js | ||
| node_js: | ||
| - "0.12" | ||
| - "iojs" | ||
| sudo: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| 0.0.0 / HEAD | ||
| ============ | ||
|
|
||
| * first release |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,49 @@ | ||
| # pad-array | ||
|
|
||
| [![NPM version][npm-image]][npm-url] | ||
| [![build status][travis-image]][travis-url] | ||
| [![David deps][david-image]][david-url] | ||
| [![npm download][download-image]][download-url] | ||
|
|
||
| Function to pads an array in Javascript | ||
|
|
||
| This code is based in the MATLAB's code [padarray](http://www.mathworks.com/help/images/ref/padarray.html) | ||
|
|
||
| ## Installation | ||
|
|
||
| `npm install ml-pad-array` | ||
|
|
||
| ## Methods | ||
|
|
||
| ### pad-array(data, [options]) | ||
|
|
||
| Pads the array `data` given the current `options`. | ||
|
|
||
| __Options__ | ||
| * padsize: | ||
| * padval: | ||
| * direction: | ||
|
|
||
| ## Test | ||
|
|
||
| ```bash | ||
| $ npm install | ||
| $ npm test | ||
| ``` | ||
|
|
||
| ## Authors | ||
|
|
||
| - [Miguel Asencio](https://github.com/maasencioh) | ||
|
|
||
| ## License | ||
|
|
||
| [MIT](./LICENSE) | ||
|
|
||
| [npm-image]: https://img.shields.io/npm/v/ml-pad-array.svg?style=flat-square | ||
| [npm-url]: https://npmjs.org/package/ml-pad-array | ||
| [travis-image]: https://img.shields.io/travis/mljs/pad-array/master.svg?style=flat-square | ||
| [travis-url]: https://travis-ci.org/mljs/pad-array | ||
| [david-image]: https://img.shields.io/david/mljs/pad-array.svg?style=flat-square | ||
| [david-url]: https://david-dm.org/mljs/pad-array | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. both lines can be removed |
||
| [download-image]: https://img.shields.io/npm/dm/ml-pad-array.svg?style=flat-square | ||
| [download-url]: https://npmjs.org/package/ml-pad-array | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| "name": "ml-pad-array", | ||
| "version": "0.0.0", | ||
| "description": "Function to pads an array in Javascript", | ||
| "main": "src/index.js", | ||
| "directories": { | ||
| "lib": "src", | ||
| "test": "test" | ||
| }, | ||
| "scripts": { | ||
| "test": "mocha --require should --reporter mocha-better-spec-reporter --recursive" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/mljs/pad-array" | ||
| }, | ||
| "keywords": [ | ||
| "pad", | ||
| "array", | ||
| "utils" | ||
| ], | ||
| "author": { | ||
| "name": "Miguel Asencio", | ||
| "mail": "maasencioh@gmail.com" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this field is supposed to be "email" |
||
| }, | ||
| "license": "MIT", | ||
| "bugs": { | ||
| "url": "https://github.com/mljs/pad-array/issues" | ||
| }, | ||
| "homepage": "https://github.com/mljs/pad-array", | ||
| "devDependencies": { | ||
| "mocha": "latest", | ||
| "mocha-better-spec-reporter": "latest", | ||
| "should": "latest" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| 'use strict'; | ||
|
|
||
| var defaultOptions = { | ||
| padsize: 1, | ||
| padval: 0, | ||
| direction: 'both' | ||
| }; | ||
|
|
||
| /** | ||
| * Pads and array | ||
| * @param {Array <number>} data | ||
| * @param {object} options | ||
| */ | ||
| function padArray (data, options) { | ||
| options = options || {}; | ||
| for (var o in defaultOptions) | ||
| if (!(options[o])) | ||
| options[o] = defaultOptions[o]; | ||
| return data; | ||
| } | ||
|
|
||
| module.exports = padArray; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| 'use strict'; | ||
|
|
||
| var padArray = require('..'); | ||
|
|
||
| describe('Pad array test', function () { | ||
|
|
||
| it('Default test', function () { | ||
| var data = new Array(200); | ||
| for (var i = 0; i < data.length; i++) | ||
| data[i] = Math.sin(i); | ||
| var model = padArray(data); | ||
| }); | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove the david badge if the project doesn't have dependencies