Skip to content

Commit

Permalink
完成
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHzq committed Aug 2, 2019
1 parent 62979b7 commit b45c060
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion coverage/coverage.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"D:\\hzq\\GitHub\\ts-npm-template\\dist\\index.js":{"path":"D:\\hzq\\GitHub\\ts-npm-template\\dist\\index.js","s":{"1":1,"2":1,"3":1,"4":0,"5":1,"6":0,"7":1},"b":{"1":[0,1],"2":[0,1]},"f":{"1":1},"fnMap":{"1":{"name":"(anonymous_1)","line":3,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":35}}}},"statementMap":{"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"2":{"start":{"line":3,"column":0},"end":{"line":7,"column":3}},"3":{"start":{"line":4,"column":4},"end":{"line":4,"column":32}},"4":{"start":{"line":4,"column":24},"end":{"line":4,"column":30}},"5":{"start":{"line":5,"column":4},"end":{"line":5,"column":32}},"6":{"start":{"line":5,"column":24},"end":{"line":5,"column":30}},"7":{"start":{"line":6,"column":4},"end":{"line":6,"column":17}}},"branchMap":{"1":{"line":4,"type":"if","locations":[{"start":{"line":4,"column":4},"end":{"line":4,"column":4}},{"start":{"line":4,"column":4},"end":{"line":4,"column":4}}]},"2":{"line":5,"type":"if","locations":[{"start":{"line":5,"column":4},"end":{"line":5,"column":4}},{"start":{"line":5,"column":4},"end":{"line":5,"column":4}}]}}}}
{"D:\\hzq\\GitHub\\ts-npm-template\\dist\\index.js":{"path":"D:\\hzq\\GitHub\\ts-npm-template\\dist\\index.js","s":{"1":1,"2":1,"3":1,"4":0,"5":1,"6":0,"7":1},"b":{"1":[0,1],"2":[0,1]},"f":{"1":1},"fnMap":{"1":{"name":"(anonymous_1)","line":3,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":30}}}},"statementMap":{"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"2":{"start":{"line":3,"column":0},"end":{"line":7,"column":2}},"3":{"start":{"line":4,"column":4},"end":{"line":4,"column":32}},"4":{"start":{"line":4,"column":24},"end":{"line":4,"column":30}},"5":{"start":{"line":5,"column":4},"end":{"line":5,"column":32}},"6":{"start":{"line":5,"column":24},"end":{"line":5,"column":30}},"7":{"start":{"line":6,"column":4},"end":{"line":6,"column":17}}},"branchMap":{"1":{"line":4,"type":"if","locations":[{"start":{"line":4,"column":4},"end":{"line":4,"column":4}},{"start":{"line":4,"column":4},"end":{"line":4,"column":4}}]},"2":{"line":5,"type":"if","locations":[{"start":{"line":5,"column":4},"end":{"line":5,"column":4}},{"start":{"line":5,"column":4},"end":{"line":5,"column":4}}]}}}}
2 changes: 1 addition & 1 deletion coverage/lcov-report/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Aug 02 2019 11:49:13 GMT+0800 (GMT+08:00)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Aug 02 2019 13:18:21 GMT+0800 (GMT+08:00)
</div>
</div>
<script src="../prettify.js"></script>
Expand Down
6 changes: 3 additions & 3 deletions coverage/lcov-report/dist/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ <h1>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (a, b) {
exports.add = function (a, b) {
<span class="missing-if-branch" title="if path not taken" >I</span>if (a === void 0) { <span class="cstat-no" title="statement not covered" >a = 1; </span>}
<span class="missing-if-branch" title="if path not taken" >I</span>if (b === void 0) { <span class="cstat-no" title="statement not covered" >b = 2; </span>}
return a + b;
});
};
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Aug 02 2019 11:49:13 GMT+0800 (GMT+08:00)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Aug 02 2019 13:18:21 GMT+0800 (GMT+08:00)
</div>
</div>
<script src="../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Aug 02 2019 11:49:13 GMT+0800 (GMT+08:00)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Aug 02 2019 13:18:21 GMT+0800 (GMT+08:00)
</div>
</div>
<script src="prettify.js"></script>
Expand Down
3 changes: 1 addition & 2 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
declare const _default: (a?: number, b?: number) => number;
export default _default;
export declare const add: (a?: number, b?: number) => number;
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (a, b) {
exports.add = function (a, b) {
if (a === void 0) { a = 1; }
if (b === void 0) { b = 2; }
return a + b;
});
};
2 changes: 1 addition & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default (a: number = 1, b: number = 2): number => {
export const add = (a: number = 1, b: number = 2): number => {
return a + b
}
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict'
const expect = require('chai').expect
const methods = require('../dist/index.js')
const { add } = require('../dist/index.js')

describe('add', () => {
it('结果:200', () => {
expect(methods.default(100, 100)).to.deep.equal(200)
expect(add(100, 100)).to.deep.equal(200)
})
})

0 comments on commit b45c060

Please sign in to comment.