Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

infer-gender

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

infer-gender - npm Package Compare versions

Comparing version 1.2.2 to 1.3.0

bin/cli.js

34

index.js

@@ -14,13 +14,22 @@ const fs = require('fs')

const names = {}
for (const name of load(MALE)) {
names[name] = MALE
}
let names
for (const name of load(FEMALE)) {
names[name] = name in names ? UNISEX : FEMALE
exports.initialize = () => {
names = {}
for (const name of load(MALE)) {
names[name] = MALE
}
for (const name of load(FEMALE)) {
names[name] = name in names ? UNISEX : FEMALE
}
}
exports.extractName = (fullName, onlyFirst = false) => (
removeDiacritics(fullName)
exports.extractName = (fullName, onlyFirst = false) => {
if (!names) {
// If not manually initialized, load in-demand
exports.initialize()
}
return removeDiacritics(fullName)
.toLowerCase()

@@ -31,6 +40,7 @@ .replace(/[^a-z-абвгдезиклмнопрстэюяабвгдеийклмнопрстуфхчьяё ]+/g, '')

.find(name => name in names || onlyFirst)
)
}
exports.infer = (fullName, onlyFirst = false) => (
names[exports.extractName(fullName, onlyFirst)] || UNKNOWN
)
exports.infer = (fullName, onlyFirst = false) => {
const name = exports.extractName(fullName, onlyFirst)
return names[name] || UNKNOWN
}
{
"name": "infer-gender",
"version": "1.2.2",
"version": "1.3.0",
"description": "Infer the gender of a name based on a large list of names, case insensitive and removes diacritics",

@@ -9,6 +9,14 @@ "scripts": {

"test": "mocha",
"precommit": "npm run lint && npm run test"
"precommit": "npm run lint && npm run test",
"cli": "./bin/cli.js"
},
"bin": {
"infer-gender": "./bin/cli.js"
},
"main": "./index.js",
"author": "Ariel Flesler <aflesler@gmail.com>",
"author": {
"name": "Ariel Flesler",
"email": "aflesler@gmail.com",
"url": "https://github.com/flesler"
},
"dependencies": {

@@ -22,8 +30,15 @@ "diacritics": "^1.3.0"

"husky": "^0.14.3",
"mocha": "^5.2.0",
"nodemon": "^1.18.7"
"mocha": "^8.1.3",
"nodemon": "^2.0.4"
},
"engines": {
"node": "^8.0.0"
}
"node": ">=8.0.0"
},
"homepage": "https://github.com/flesler/infer-gender",
"bugs": "https://github.com/flesler/infer-gender/issues",
"repository": {
"type": "git",
"url": "https://github.com/flesler/infer-gender.git"
},
"license": "SEE LICENSE IN LICENSE.md"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc