@sebbo2002/genderize - v5.0.2-develop.10
    Preparing search index...

    Class default

    Index

    Constructors

    Accessors

    Methods

    Constructors

    • Usually you get an Genderize instance like this:

      import Genderize from '@sebbo2002/genderize';
      const genderize = new Genderize('API-KEY');

      You can get an API key from store.genderize.io.

      If you don't have an API key yet, you can start with the free plan:

      import Genderize from '@sebbo2002/genderize';
      const genderize = new Genderize();

      Parameters

      • OptionalapiKey: string

      Returns default

    Accessors

    • get limit(): null | GenderizeLimit

      Outputs information about the current state of the rate limit. Updated and cached each time [[predict]] is called. If no information is available, for example because [[predict]] has not been executed yet, null is returned. Otherwise the response is of type [[GenderizeLimit]].

      Returns null | GenderizeLimit

    Methods

    • Predict a single name

      import Genderize from '@sebbo2002/genderize';
      const genderize = new Genderize('API-KEY');
      genderize.predict('Mia').then(result => {
      console.log(result);
      });
      {
      name: 'Mia',
      gender: 'female',
      probability: 0.96,
      count: 19266
      }

      Parameters

      • name: string

      Returns Promise<GenderizeResponse>

    • Predict multiple names. Works for up to 10 names at the same time.

      Please check this list if you're unsure about the country code you have to use.

      It is recommended to check the count of the response when using localization. If the count is very low or gender is null, you can fallback to a request with no localization.

      import Genderize from '@sebbo2002/genderize';
      const genderize = new Genderize('API-KEY');
      genderize.predict(['Noah', 'Evelyn']).then(result => {
      console.log(result);
      });
      [
      { name: 'Noah', gender: 'male', probability: 0.88, count: 3939 },
      { name: 'Evelyn', gender: 'female', probability: 0.98, count: 12188 }
      ]

      Parameters

      • names: string[]

      Returns Promise<GenderizeResponse[]>

    • Predict a single name with a given ISO 3166-1 alpha-2 country code

      import Genderize from '@sebbo2002/genderize';
      const genderize = new Genderize('API-KEY');
      genderize.predict('Mia', 'DE').then(result => {
      console.log(result);
      });
      {
      name: 'Mia',
      gender: 'female',
      probability: 0.97,
      count: 1786,
      country_id: 'DE'
      }

      Parameters

      • name: string
      • country: string

      Returns Promise<GenderizeResponseWithCountry>

    • Predict multiple names with a given ISO 3166-1 alpha-2 country code. Works for up to 10 names at the same time.

      Please check this list if you're unsure about the country code you have to use.

      It is recommended to check the count of the response when using localization. If the count is very low or gender is null, you can fallback to a request with no localization.

      import Genderize from '@sebbo2002/genderize';
      const genderize = new Genderize('API-KEY');
      genderize.predict(['Noah', 'Evelyn'], 'DE').then(result => {
      console.log(result);
      });
      [
      { name: 'Noah', gender: 'male', probability: 1, count: 608, country_id: 'DE' },
      { name: 'Evelyn', gender: 'female', probability: 0.97, count: 1665, country_id: 'DE' }
      ]

      Parameters

      • names: string[]
      • country: string

      Returns Promise<GenderizeResponseWithCountry[]>