3.1.2 • Published 7 years ago

what-gender v3.1.2

Weekly downloads
2
License
ISC
Repository
-
Last release
7 years ago

Gender API

Guessing the name based on the first name. You can pass it one name or an array to up to 100 names, if you try pass more you'll get the error back.

Multiple names use

var gender = require('what-gender');

gender(['mike', 'joe', 'donald'], function(err, result) {
		if(err) console.log('this is error', err)
		console.log(result) 

});

Response will look like this: Array of objects

[
	{"name":"Anna","gender":"female","samples":211,"accuracy":97},
	{"name":"Jack","gender":"male","samples":105,"accuracy":100},
	{"name":"Stephen","gender":"male","samples":48,"accuracy":100}
]

Single name Use

gender('mike', {key: EUU123Af}, function(err, result) {
		console.log(result) 
		// {"name":"diana","gender":"female","samples":36,"accuracy":100,"duration":"41ms"} 
})

Pass up to 3 arguments:

  1. List of names, or single string of name
  2. Optional Object with options
  3. Callback function

Options (object) OPTIONAL

You can add couple of options, so results could be more accurate.

  • key: This is your private api key you can get here and 500 free names with the key
  • ip: you can pass IP and country will be auto determined
  • country: this is actually standard country code ISO 3166-1 ex: (US, NL, DE)
  • language: based on browser locale language (en-US, de-DE)

Request will be returned as:

{"name":"John","country":"US","gender":"male","samples":4,"accuracy":100,"duration":"38ms"} //Country: US
{"name":"Tanja","country":"DE","gender":"female","samples":10,"accuracy":100,"duration":"36ms"} //Country: Germany.
{"name":"Thomas","country":"DE","gender":"male","samples":13,"accuracy":100,"duration":"39ms"} //Country: Based on the browser language.

Additional Notes:

Keep in mind this is commercial API, and you get only 50 names per month, WITHOUT the key, if you register account and get your key you are bumping that to 500 names, not requests but names.

Made with support from vanila.io, probably one of the best places to code your dream app.