Skip to content

Commit

Permalink
update module export
Browse files Browse the repository at this point in the history
  • Loading branch information
noasax committed Mar 13, 2019
1 parent 46a09cd commit fce98f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ npm install fast-array-sort

### JavaScript
```javascript
const sort = require('../src/index').default;
const sort = require('../src/index');

console.log(sort([4, 2, 5, 1, 3]));
console.log(sort([4, 2, 5, 1, 3])) // [ 1, 2, 3, 4, 5 ]
```

### TypeScript
```typescript
import sort from '../src/index';

console.log(sort([4, 2, 5, 1, 3]));
console.log(sort([4, 2, 5, 1, 3])); // [ 1, 2, 3, 4, 5 ]
```
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function partition(arr, l = 0, r = arr.length - 1) {
const pivot = l;
let _l = l + 1, _r = r;
Expand All @@ -26,4 +25,4 @@ function sort(arr, l = 0, r = arr.length - 1) {
sort(arr, pivot + 1, r);
return arr;
}
exports.default = sort;
module.exports = sort;
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ function sort(arr: Array<any>, l: number = 0, r: number = arr.length - 1): Array
return arr;
}

export default sort;
export = sort;

0 comments on commit fce98f0

Please sign in to comment.