Skip to content

Commit

Permalink
Merge pull request #28 from oliviacarlisle/dev
Browse files Browse the repository at this point in the history
Update version to 1.0.3
  • Loading branch information
oliviacarlisle authored Oct 21, 2024
2 parents c557dd8 + d322d49 commit 3003e61
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,26 @@ queue.enqueue(3);
console.log(queue.dequeue()); // Output: 3
```

### 🚧 Using `dslib-core` in CommonJS Projects

`dslib-core` is primarily designed for ESM (ECMAScript Module) environments. However, you can still use it in CommonJS projects with a few adjustments.

To use `dslib-core` in a CommonJS project, we suggest using a dynamic `import()` within an async IIFE (Immediately Invoked Function Expression). Here's an example:

```typescript
// CommonJS project example
(async function () {
const { Queue } = await import('dslib-core');

// Your code here
const queue = new Queue();
queue.enqueue(1);
console.log(queue.dequeue()); // Output: 1
})();
```

This approach allows you to use the ESM-native `dslib-core` package within your CommonJS environment while maintaining asynchronous module loading.

## 🏗️ Data Structures

### 🔄 Queue
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dslib-core",
"version": "1.0.2",
"version": "1.0.3",
"description": "A robust and efficient data structures library.",
"type": "module",
"scripts": {
Expand Down

0 comments on commit 3003e61

Please sign in to comment.