Socket
Socket
Sign inDemoInstall

gender-detection-from-name

Package Overview
Dependencies
0
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.1.0

4

index.js

@@ -22,4 +22,4 @@ const enMap = require('./names/en')

}
// Use the Map of input language
const mapToUse = maps[lang]
// Use the Map of input language, or use all
const mapToUse = maps[lang] || maps.all
// Get the gender from the input language Map, or try with all, otherwise is unknown

@@ -26,0 +26,0 @@ const result = mapToUse.get(name) || maps.all.get(name) || 'unknown'

{
"name": "gender-detection-from-name",
"version": "1.0.1",
"version": "1.1.0",
"description": "Gender detection from first name",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -29,2 +29,14 @@ const assert = require('assert')

})
it('should return male for some names with wrong language', () => {
const names = ['Dave', 'John', 'Giacomo', 'George', 'Luca']
for (let name of names) {
assert.strictEqual(getGender(name, 'de'), 'male')
}
})
it('should return female for some names with wrong language', () => {
const names = ['Anna', 'Jennifer', 'Lisa', 'Marta', 'Catherine']
for (let name of names) {
assert.strictEqual(getGender(name, 'de'), 'female')
}
})
it('should return male for some names with no language', () => {

@@ -31,0 +43,0 @@ const names = ['Dave', 'John', 'Giacomo', 'George', 'Luca']

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc