Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
@venditan/address-lookup
Advanced tools
Venditan Google Places API solution for handling address/postcode lookup
Weekly downloads
Readme
Google Places API solution for handling address/postcode lookup
This package has the following features:
Venditan Address Lookup jQuery plugin was written so it will do a lot of the heavy lifting for you.
$('#autocomplete').addressLookup();
Note: it is important to ensure the element it is called against is an input element or Google Places API will throw an error in your console.
The snippet above is enough to get the address lookup working, but you will want to view jquery.address-lookup.js
as it provides optional settings that we do override:
$('#autocomplete').addressLookup({
callback: function() {},
excludeTerms: [],
fields: [],
logLookup: true,
logURL: '/log_address_lookup',
postLog: function() {},
logData: {},
logPostVariable: 'postcode',
restrictions: {},
types: []
});
The full list of hooks are:
callback
- allows you to call a function to populate the place detail returnedpostLog
- if you wish to do something once we have logged the lookup with VCThe following settings are also available:
excludeTerms
- array of address line contents to cleanse from the addressfields
- sets the fields for the API to return with the Places Detail request API Reference and FieldslogLookup
- set whether to log the lookup with VC or notlogURL
- set the URL to post to so that VC can log the lookup requestlogPostVariable
- set the parameter name to use in the post request when logging the usagelogData
- set additional parameters, that you would like to pass to logURL
restrictions
- sets the restrictions for the API results, for example, limit to a country API Reference and Restrictionstypes
- sets the type of data to return, by default it will return residential and businesses API Reference and TypesWithin your callback function you will want to access the Place Detail object so you can populate your form with the address information.
To do this you need to simply do the following:
var obj_place = $('#autocomplete').addressLookup('get', 'place');
This will allow you to access the fields you requested in the following manner:
obj_place.address_components
- the address line object
obj_place.types
- the type(s) of the address returned based on the request performed, such as establishment
, street_address
, postal_code
, etc.
establishment
or adding a house number/name field if it was a postal_code
request.obj_place.name
- the name of the address returned
establishment
.FAQs
Venditan Google Places API solution for handling address/postcode lookup
The npm package @venditan/address-lookup receives a total of 35 weekly downloads. As such, @venditan/address-lookup popularity was classified as not popular.
We found that @venditan/address-lookup demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.