orc-me 1.2.7 → 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.
Files changed (3) hide show
  1. package/README.md +23 -0
  2. package/index.js +5 -1
  3. package/package.json +8 -2
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
 
@@ -40,6 +41,28 @@ console.log('Orc battle started! ⚔️');
40
41
  console.log(orcThreeNames + ' ⚔️ ' + orcTwoNames);
41
42
  ```
42
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
+
43
66
  # Result of the example above
44
67
 
45
68
  <p align="center">
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * orc-me - 👹 Generate a random orc name
3
- * @version: v1.2.7
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.7",
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
  },