
Product
A New Overview in our Dashboard
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
@ken-all/kenall
Advanced tools
kenall-js is a JavaScript client library for KEN ALL, Japan postal code to address translation API service.
API document is here.
There are two options to use kenall-js in your project. The one is to put a <script>
tag referring to the script bundle somewhere atop of your HTML file to invoke the API from within your script, and the other is to specify kenall
package as a dependency in your Node.js project's package.json.
[!NOTE] As of v2.0.0, Internet Explorer is no longer supported.
All you need is put a <script>
tag that refers to the script bundle as follows:
<script type="text/javascript" src="LOCATION-TO-THE-SCRIPT-BUNDLE"></script>
This adds a property kenall
to the global window
object, from which you can refer to KENALL
constructor to create the object that works as the interface. Look at the following example to see what it goes like.
Note that you need to upload the script bundle beforehand somewhere accessible from the browser.
<script type="text/javascript">
function fill(form) {
// You can obtain the API key from the dashboard at kenall.jp/home
const k = new kenall.KENALL('API_KEY');
const postalCode = form.elements["postalcode"].value;
k.getAddress(postalCode).then(
function (address) {
const firstCandidate = address.data[0];
form.elements["prefecture"].value = firstCandidate["prefecture"];
}
).catch(function () {
alert("Failed to invoke the API");
});
}
</script>
The script bundle can be downloaded at the release page.
Alternatively, you can use the following URL for the latest bundle. Beware that we don't provide any warranty on its availability, though we'll put as much effort as possible for keeping it up.
Previous versions:
Run
$ npm i @ken-all/kenall
to add kenall.js as a dependency for your project.
Then you can use it like the following:
const { KENALL } = require('@ken-all/kenall');
// You can obtain the API key from the dashboard at kenall.jp/home
const api = new KENALL('API_KEY');
api.getAddress(postalCode).then(
r => {
console.log(r);
}
).catch(
e => {
console.error(e);
}
);
or either in TypeScript,
import { KENALL } from '@ken-all/kenall';
const kenall = new KENALL('API_KEY');
const r = await kenall.getAddress(postalCode);
console.log(r);
Run
$ npm run build
to generate JavaScript scripts under dist/
. If you want to get the bundle, run
$ npm run bundle
and you'll find one under dist/
.
$ npm run test
FAQs
KENALL JavaScript SDK
The npm package @ken-all/kenall receives a total of 3,962 weekly downloads. As such, @ken-all/kenall popularity was classified as popular.
We found that @ken-all/kenall demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.