Code Monkey home page Code Monkey logo

full-name-parser's Introduction

Full Name Parser

Parsing and deconstructing names into their individual chunks

This is a simple name parser, that will deconstruct a name into its individual components of prefix, first, middle, initials, infix, last and suffix. If something doesn't exist, it will be returned as null. It uses a pre-defined list of common prefixes, infixes and suffixes.
This library assumes people start with their first name and end with their last name and not the other way around.

Installation and usage instructions

First you must install the package into your repository.

yarn add @braweria/full-name-parser
# or
npm i @braweria/full-name-parser

After you have installed it successfully in your app, you're ready to start using it. All you have to do is to import the parseName function into your module.

import { parseName } from "@braweria/full-name-parser";

And then call the function with the name you want to be parsed and deconstructed into components.

const parsedName = parseName("Prof. Steph Alice von Wolfenstein, III");

This will result in the following output:

{
  "prefix": "Prof.",
  "first": "Steph",
  "middle": "Alice",
  "initials": null,
  "infix": "von",
  "last": "Wolfenstein",
  "suffix": "III",
  "full": "Prof. Steph Alice von Wolfenstein"
}

Contribution

Contributors are welcome! When contributing, make sure your Pull Request is documented on what it fixes and, if it applies, which issue it is tackling.

Fork the repository and create a new, descriptive, branch with all your fixes and features. Fixes are prefixed with fix/, while features are prefixed with feat/.

Also make sure to test your code, before submitting.

yarn test
# or
npm run test

Check out what issues and feature requests there are on the issues page.

License

MIT

Donations

You liked my package? How about buying me a drink? :)

ko-fi

full-name-parser's People

Contributors

wiktoriavh avatar

Watchers

 avatar

full-name-parser's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.