@sebbo2002/genderize 5.0.2-develop.9 → 6.0.0
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 +4 -9
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +34 -34
- package/dist/index.d.ts +34 -34
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +62 -58
package/README.md
CHANGED
|
@@ -6,15 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
<br />
|
|
8
8
|
|
|
9
|
-
`genderize` is a simple client for [genderize.io](https://genderize.io/), a gender prediction API using a person's
|
|
10
|
-
name. The library supports both normal and batch usage, allows free and paid usage via an optional API key, and makes it
|
|
9
|
+
`genderize` is a simple client for [genderize.io](https://genderize.io/), a gender prediction API using a person's
|
|
10
|
+
name. The library supports both normal and batch usage, allows free and paid usage via an optional API key, and makes it
|
|
11
11
|
very easy to access rate limiting information. It's written in TypeScript.
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
## 📦 Installation
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
npm install @sebbo2002/genderize
|
|
18
16
|
|
|
19
17
|
## ⚡️ Quick Start
|
|
20
18
|
|
|
@@ -36,15 +34,13 @@ await genderize.predict('Alex', 'US');
|
|
|
36
34
|
await genderize.predict(['Noah', 'Evelyn']);
|
|
37
35
|
|
|
38
36
|
// { limit: 1000, remaining: 978, reset: 2022-05-23T00:00:02.203Z }
|
|
39
|
-
genderize.limit
|
|
37
|
+
genderize.limit;
|
|
40
38
|
```
|
|
41
39
|
|
|
42
|
-
|
|
43
40
|
## 📑 API-Reference
|
|
44
41
|
|
|
45
42
|
Every hot detail about the API can be found in [the documentation](https://sebbo2002.github.io/genderize/develop/reference/).
|
|
46
43
|
|
|
47
|
-
|
|
48
44
|
## 🚦 Tests
|
|
49
45
|
|
|
50
46
|
```
|
|
@@ -52,7 +48,6 @@ npm test
|
|
|
52
48
|
npm run coverage
|
|
53
49
|
```
|
|
54
50
|
|
|
55
|
-
|
|
56
51
|
## 🙆🏼♂️ Copyright and license
|
|
57
52
|
|
|
58
53
|
Copyright (c) Sebastian Pekarek under the [MIT license](LICENSE).
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var l=(i,e)=>{for(var r in e)a(i,r,{get:e[r],enumerable:!0})},m=(i,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of g(e))!u.call(i,n)&&n!==r&&a(i,n,{get:()=>e[n],enumerable:!(t=p(e,n))||t.enumerable});return i};var c=i=>m(a({},"__esModule",{value:!0}),i);var y={};l(y,{GenderizeGender:()=>o,default:()=>s});module.exports=c(y);var o=(r=>(r.FEMALE="female",r.MALE="male",r))(o||{}),s=class i{get limit(){if(this.latestHeaders){let e=i.getIntHeader(this.latestHeaders[0].get("x-rate-limit-limit")),r=i.getIntHeader(this.latestHeaders[0].get("x-rate-limit-remaining")),t=i.getIntHeader(this.latestHeaders[0].get("x-rate-limit-reset"));if(e!==void 0&&r!==void 0&&t!==void 0)return{limit:e,remaining:r,reset:new Date(this.latestHeaders[1].getTime()+t*1e3)}}return null}apiKey;latestHeaders=null;constructor(e){this.apiKey=e}static getIntHeader(e){if(Array.isArray(e))return this.getIntHeader(e[0]);if(e!=null)return parseInt(e)}params(e,r){let t=new URLSearchParams;if(Array.isArray(e)&&e.length>10)throw new Error(`Too many names given: ${e.length} names provided, but 10 is the maximum allowed`);if(Array.isArray(e)&&e.length===0)throw new Error("No name given, but at least one is required");return Array.isArray(e)?e.forEach(n=>t.append("name",n)):t.append("name",e),r&&t.append("country_id",r),this.apiKey&&t.append("apikey",this.apiKey),Array.isArray(e)?t.toString().replace(/name=/g,"name[]="):t.toString()}async predict(e,r){let t=new URLSearchParams(this.params(e,r)),n=await fetch("https://api.genderize.io/?"+t,{headers:{"Content-Type":"application/json"}});if(!n.ok)throw new Error(`Unable to query genderize.io: ${await n.text()}`);let d=await n.json();return this.latestHeaders=[n.headers,new Date],d}};0&&(module.exports={GenderizeGender});
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/index.ts"],"sourcesContent":["/**\n * Enum that can be used to compare and check the results\n */\nexport enum GenderizeGender {\n FEMALE = 'female',\n MALE = 'male',\n}\n\nexport interface GenderizeLimit {\n /**\n * The amount of names available in the current time window\n */\n limit: number;\n\n /**\n * The number of names left in the current time window\n */\n remaining: number;\n\n /**\n * Next time window start time\n *\n * ```javascript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n *\n * // execute a predicition\n *\n * genderize.limit?.reset.toString()\n * ```\n */\n reset: Date;\n}\nexport interface GenderizeResponse {\n /**\n * The number of data rows examined in order\n * to calculate the API response\n */\n count: number;\n\n /**\n * Either a [[`GenderizeGender`]] value (male/female) or null\n * if the API was not able to predict a gender.\n */\n gender: GenderizeGender | null;\n\n /**\n * Name which was used for this prediction\n */\n name: string;\n\n /**\n * Value between 0 and 1 (including)\n */\n probability: number;\n}\n\nexport interface GenderizeResponseWithCountry extends GenderizeResponse {\n /**\n * ISO 3166-1 alpha-2 country code which was used for this prediction\n */\n country_id: string;\n}\n\nexport default class Genderize {\n /**\n * Outputs information about the current state of the rate limit. Updated and cached\n * each time [[`predict`]] is called. If no information is available, for example because\n * [[`predict`]] has not been executed yet, `null` is returned. Otherwise the response is\n * of type [[`GenderizeLimit`]].\n */\n get limit(): GenderizeLimit | null {\n if (this.latestHeaders) {\n const limit = Genderize.getIntHeader(\n this.latestHeaders[0].get('x-rate-limit-limit'),\n );\n const remaining = Genderize.getIntHeader(\n this.latestHeaders[0].get('x-rate-limit-remaining'),\n );\n const reset = Genderize.getIntHeader(\n this.latestHeaders[0].get('x-rate-limit-reset'),\n );\n\n if (\n limit !== undefined &&\n remaining !== undefined &&\n reset !== undefined\n ) {\n return {\n limit,\n remaining,\n reset: new Date(\n this.latestHeaders[1].getTime() + reset * 1000,\n ),\n };\n }\n }\n\n return null;\n }\n private readonly apiKey;\n\n private latestHeaders: [Headers, Date] | null = null;\n\n /**\n * Usually you get an `Genderize` instance like this:\n * ```javascript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * ```\n *\n * You can get an API key from [store.genderize.io](https://store.genderize.io/).\n *\n * If you don't have an API key yet, you can start with the free plan:\n * ```javascript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize();\n * ```\n */\n constructor(apiKey?: string) {\n this.apiKey = apiKey;\n }\n\n /**\n * @internal\n */\n static getIntHeader(\n value: null | string | string[] | undefined,\n ): number | undefined {\n if (Array.isArray(value)) {\n return this.getIntHeader(value[0]);\n }\n\n if (value === undefined || value === null) {\n return undefined;\n }\n\n return parseInt(value);\n }\n\n /**\n * Internal function which builds the url parameters\n * used to query the prediction endpoint.\n *\n * @internal\n */\n params(names: string | string[], country?: string): string {\n const searchParams = new URLSearchParams();\n if (Array.isArray(names) && names.length > 10) {\n throw new Error(\n `Too many names given: ${names.length} names provided, but 10 is the maximum allowed`,\n );\n }\n if (Array.isArray(names) && names.length === 0) {\n throw new Error('No name given, but at least one is required');\n }\n\n if (Array.isArray(names)) {\n names.forEach((name) => searchParams.append('name', name));\n } else {\n searchParams.append('name', names);\n }\n\n if (country) {\n searchParams.append('country_id', country);\n }\n\n if (this.apiKey) {\n searchParams.append('apikey', this.apiKey);\n }\n if (Array.isArray(names)) {\n return searchParams.toString().replace(/name=/g, 'name[]=');\n }\n\n return searchParams.toString();\n }\n\n /**\n * Predict a single name\n *\n * ```typescript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * genderize.predict('Mia').then(result => {\n * console.log(result);\n * });\n * ```\n *\n * ```json\n * {\n * name: 'Mia',\n * gender: 'female',\n * probability: 0.96,\n * count: 19266\n * }\n * ```\n */\n async predict(name: string): Promise<GenderizeResponse>;\n /**\n * Predict multiple names. Works for up to 10 names at the same time.\n *\n * Please check [this list](https://genderize.io/our-data) if you're unsure about\n * the country code you have to use.\n *\n * It is recommended to check the count of the response when using localization.\n * If the count is very low or gender is null, you can fallback to a request\n * with no localization.\n *\n * ```typescript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * genderize.predict(['Noah', 'Evelyn']).then(result => {\n * console.log(result);\n * });\n * ```\n *\n * ```json\n * [\n * { name: 'Noah', gender: 'male', probability: 0.88, count: 3939 },\n * { name: 'Evelyn', gender: 'female', probability: 0.98, count: 12188 }\n * ]\n * ```\n */\n async predict(names: string[]): Promise<GenderizeResponse[]>;\n /**\n * Predict a single name with a given ISO 3166-1 alpha-2 country code\n *\n * ```typescript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * genderize.predict('Mia', 'DE').then(result => {\n * console.log(result);\n * });\n * ```\n *\n * ```json\n * {\n * name: 'Mia',\n * gender: 'female',\n * probability: 0.97,\n * count: 1786,\n * country_id: 'DE'\n * }\n * ```\n */\n async predict(\n name: string,\n country: string,\n ): Promise<GenderizeResponseWithCountry>;\n /**\n * Predict multiple names with a given ISO 3166-1 alpha-2\n * country code. Works for up to 10 names at the same time.\n *\n * Please check [this list](https://genderize.io/our-data) if you're unsure about\n * the country code you have to use.\n *\n * It is recommended to check the count of the response when using localization.\n * If the count is very low or gender is null, you can fallback to a request\n * with no localization.\n *\n * ```typescript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * genderize.predict(['Noah', 'Evelyn'], 'DE').then(result => {\n * console.log(result);\n * });\n * ```\n *\n * ```json\n * [\n * { name: 'Noah', gender: 'male', probability: 1, count: 608, country_id: 'DE' },\n * { name: 'Evelyn', gender: 'female', probability: 0.97, count: 1665, country_id: 'DE' }\n * ]\n * ```\n */\n async predict(\n names: string[],\n country: string,\n ): Promise<GenderizeResponseWithCountry[]>;\n async predict(\n names: string | string[],\n country?: string,\n ): Promise<\n | GenderizeResponse\n | GenderizeResponse[]\n | GenderizeResponseWithCountry\n | GenderizeResponseWithCountry[]\n > {\n const queryString = new URLSearchParams(this.params(names, country));\n const response = await fetch(\n 'https://api.genderize.io/?' + queryString,\n {\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n if (!response.ok) {\n throw new Error(\n `Unable to query genderize.io: ${await response.text()}`,\n );\n }\n\n const body = (await response.json()) as\n | GenderizeResponse\n | GenderizeResponse[];\n this.latestHeaders = [response.headers, new Date()];\n return body;\n }\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAGO,IAAKE,OACRA,EAAA,OAAS,SACTA,EAAA,KAAO,OAFCA,OAAA,IA6DSC,EAArB,MAAqBE,CAAU,CAO3B,IAAI,OAA+B,CAC/B,GAAI,KAAK,cAAe,CACpB,IAAMC,EAAQD,EAAU,aACpB,KAAK,cAAc,CAAC,EAAE,IAAI,oBAAoB,CAClD,EACME,EAAYF,EAAU,aACxB,KAAK,cAAc,CAAC,EAAE,IAAI,wBAAwB,CACtD,EACMG,EAAQH,EAAU,aACpB,KAAK,cAAc,CAAC,EAAE,IAAI,oBAAoB,CAClD,EAEA,GACIC,IAAU,QACVC,IAAc,QACdC,IAAU,OAEV,MAAO,CACH,MAAAF,EACA,UAAAC,EACA,MAAO,IAAI,KACP,KAAK,cAAc,CAAC,EAAE,QAAQ,EAAIC,EAAQ,GAC9C,CACJ,CAER,CAEA,OAAO,IACX,CACiB,OAET,cAAwC,KAiBhD,YAAYC,EAAiB,CACzB,KAAK,OAASA,CAClB,CAKA,OAAO,aACHC,EACkB,CAClB,GAAI,MAAM,QAAQA,CAAK,EACnB,OAAO,KAAK,aAAaA,EAAM,CAAC,CAAC,EAGrC,GAA2BA,GAAU,KAIrC,OAAO,SAASA,CAAK,CACzB,CAQA,OAAOC,EAA0BC,EAA0B,CACvD,IAAMC,EAAe,IAAI,gBACzB,GAAI,MAAM,QAAQF,CAAK,GAAKA,EAAM,OAAS,GACvC,MAAM,IAAI,MACN,yBAAyBA,EAAM,MAAM,gDACzC,EAEJ,GAAI,MAAM,QAAQA,CAAK,GAAKA,EAAM,SAAW,EACzC,MAAM,IAAI,MAAM,6CAA6C,EAgBjE,OAbI,MAAM,QAAQA,CAAK,EACnBA,EAAM,QAASG,GAASD,EAAa,OAAO,OAAQC,CAAI,CAAC,EAEzDD,EAAa,OAAO,OAAQF,CAAK,EAGjCC,GACAC,EAAa,OAAO,aAAcD,CAAO,EAGzC,KAAK,QACLC,EAAa,OAAO,SAAU,KAAK,MAAM,EAEzC,MAAM,QAAQF,CAAK,EACZE,EAAa,SAAS,EAAE,QAAQ,SAAU,SAAS,EAGvDA,EAAa,SAAS,CACjC,CAwGA,MAAM,QACFF,EACAC,EAMF,CACE,IAAMG,EAAc,IAAI,gBAAgB,KAAK,OAAOJ,EAAOC,CAAO,CAAC,EAC7DI,EAAW,MAAM,MACnB,6BAA+BD,EAC/B,CACI,QAAS,CACL,eAAgB,kBACpB,CACJ,CACJ,EACA,GAAI,CAACC,EAAS,GACV,MAAM,IAAI,MACN,iCAAiC,MAAMA,EAAS,KAAK,CAAC,EAC1D,EAGJ,IAAMC,EAAQ,MAAMD,EAAS,KAAK,EAGlC,YAAK,cAAgB,CAACA,EAAS,QAAS,IAAI,IAAM,EAC3CC,CACX,CACJ","names":["index_exports","__export","GenderizeGender","Genderize","__toCommonJS","_Genderize","limit","remaining","reset","apiKey","value","names","country","searchParams","name","queryString","response","body"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -5,32 +5,6 @@ declare enum GenderizeGender {
|
|
|
5
5
|
FEMALE = "female",
|
|
6
6
|
MALE = "male"
|
|
7
7
|
}
|
|
8
|
-
interface GenderizeResponse {
|
|
9
|
-
/**
|
|
10
|
-
* Name which was used for this prediction
|
|
11
|
-
*/
|
|
12
|
-
name: string;
|
|
13
|
-
/**
|
|
14
|
-
* Either a [[`GenderizeGender`]] value (male/female) or null
|
|
15
|
-
* if the API was not able to predict a gender.
|
|
16
|
-
*/
|
|
17
|
-
gender: GenderizeGender | null;
|
|
18
|
-
/**
|
|
19
|
-
* Value between 0 and 1 (including)
|
|
20
|
-
*/
|
|
21
|
-
probability: number;
|
|
22
|
-
/**
|
|
23
|
-
* The number of data rows examined in order
|
|
24
|
-
* to calculate the API response
|
|
25
|
-
*/
|
|
26
|
-
count: number;
|
|
27
|
-
}
|
|
28
|
-
interface GenderizeResponseWithCountry extends GenderizeResponse {
|
|
29
|
-
/**
|
|
30
|
-
* ISO 3166-1 alpha-2 country code which was used for this prediction
|
|
31
|
-
*/
|
|
32
|
-
country_id: string;
|
|
33
|
-
}
|
|
34
8
|
interface GenderizeLimit {
|
|
35
9
|
/**
|
|
36
10
|
* The amount of names available in the current time window
|
|
@@ -54,7 +28,40 @@ interface GenderizeLimit {
|
|
|
54
28
|
*/
|
|
55
29
|
reset: Date;
|
|
56
30
|
}
|
|
31
|
+
interface GenderizeResponse {
|
|
32
|
+
/**
|
|
33
|
+
* The number of data rows examined in order
|
|
34
|
+
* to calculate the API response
|
|
35
|
+
*/
|
|
36
|
+
count: number;
|
|
37
|
+
/**
|
|
38
|
+
* Either a [[`GenderizeGender`]] value (male/female) or null
|
|
39
|
+
* if the API was not able to predict a gender.
|
|
40
|
+
*/
|
|
41
|
+
gender: GenderizeGender | null;
|
|
42
|
+
/**
|
|
43
|
+
* Name which was used for this prediction
|
|
44
|
+
*/
|
|
45
|
+
name: string;
|
|
46
|
+
/**
|
|
47
|
+
* Value between 0 and 1 (including)
|
|
48
|
+
*/
|
|
49
|
+
probability: number;
|
|
50
|
+
}
|
|
51
|
+
interface GenderizeResponseWithCountry extends GenderizeResponse {
|
|
52
|
+
/**
|
|
53
|
+
* ISO 3166-1 alpha-2 country code which was used for this prediction
|
|
54
|
+
*/
|
|
55
|
+
country_id: string;
|
|
56
|
+
}
|
|
57
57
|
declare class Genderize {
|
|
58
|
+
/**
|
|
59
|
+
* Outputs information about the current state of the rate limit. Updated and cached
|
|
60
|
+
* each time [[`predict`]] is called. If no information is available, for example because
|
|
61
|
+
* [[`predict`]] has not been executed yet, `null` is returned. Otherwise the response is
|
|
62
|
+
* of type [[`GenderizeLimit`]].
|
|
63
|
+
*/
|
|
64
|
+
get limit(): GenderizeLimit | null;
|
|
58
65
|
private readonly apiKey;
|
|
59
66
|
private latestHeaders;
|
|
60
67
|
/**
|
|
@@ -76,14 +83,7 @@ declare class Genderize {
|
|
|
76
83
|
/**
|
|
77
84
|
* @internal
|
|
78
85
|
*/
|
|
79
|
-
static getIntHeader(value: string | string[] |
|
|
80
|
-
/**
|
|
81
|
-
* Outputs information about the current state of the rate limit. Updated and cached
|
|
82
|
-
* each time [[`predict`]] is called. If no information is available, for example because
|
|
83
|
-
* [[`predict`]] has not been executed yet, `null` is returned. Otherwise the response is
|
|
84
|
-
* of type [[`GenderizeLimit`]].
|
|
85
|
-
*/
|
|
86
|
-
get limit(): GenderizeLimit | null;
|
|
86
|
+
static getIntHeader(value: null | string | string[] | undefined): number | undefined;
|
|
87
87
|
/**
|
|
88
88
|
* Internal function which builds the url parameters
|
|
89
89
|
* used to query the prediction endpoint.
|
package/dist/index.d.ts
CHANGED
|
@@ -5,32 +5,6 @@ declare enum GenderizeGender {
|
|
|
5
5
|
FEMALE = "female",
|
|
6
6
|
MALE = "male"
|
|
7
7
|
}
|
|
8
|
-
interface GenderizeResponse {
|
|
9
|
-
/**
|
|
10
|
-
* Name which was used for this prediction
|
|
11
|
-
*/
|
|
12
|
-
name: string;
|
|
13
|
-
/**
|
|
14
|
-
* Either a [[`GenderizeGender`]] value (male/female) or null
|
|
15
|
-
* if the API was not able to predict a gender.
|
|
16
|
-
*/
|
|
17
|
-
gender: GenderizeGender | null;
|
|
18
|
-
/**
|
|
19
|
-
* Value between 0 and 1 (including)
|
|
20
|
-
*/
|
|
21
|
-
probability: number;
|
|
22
|
-
/**
|
|
23
|
-
* The number of data rows examined in order
|
|
24
|
-
* to calculate the API response
|
|
25
|
-
*/
|
|
26
|
-
count: number;
|
|
27
|
-
}
|
|
28
|
-
interface GenderizeResponseWithCountry extends GenderizeResponse {
|
|
29
|
-
/**
|
|
30
|
-
* ISO 3166-1 alpha-2 country code which was used for this prediction
|
|
31
|
-
*/
|
|
32
|
-
country_id: string;
|
|
33
|
-
}
|
|
34
8
|
interface GenderizeLimit {
|
|
35
9
|
/**
|
|
36
10
|
* The amount of names available in the current time window
|
|
@@ -54,7 +28,40 @@ interface GenderizeLimit {
|
|
|
54
28
|
*/
|
|
55
29
|
reset: Date;
|
|
56
30
|
}
|
|
31
|
+
interface GenderizeResponse {
|
|
32
|
+
/**
|
|
33
|
+
* The number of data rows examined in order
|
|
34
|
+
* to calculate the API response
|
|
35
|
+
*/
|
|
36
|
+
count: number;
|
|
37
|
+
/**
|
|
38
|
+
* Either a [[`GenderizeGender`]] value (male/female) or null
|
|
39
|
+
* if the API was not able to predict a gender.
|
|
40
|
+
*/
|
|
41
|
+
gender: GenderizeGender | null;
|
|
42
|
+
/**
|
|
43
|
+
* Name which was used for this prediction
|
|
44
|
+
*/
|
|
45
|
+
name: string;
|
|
46
|
+
/**
|
|
47
|
+
* Value between 0 and 1 (including)
|
|
48
|
+
*/
|
|
49
|
+
probability: number;
|
|
50
|
+
}
|
|
51
|
+
interface GenderizeResponseWithCountry extends GenderizeResponse {
|
|
52
|
+
/**
|
|
53
|
+
* ISO 3166-1 alpha-2 country code which was used for this prediction
|
|
54
|
+
*/
|
|
55
|
+
country_id: string;
|
|
56
|
+
}
|
|
57
57
|
declare class Genderize {
|
|
58
|
+
/**
|
|
59
|
+
* Outputs information about the current state of the rate limit. Updated and cached
|
|
60
|
+
* each time [[`predict`]] is called. If no information is available, for example because
|
|
61
|
+
* [[`predict`]] has not been executed yet, `null` is returned. Otherwise the response is
|
|
62
|
+
* of type [[`GenderizeLimit`]].
|
|
63
|
+
*/
|
|
64
|
+
get limit(): GenderizeLimit | null;
|
|
58
65
|
private readonly apiKey;
|
|
59
66
|
private latestHeaders;
|
|
60
67
|
/**
|
|
@@ -76,14 +83,7 @@ declare class Genderize {
|
|
|
76
83
|
/**
|
|
77
84
|
* @internal
|
|
78
85
|
*/
|
|
79
|
-
static getIntHeader(value: string | string[] |
|
|
80
|
-
/**
|
|
81
|
-
* Outputs information about the current state of the rate limit. Updated and cached
|
|
82
|
-
* each time [[`predict`]] is called. If no information is available, for example because
|
|
83
|
-
* [[`predict`]] has not been executed yet, `null` is returned. Otherwise the response is
|
|
84
|
-
* of type [[`GenderizeLimit`]].
|
|
85
|
-
*/
|
|
86
|
-
get limit(): GenderizeLimit | null;
|
|
86
|
+
static getIntHeader(value: null | string | string[] | undefined): number | undefined;
|
|
87
87
|
/**
|
|
88
88
|
* Internal function which builds the url parameters
|
|
89
89
|
* used to query the prediction endpoint.
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var o=(t=>(t.FEMALE="female",t.MALE="male",t))(o||{}),s=class i{
|
|
1
|
+
var o=(t=>(t.FEMALE="female",t.MALE="male",t))(o||{}),s=class i{get limit(){if(this.latestHeaders){let e=i.getIntHeader(this.latestHeaders[0].get("x-rate-limit-limit")),t=i.getIntHeader(this.latestHeaders[0].get("x-rate-limit-remaining")),r=i.getIntHeader(this.latestHeaders[0].get("x-rate-limit-reset"));if(e!==void 0&&t!==void 0&&r!==void 0)return{limit:e,remaining:t,reset:new Date(this.latestHeaders[1].getTime()+r*1e3)}}return null}apiKey;latestHeaders=null;constructor(e){this.apiKey=e}static getIntHeader(e){if(Array.isArray(e))return this.getIntHeader(e[0]);if(e!=null)return parseInt(e)}params(e,t){let r=new URLSearchParams;if(Array.isArray(e)&&e.length>10)throw new Error(`Too many names given: ${e.length} names provided, but 10 is the maximum allowed`);if(Array.isArray(e)&&e.length===0)throw new Error("No name given, but at least one is required");return Array.isArray(e)?e.forEach(n=>r.append("name",n)):r.append("name",e),t&&r.append("country_id",t),this.apiKey&&r.append("apikey",this.apiKey),Array.isArray(e)?r.toString().replace(/name=/g,"name[]="):r.toString()}async predict(e,t){let r=new URLSearchParams(this.params(e,t)),n=await fetch("https://api.genderize.io/?"+r,{headers:{"Content-Type":"application/json"}});if(!n.ok)throw new Error(`Unable to query genderize.io: ${await n.text()}`);let a=await n.json();return this.latestHeaders=[n.headers,new Date],a}};export{o as GenderizeGender,s as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/index.ts"],"sourcesContent":["/**\n * Enum that can be used to compare and check the results\n */\nexport enum GenderizeGender {\n FEMALE = 'female',\n MALE = 'male'\n}\n\nexport interface GenderizeResponse {\n /**\n * Name which was used for this prediction\n */\n name: string;\n\n /**\n * Either a [[`GenderizeGender`]] value (male/female) or null\n * if the API was not able to predict a gender.\n */\n gender: GenderizeGender | null;\n\n /**\n * Value between 0 and 1 (including)\n */\n probability: number;\n\n /**\n * The number of data rows examined in order\n * to calculate the API response\n */\n count: number;\n}\nexport interface GenderizeResponseWithCountry extends GenderizeResponse {\n /**\n * ISO 3166-1 alpha-2 country code which was used for this prediction\n */\n country_id: string;\n}\n\nexport interface GenderizeLimit {\n /**\n * The amount of names available in the current time window\n */\n limit: number;\n\n /**\n * The number of names left in the current time window\n */\n remaining: number;\n\n /**\n * Next time window start time\n *\n * ```javascript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n *\n * // execute a predicition\n *\n * genderize.limit?.reset.toString()\n * ```\n */\n reset: Date;\n}\n\nexport default class Genderize {\n private readonly apiKey;\n private latestHeaders: [Headers, Date] | null = null;\n\n /**\n * Usually you get an `Genderize` instance like this:\n * ```javascript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * ```\n *\n * You can get an API key from [store.genderize.io](https://store.genderize.io/).\n *\n * If you don't have an API key yet, you can start with the free plan:\n * ```javascript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize();\n * ```\n */\n constructor(apiKey?: string) {\n this.apiKey = apiKey;\n }\n\n /**\n * @internal\n */\n static getIntHeader(value: string | string[] | null | undefined): number | undefined {\n if(Array.isArray(value)) {\n return this.getIntHeader(value[0]);\n }\n\n if(value === undefined || value === null) {\n return undefined;\n }\n\n return parseInt(value);\n }\n\n /**\n * Outputs information about the current state of the rate limit. Updated and cached\n * each time [[`predict`]] is called. If no information is available, for example because\n * [[`predict`]] has not been executed yet, `null` is returned. Otherwise the response is\n * of type [[`GenderizeLimit`]].\n */\n get limit(): GenderizeLimit | null {\n\n if (this.latestHeaders) {\n const limit = Genderize.getIntHeader(this.latestHeaders[0].get('x-rate-limit-limit'));\n const remaining = Genderize.getIntHeader(this.latestHeaders[0].get('x-rate-limit-remaining'));\n const reset = Genderize.getIntHeader(this.latestHeaders[0].get('x-rate-limit-reset'));\n\n if (limit !== undefined && remaining !== undefined && reset !== undefined) {\n return {\n limit,\n remaining,\n reset: new Date(this.latestHeaders[1].getTime() + (reset * 1000))\n };\n }\n }\n\n return null;\n }\n\n /**\n * Internal function which builds the url parameters\n * used to query the prediction endpoint.\n *\n * @internal\n */\n params(names: string | string[], country?: string): string {\n const searchParams = new URLSearchParams();\n if(Array.isArray(names) && names.length > 10) {\n throw new Error(`Too many names given: ${names.length} names provided, but 10 is the maximum allowed`);\n }\n if(Array.isArray(names) && names.length === 0) {\n throw new Error('No name given, but at least one is required');\n }\n\n if(Array.isArray(names)) {\n names.forEach(name => searchParams.append('name', name));\n } else {\n searchParams.append('name', names);\n }\n\n if(country) {\n searchParams.append('country_id', country);\n }\n\n if(this.apiKey) {\n searchParams.append('apikey', this.apiKey);\n }\n if(Array.isArray(names)) {\n return searchParams.toString()\n .replace(/name=/g, 'name[]=');\n }\n\n return searchParams.toString();\n }\n\n /**\n * Predict a single name\n *\n * ```typescript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * genderize.predict('Mia').then(result => {\n * console.log(result);\n * });\n * ```\n *\n * ```json\n * {\n * name: 'Mia',\n * gender: 'female',\n * probability: 0.96,\n * count: 19266\n * }\n * ```\n */\n async predict(name: string): Promise<GenderizeResponse>;\n\n /**\n * Predict multiple names. Works for up to 10 names at the same time.\n *\n * Please check [this list](https://genderize.io/our-data) if you're unsure about\n * the country code you have to use.\n *\n * It is recommended to check the count of the response when using localization.\n * If the count is very low or gender is null, you can fallback to a request\n * with no localization.\n *\n * ```typescript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * genderize.predict(['Noah', 'Evelyn']).then(result => {\n * console.log(result);\n * });\n * ```\n *\n * ```json\n * [\n * { name: 'Noah', gender: 'male', probability: 0.88, count: 3939 },\n * { name: 'Evelyn', gender: 'female', probability: 0.98, count: 12188 }\n * ]\n * ```\n */\n async predict(names: string[]): Promise<GenderizeResponse[]>;\n\n /**\n * Predict a single name with a given ISO 3166-1 alpha-2 country code\n *\n * ```typescript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * genderize.predict('Mia', 'DE').then(result => {\n * console.log(result);\n * });\n * ```\n *\n * ```json\n * {\n * name: 'Mia',\n * gender: 'female',\n * probability: 0.97,\n * count: 1786,\n * country_id: 'DE'\n * }\n * ```\n */\n async predict(name: string, country: string): Promise<GenderizeResponseWithCountry>;\n\n /**\n * Predict multiple names with a given ISO 3166-1 alpha-2\n * country code. Works for up to 10 names at the same time.\n *\n * Please check [this list](https://genderize.io/our-data) if you're unsure about\n * the country code you have to use.\n *\n * It is recommended to check the count of the response when using localization.\n * If the count is very low or gender is null, you can fallback to a request\n * with no localization.\n *\n * ```typescript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * genderize.predict(['Noah', 'Evelyn'], 'DE').then(result => {\n * console.log(result);\n * });\n * ```\n *\n * ```json\n * [\n * { name: 'Noah', gender: 'male', probability: 1, count: 608, country_id: 'DE' },\n * { name: 'Evelyn', gender: 'female', probability: 0.97, count: 1665, country_id: 'DE' }\n * ]\n * ```\n */\n async predict(names: string[], country: string): Promise<GenderizeResponseWithCountry[]>;\n\n async predict(names: string | string[], country?: string): Promise<GenderizeResponse | GenderizeResponse[] | GenderizeResponseWithCountry | GenderizeResponseWithCountry[]> {\n const queryString = new URLSearchParams(this.params(names, country));\n const response = await fetch('https://api.genderize.io/?' + queryString, {\n headers: {\n 'Content-Type': 'application/json'\n }\n });\n if(!response.ok) {\n throw new Error(`Unable to query genderize.io: ${await response.text()}`);\n }\n\n const body = await response.json() as GenderizeResponse | GenderizeResponse[];\n this.latestHeaders = [response.headers, new Date()];\n return body;\n }\n}\n"],"mappings":"AAGO,IAAKA,OACRA,EAAA,OAAS,SACTA,EAAA,KAAO,OAFCA,OAAA,IA6DSC,EAArB,MAAqBC,CAAU,CACV,OACT,cAAwC,KAiBhD,YAAYC,EAAiB,CACzB,KAAK,OAASA,CAClB,CAKA,OAAO,aAAaC,EAAiE,CACjF,GAAG,MAAM,QAAQA,CAAK,EAClB,OAAO,KAAK,aAAaA,EAAM,CAAC,CAAC,EAGrC,GAA0BA,GAAU,KAIpC,OAAO,SAASA,CAAK,CACzB,CAQA,IAAI,OAA+B,CAE/B,GAAI,KAAK,cAAe,CACpB,IAAMC,EAAQH,EAAU,aAAa,KAAK,cAAc,CAAC,EAAE,IAAI,oBAAoB,CAAC,EAC9EI,EAAYJ,EAAU,aAAa,KAAK,cAAc,CAAC,EAAE,IAAI,wBAAwB,CAAC,EACtFK,EAAQL,EAAU,aAAa,KAAK,cAAc,CAAC,EAAE,IAAI,oBAAoB,CAAC,EAEpF,GAAIG,IAAU,QAAaC,IAAc,QAAaC,IAAU,OAC5D,MAAO,CACH,MAAAF,EACA,UAAAC,EACA,MAAO,IAAI,KAAK,KAAK,cAAc,CAAC,EAAE,QAAQ,EAAKC,EAAQ,GAAK,CACpE,CAER,CAEA,OAAO,IACX,CAQA,OAAOC,EAA0BC,EAA0B,CACvD,IAAMC,EAAe,IAAI,gBACzB,GAAG,MAAM,QAAQF,CAAK,GAAKA,EAAM,OAAS,GACtC,MAAM,IAAI,MAAM,yBAAyBA,EAAM,MAAM,gDAAgD,EAEzG,GAAG,MAAM,QAAQA,CAAK,GAAKA,EAAM,SAAW,EACxC,MAAM,IAAI,MAAM,6CAA6C,EAgBjE,OAbG,MAAM,QAAQA,CAAK,EAClBA,EAAM,QAAQG,GAAQD,EAAa,OAAO,OAAQC,CAAI,CAAC,EAEvDD,EAAa,OAAO,OAAQF,CAAK,EAGlCC,GACCC,EAAa,OAAO,aAAcD,CAAO,EAG1C,KAAK,QACJC,EAAa,OAAO,SAAU,KAAK,MAAM,EAE1C,MAAM,QAAQF,CAAK,EACXE,EAAa,SAAS,EACxB,QAAQ,SAAU,SAAS,EAG7BA,EAAa,SAAS,CACjC,CAsGA,MAAM,QAAQF,EAA0BC,EAAoI,CACxK,IAAMG,EAAc,IAAI,gBAAgB,KAAK,OAAOJ,EAAOC,CAAO,CAAC,EAC7DI,EAAW,MAAM,MAAM,6BAA+BD,EAAa,CACrE,QAAS,CACL,eAAgB,kBACpB,CACJ,CAAC,EACD,GAAG,CAACC,EAAS,GACT,MAAM,IAAI,MAAM,iCAAiC,MAAMA,EAAS,KAAK,CAAC,EAAE,EAG5E,IAAMC,EAAO,MAAMD,EAAS,KAAK,EACjC,YAAK,cAAgB,CAACA,EAAS,QAAS,IAAI,IAAM,EAC3CC,CACX,CACJ","names":["GenderizeGender","Genderize","_Genderize","apiKey","value","limit","remaining","reset","names","country","searchParams","name","queryString","response","body"]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/index.ts"],"sourcesContent":["/**\n * Enum that can be used to compare and check the results\n */\nexport enum GenderizeGender {\n FEMALE = 'female',\n MALE = 'male',\n}\n\nexport interface GenderizeLimit {\n /**\n * The amount of names available in the current time window\n */\n limit: number;\n\n /**\n * The number of names left in the current time window\n */\n remaining: number;\n\n /**\n * Next time window start time\n *\n * ```javascript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n *\n * // execute a predicition\n *\n * genderize.limit?.reset.toString()\n * ```\n */\n reset: Date;\n}\nexport interface GenderizeResponse {\n /**\n * The number of data rows examined in order\n * to calculate the API response\n */\n count: number;\n\n /**\n * Either a [[`GenderizeGender`]] value (male/female) or null\n * if the API was not able to predict a gender.\n */\n gender: GenderizeGender | null;\n\n /**\n * Name which was used for this prediction\n */\n name: string;\n\n /**\n * Value between 0 and 1 (including)\n */\n probability: number;\n}\n\nexport interface GenderizeResponseWithCountry extends GenderizeResponse {\n /**\n * ISO 3166-1 alpha-2 country code which was used for this prediction\n */\n country_id: string;\n}\n\nexport default class Genderize {\n /**\n * Outputs information about the current state of the rate limit. Updated and cached\n * each time [[`predict`]] is called. If no information is available, for example because\n * [[`predict`]] has not been executed yet, `null` is returned. Otherwise the response is\n * of type [[`GenderizeLimit`]].\n */\n get limit(): GenderizeLimit | null {\n if (this.latestHeaders) {\n const limit = Genderize.getIntHeader(\n this.latestHeaders[0].get('x-rate-limit-limit'),\n );\n const remaining = Genderize.getIntHeader(\n this.latestHeaders[0].get('x-rate-limit-remaining'),\n );\n const reset = Genderize.getIntHeader(\n this.latestHeaders[0].get('x-rate-limit-reset'),\n );\n\n if (\n limit !== undefined &&\n remaining !== undefined &&\n reset !== undefined\n ) {\n return {\n limit,\n remaining,\n reset: new Date(\n this.latestHeaders[1].getTime() + reset * 1000,\n ),\n };\n }\n }\n\n return null;\n }\n private readonly apiKey;\n\n private latestHeaders: [Headers, Date] | null = null;\n\n /**\n * Usually you get an `Genderize` instance like this:\n * ```javascript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * ```\n *\n * You can get an API key from [store.genderize.io](https://store.genderize.io/).\n *\n * If you don't have an API key yet, you can start with the free plan:\n * ```javascript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize();\n * ```\n */\n constructor(apiKey?: string) {\n this.apiKey = apiKey;\n }\n\n /**\n * @internal\n */\n static getIntHeader(\n value: null | string | string[] | undefined,\n ): number | undefined {\n if (Array.isArray(value)) {\n return this.getIntHeader(value[0]);\n }\n\n if (value === undefined || value === null) {\n return undefined;\n }\n\n return parseInt(value);\n }\n\n /**\n * Internal function which builds the url parameters\n * used to query the prediction endpoint.\n *\n * @internal\n */\n params(names: string | string[], country?: string): string {\n const searchParams = new URLSearchParams();\n if (Array.isArray(names) && names.length > 10) {\n throw new Error(\n `Too many names given: ${names.length} names provided, but 10 is the maximum allowed`,\n );\n }\n if (Array.isArray(names) && names.length === 0) {\n throw new Error('No name given, but at least one is required');\n }\n\n if (Array.isArray(names)) {\n names.forEach((name) => searchParams.append('name', name));\n } else {\n searchParams.append('name', names);\n }\n\n if (country) {\n searchParams.append('country_id', country);\n }\n\n if (this.apiKey) {\n searchParams.append('apikey', this.apiKey);\n }\n if (Array.isArray(names)) {\n return searchParams.toString().replace(/name=/g, 'name[]=');\n }\n\n return searchParams.toString();\n }\n\n /**\n * Predict a single name\n *\n * ```typescript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * genderize.predict('Mia').then(result => {\n * console.log(result);\n * });\n * ```\n *\n * ```json\n * {\n * name: 'Mia',\n * gender: 'female',\n * probability: 0.96,\n * count: 19266\n * }\n * ```\n */\n async predict(name: string): Promise<GenderizeResponse>;\n /**\n * Predict multiple names. Works for up to 10 names at the same time.\n *\n * Please check [this list](https://genderize.io/our-data) if you're unsure about\n * the country code you have to use.\n *\n * It is recommended to check the count of the response when using localization.\n * If the count is very low or gender is null, you can fallback to a request\n * with no localization.\n *\n * ```typescript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * genderize.predict(['Noah', 'Evelyn']).then(result => {\n * console.log(result);\n * });\n * ```\n *\n * ```json\n * [\n * { name: 'Noah', gender: 'male', probability: 0.88, count: 3939 },\n * { name: 'Evelyn', gender: 'female', probability: 0.98, count: 12188 }\n * ]\n * ```\n */\n async predict(names: string[]): Promise<GenderizeResponse[]>;\n /**\n * Predict a single name with a given ISO 3166-1 alpha-2 country code\n *\n * ```typescript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * genderize.predict('Mia', 'DE').then(result => {\n * console.log(result);\n * });\n * ```\n *\n * ```json\n * {\n * name: 'Mia',\n * gender: 'female',\n * probability: 0.97,\n * count: 1786,\n * country_id: 'DE'\n * }\n * ```\n */\n async predict(\n name: string,\n country: string,\n ): Promise<GenderizeResponseWithCountry>;\n /**\n * Predict multiple names with a given ISO 3166-1 alpha-2\n * country code. Works for up to 10 names at the same time.\n *\n * Please check [this list](https://genderize.io/our-data) if you're unsure about\n * the country code you have to use.\n *\n * It is recommended to check the count of the response when using localization.\n * If the count is very low or gender is null, you can fallback to a request\n * with no localization.\n *\n * ```typescript\n * import Genderize from '@sebbo2002/genderize';\n * const genderize = new Genderize('API-KEY');\n * genderize.predict(['Noah', 'Evelyn'], 'DE').then(result => {\n * console.log(result);\n * });\n * ```\n *\n * ```json\n * [\n * { name: 'Noah', gender: 'male', probability: 1, count: 608, country_id: 'DE' },\n * { name: 'Evelyn', gender: 'female', probability: 0.97, count: 1665, country_id: 'DE' }\n * ]\n * ```\n */\n async predict(\n names: string[],\n country: string,\n ): Promise<GenderizeResponseWithCountry[]>;\n async predict(\n names: string | string[],\n country?: string,\n ): Promise<\n | GenderizeResponse\n | GenderizeResponse[]\n | GenderizeResponseWithCountry\n | GenderizeResponseWithCountry[]\n > {\n const queryString = new URLSearchParams(this.params(names, country));\n const response = await fetch(\n 'https://api.genderize.io/?' + queryString,\n {\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n if (!response.ok) {\n throw new Error(\n `Unable to query genderize.io: ${await response.text()}`,\n );\n }\n\n const body = (await response.json()) as\n | GenderizeResponse\n | GenderizeResponse[];\n this.latestHeaders = [response.headers, new Date()];\n return body;\n }\n}\n"],"mappings":"AAGO,IAAKA,OACRA,EAAA,OAAS,SACTA,EAAA,KAAO,OAFCA,OAAA,IA6DSC,EAArB,MAAqBC,CAAU,CAO3B,IAAI,OAA+B,CAC/B,GAAI,KAAK,cAAe,CACpB,IAAMC,EAAQD,EAAU,aACpB,KAAK,cAAc,CAAC,EAAE,IAAI,oBAAoB,CAClD,EACME,EAAYF,EAAU,aACxB,KAAK,cAAc,CAAC,EAAE,IAAI,wBAAwB,CACtD,EACMG,EAAQH,EAAU,aACpB,KAAK,cAAc,CAAC,EAAE,IAAI,oBAAoB,CAClD,EAEA,GACIC,IAAU,QACVC,IAAc,QACdC,IAAU,OAEV,MAAO,CACH,MAAAF,EACA,UAAAC,EACA,MAAO,IAAI,KACP,KAAK,cAAc,CAAC,EAAE,QAAQ,EAAIC,EAAQ,GAC9C,CACJ,CAER,CAEA,OAAO,IACX,CACiB,OAET,cAAwC,KAiBhD,YAAYC,EAAiB,CACzB,KAAK,OAASA,CAClB,CAKA,OAAO,aACHC,EACkB,CAClB,GAAI,MAAM,QAAQA,CAAK,EACnB,OAAO,KAAK,aAAaA,EAAM,CAAC,CAAC,EAGrC,GAA2BA,GAAU,KAIrC,OAAO,SAASA,CAAK,CACzB,CAQA,OAAOC,EAA0BC,EAA0B,CACvD,IAAMC,EAAe,IAAI,gBACzB,GAAI,MAAM,QAAQF,CAAK,GAAKA,EAAM,OAAS,GACvC,MAAM,IAAI,MACN,yBAAyBA,EAAM,MAAM,gDACzC,EAEJ,GAAI,MAAM,QAAQA,CAAK,GAAKA,EAAM,SAAW,EACzC,MAAM,IAAI,MAAM,6CAA6C,EAgBjE,OAbI,MAAM,QAAQA,CAAK,EACnBA,EAAM,QAASG,GAASD,EAAa,OAAO,OAAQC,CAAI,CAAC,EAEzDD,EAAa,OAAO,OAAQF,CAAK,EAGjCC,GACAC,EAAa,OAAO,aAAcD,CAAO,EAGzC,KAAK,QACLC,EAAa,OAAO,SAAU,KAAK,MAAM,EAEzC,MAAM,QAAQF,CAAK,EACZE,EAAa,SAAS,EAAE,QAAQ,SAAU,SAAS,EAGvDA,EAAa,SAAS,CACjC,CAwGA,MAAM,QACFF,EACAC,EAMF,CACE,IAAMG,EAAc,IAAI,gBAAgB,KAAK,OAAOJ,EAAOC,CAAO,CAAC,EAC7DI,EAAW,MAAM,MACnB,6BAA+BD,EAC/B,CACI,QAAS,CACL,eAAgB,kBACpB,CACJ,CACJ,EACA,GAAI,CAACC,EAAS,GACV,MAAM,IAAI,MACN,iCAAiC,MAAMA,EAAS,KAAK,CAAC,EAC1D,EAGJ,IAAMC,EAAQ,MAAMD,EAAS,KAAK,EAGlC,YAAK,cAAgB,CAACA,EAAS,QAAS,IAAI,IAAM,EAC3CC,CACX,CACJ","names":["GenderizeGender","Genderize","_Genderize","limit","remaining","reset","apiKey","value","names","country","searchParams","name","queryString","response","body"]}
|
package/package.json
CHANGED
|
@@ -1,60 +1,64 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
2
|
+
"author": "Sebastian Pekarek <mail@sebbo.net>",
|
|
3
|
+
"bugs": {
|
|
4
|
+
"url": "https://github.com/sebbo2002/genderize/issues"
|
|
5
|
+
},
|
|
6
|
+
"description": "genderize is a simple client for genderize.io, a gender prediction API",
|
|
7
|
+
"devDependencies": {
|
|
8
|
+
"@eslint/js": "^9.25.0",
|
|
9
|
+
"@qiwi/semantic-release-gh-pages-plugin": "^5.4.3",
|
|
10
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
11
|
+
"@semantic-release/exec": "^7.0.3",
|
|
12
|
+
"@semantic-release/git": "^10.0.1",
|
|
13
|
+
"@semantic-release/npm": "^12.0.1",
|
|
14
|
+
"@types/mocha": "^10.0.10",
|
|
15
|
+
"@types/node": "^22.14.0",
|
|
16
|
+
"c8": "^10.1.3",
|
|
17
|
+
"eslint": "^9.25.1",
|
|
18
|
+
"eslint-config-prettier": "^10.1.2",
|
|
19
|
+
"eslint-plugin-jsonc": "^2.20.0",
|
|
20
|
+
"eslint-plugin-perfectionist": "^4.12.3",
|
|
21
|
+
"esm": "^3.2.25",
|
|
22
|
+
"husky": "^9.1.7",
|
|
23
|
+
"license-checker": "^25.0.1",
|
|
24
|
+
"mocha": "^11.1.0",
|
|
25
|
+
"mochawesome": "^7.1.3",
|
|
26
|
+
"prettier": "^3.5.3",
|
|
27
|
+
"semantic-release-license": "^1.0.3",
|
|
28
|
+
"source-map-support": "^0.5.21",
|
|
29
|
+
"tsup": "^8.4.0",
|
|
30
|
+
"tsx": "^4.19.3",
|
|
31
|
+
"typedoc": "^0.28.2",
|
|
32
|
+
"typescript": "^5.8.3",
|
|
33
|
+
"typescript-eslint": "^8.31.1"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": "20 || >=22.0.0"
|
|
37
|
+
},
|
|
38
|
+
"exports": {
|
|
39
|
+
"import": "./dist/lib/index.js",
|
|
40
|
+
"require": "./dist/lib/index.cjs"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"/dist"
|
|
44
|
+
],
|
|
45
|
+
"homepage": "https://github.com/sebbo2002/genderize#readme",
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"main": "./dist/index.js",
|
|
48
|
+
"module": "./dist/index.js",
|
|
49
|
+
"name": "@sebbo2002/genderize",
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/sebbo2002/genderize.git"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsup && cp ./dist/index.d.ts ./dist/index.d.cts",
|
|
56
|
+
"build-all": "./.github/workflows/build.sh",
|
|
57
|
+
"coverage": "c8 mocha",
|
|
58
|
+
"license-check": "license-checker --production --summary",
|
|
59
|
+
"lint": "npx eslint . --fix && npx prettier . --write",
|
|
60
|
+
"test": "mocha"
|
|
61
|
+
},
|
|
62
|
+
"type": "module",
|
|
63
|
+
"version": "6.0.0"
|
|
60
64
|
}
|