How to differentiate between an areacode and the actual phone number

I was wondering is there a package or some way to differentiate between areacode and actual phone number in javascript/react?

For example:

"+16471234567" => "+1" "6741234567"
"+44 1234567890" => "+44" "1234567890"

Any help woudl be appreciated