Skip to content

Commit

Permalink
chore: add default export, more friendly to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
翰文 committed Oct 9, 2017
1 parent 7fd6f4f commit 83d959c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion objectid.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Project: bson-objectid
// Definitions by: Marcel Ernst <https://www.marcel-ernst.de>

export = ObjectID;
export default ObjectID;

declare class ObjectID {
static createFromTime(time: number): ObjectID;
Expand Down
1 change: 1 addition & 0 deletions objectid.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function ObjectID(arg) {
}
module.exports = ObjectID;
ObjectID.generate = generate;
ObjectID.default = ObjectID;

/**
* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID.
Expand Down
4 changes: 2 additions & 2 deletions typing-tests/objectid-tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// <reference path="../objectid.d.ts" />
import ObjectID = require('../objectid');
import ObjectID from '../objectid';

// ----------------------------------------------------------------------------
// setup test data
Expand All @@ -12,7 +12,7 @@ const idString:string = "TIZÙL“G!íçm";

// ----------------------------------------------------------------------------
// should construct with no arguments
let oid:ObjectID = new ObjectID();
let oid = new ObjectID();

// ----------------------------------------------------------------------------
// should have an `id` property
Expand Down

0 comments on commit 83d959c

Please sign in to comment.