-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(new build) create build and test for the first method
- Loading branch information
1 parent
72c3773
commit b34304b
Showing
10 changed files
with
2,729 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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,3 @@ | ||
{ | ||
"presets": ["env"] | ||
} |
This file contains 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,3 +1,6 @@ | ||
{ | ||
"extends": "airbnb" | ||
"extends": "airbnb", | ||
"env": { | ||
"mocha": true | ||
} | ||
} |
This file contains 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/ | ||
dist/ |
This file contains 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,15 +1,30 @@ | ||
{ | ||
"name": "remram", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"main": "dist/index.js", | ||
"repository": "https://github.com/gtkatakura/remram.git", | ||
"author": "gtkatakura <gt.katakura@gmail.com>", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "webpack", | ||
"test": "npm run coverage", | ||
"test:all": "mocha --compilers js:babel-core/register test/**/*.spec.js", | ||
"coverage": "nyc -r=lcov -r=text -i babel-core/register mocha test/**/*.spec.js" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.24.1", | ||
"babel-core": "^6.25.0", | ||
"babel-loader": "^7.1.1", | ||
"babel-preset-env": "^1.6.0", | ||
"chai": "^4.1.0", | ||
"eslint": "3.19.0", | ||
"eslint-config-airbnb": "^15.0.2", | ||
"eslint-plugin-import": "2.6.1", | ||
"eslint-plugin-jsx-a11y": "5.1.1", | ||
"eslint-plugin-react": "7.1.0" | ||
} | ||
"eslint-plugin-react": "7.1.0", | ||
"mocha": "^3.4.2", | ||
"nyc": "^11.0.3", | ||
"webpack": "^3.3.0" | ||
}, | ||
"dependencies": {} | ||
} |
This file contains 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,3 @@ | ||
const flatten = array => [].concat(...array); | ||
|
||
export default flatten; |
This file contains 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 @@ | ||
import flatten from './flatten'; | ||
|
||
export default { | ||
flatten, | ||
}; |
This file contains 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,3 @@ | ||
import array from './array'; | ||
|
||
export default array; |
This file contains 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,33 @@ | ||
import { expect } from 'chai'; | ||
import _ from '../../src'; | ||
|
||
const { flatten } = _; | ||
|
||
describe('flatten', () => { | ||
describe('when is a empty array', () => { | ||
it('should return a empty array', () => { | ||
expect(flatten([])).to.eql([]); | ||
}); | ||
}); | ||
|
||
describe('when is a linear array', () => { | ||
it('should return a linear array', () => { | ||
const result = flatten([1, 2, 3]); | ||
expect(result).to.eql([1, 2, 3]); | ||
}); | ||
}); | ||
|
||
describe('when is a array with one level', () => { | ||
it('should return a linear array', () => { | ||
const result = flatten([[1, 2, 3]]); | ||
expect(result).to.eql([1, 2, 3]); | ||
}); | ||
}); | ||
|
||
describe('when is a array with two levels', () => { | ||
it('should return a array with one level', () => { | ||
const result = flatten([[[1, 2, 3]]]); | ||
expect(result).to.eql([[1, 2, 3]]); | ||
}); | ||
}); | ||
}); |
This file contains 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,16 @@ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
entry: './src/index.js', | ||
output: { | ||
path: path.join(__dirname, 'dist'), | ||
filename: 'bundle.js', | ||
}, | ||
module: { | ||
loaders: [{ | ||
test: /.js$/, | ||
loader: 'babel-loader', | ||
exclude: /node_modules/, | ||
}], | ||
}, | ||
}; |
Oops, something went wrong.