@unavatar/core 3.24.0 → 3.24.1

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
@@ -68,13 +68,14 @@ It's proudly powered by [microlink.io](https://microlink.io/), the headless brow
68
68
 
69
69
  The service is exposed in **unavatar.io** via provider endpoints:
70
70
 
71
- - an **email (auto-detect)**: [unavatar.io/hello@microlink.io](https://unavatar.io/hello@microlink.io) — tries Gravatar, then GitHub
71
+ - an **email**: [unavatar.io/email/hello@microlink.io](https://unavatar.io/email/hello@microlink.io)
72
+ - a **domain**: [unavatar.io/domain/reddit.com](https://unavatar.io/domain/reddit.com)
72
73
  - an **email** via Gravatar: [unavatar.io/gravatar/hello@microlink.io](https://unavatar.io/gravatar/hello@microlink.io)
73
74
  - an **email** via GitHub: [unavatar.io/github/sindresorhus@gmail.com](https://unavatar.io/github/sindresorhus@gmail.com)
74
75
  - an **username**: [unavatar.io/github/kikobeats](https://unavatar.io/github/kikobeats)
75
76
  - a **domain**: [unavatar.io/google/reddit.com](https://unavatar.io/google/reddit.com)
76
77
 
77
- Use `/:provider/:key` for provider-specific lookups, or pass an email as the only path segment for automatic resolution. You can read more in [Email avatars](https://unavatar.io/email) and [providers](https://unavatar.io/docs#providers).
78
+ Use `/email/:key` and `/domain/:key` for type-based resolution. You can read more in [Email avatars](https://unavatar.io/email) and [providers](https://unavatar.io/docs#providers).
78
79
 
79
80
  ## Authentication
80
81
 
@@ -651,7 +652,7 @@ Available inputs:
651
652
 
652
653
  ### YouTube
653
654
 
654
- Get any YouTube channel's thumbnail by their handle, legacy username, or channel ID.
655
+ Get any YouTube channel's thumbnail by their handle, username, or channel ID.
655
656
 
656
657
  e.g., [unavatar.io/youtube/casey](https://unavatar.io/youtube/casey)
657
658
 
@@ -745,4 +746,4 @@ Expected errors are known operational cases returned with stable codes.
745
746
 
746
747
  ## Contact
747
748
 
748
- If you have any suggestion or bug to report, please contact to ust mailing to [hello@unavatar.io](mailto:hello@unavatar.io).
749
+ If you have any suggestion or bug to report, please contact to ust mailing to [hello@unavatar.io](mailto:hello@unavatar.io).
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@unavatar/core",
3
3
  "description": "Get unified user avatar from social networks, including Instagram, SoundCloud, Telegram, Twitter, YouTube & more.",
4
4
  "homepage": "https://unavatar.io",
5
- "version": "3.24.0",
5
+ "version": "3.24.1",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
package/src/index.js CHANGED
@@ -61,6 +61,11 @@ module.exports = ({ constants: userConstants, redis, onFetchHTML } = {}) => {
61
61
  unavatar[name] = input => getAvatar(providers[name], name, input, {})
62
62
  })
63
63
 
64
+ const createTypedAutoResolver = inputType => input => auto(inputType)(input, {})
65
+
66
+ unavatar.email = createTypedAutoResolver('email')
67
+ unavatar.domain = createTypedAutoResolver('domain')
68
+
64
69
  unavatar.auto = auto
65
70
  unavatar.getInputType = getInputType
66
71
  unavatar.getAvatar = getAvatar