orc-me 1.2.6 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,6 +18,7 @@
18
18
  * ✨ Get awesome orc names for your projects!
19
19
  * 👹 An orc name is created by starting with a harsh consonant sound (like `gr`, `kr`, `th`, or `sh`), followed by a short, heavy vowel (`a`, `o`, or `u`), and usually ending with another hard consonant (`g`, `k`, `r`, or `z`). Sometimes an extra harsh sound is added at the end to make the name feel more brutal.
20
20
  * ⭐ Updated the version using a custom `orc phoneme grammar` to avoid hardcoded array of names.
21
+ * ♻️ Works seamlessly with `CommonJS`, `ESM` and `TypeScript`
21
22
 
22
23
  # Install [NPM](https://www.npmjs.com/package/orc-me) 📦
23
24
 
@@ -29,6 +30,7 @@
29
30
 
30
31
  # Examples 💻
31
32
 
33
+ ## CommonJS
32
34
  ``` javascript
33
35
  const orcMe = require('orc-me');
34
36
 
@@ -39,6 +41,28 @@ console.log('Orc battle started! ⚔️');
39
41
  console.log(orcThreeNames + ' ⚔️ ' + orcTwoNames);
40
42
  ```
41
43
 
44
+ ## ESM
45
+ ```javascript
46
+ import orcMe from 'orc-me';
47
+
48
+ const orcThreeNames = `${orcMe()} ${orcMe()} ${orcMe()}`;
49
+ const orcTwoNames = `${orcMe()} ${orcMe()}`;
50
+
51
+ console.log('Orc battle started! ⚔️');
52
+ console.log(orcThreeNames + ' ⚔️ ' + orcTwoNames);
53
+ ```
54
+
55
+ ## TypeScript
56
+ ```javascript
57
+ import orcMe from 'orc-me';
58
+
59
+ const orcThreeNames: string = `${orcMe()} ${orcMe()} ${orcMe()}`;
60
+ const orcTwoNames: string = `${orcMe()} ${orcMe()}`;
61
+
62
+ console.log('Orc battle started! ⚔️');
63
+ console.log(`${orcThreeNames} ⚔️ ${orcTwoNames}`);
64
+ ```
65
+
42
66
  # Result of the example above
43
67
 
44
68
  <p align="center">
package/index.d.ts CHANGED
@@ -3,6 +3,6 @@
3
3
  *
4
4
  * @returns A randomly generated orc name as a string
5
5
  */
6
- declare function orcName(): string;
6
+ declare function orcMe(): string;
7
7
 
8
- export = orcName;
8
+ export = orcMe;
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * orc-me - 👹 Generate a random orc name
3
- * @version: v1.2.6
3
+ * @version: v1.2.8
4
4
  * @link: https://github.com/tutyamxx/orc-me
5
5
  * @license: MIT
6
6
  **/
@@ -39,4 +39,8 @@ const orcMe = () => {
39
39
  return `${onset}${vowel}${coda}${extra}${secondSyllable}`?.replace?.(/^./, c => c.toUpperCase()) ?? '';
40
40
  };
41
41
 
42
+ // --| CommonJS export
42
43
  module.exports = orcMe;
44
+
45
+ // --| ESM default export for `import` statements
46
+ module.exports.default = orcMe;
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "orc-me",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "Generate a random orc name",
5
5
  "main": "index.js",
6
- "type": "module",
6
+ "module": "index.js",
7
+ "types": "index.d.ts",
8
+ "exports": {
9
+ "require": "./index.js",
10
+ "import": "./index.js",
11
+ "types": "./index.d.ts"
12
+ },
7
13
  "scripts": {
8
14
  "test": "jest --verbose"
9
15
  },