Skip to content

Commit 93202c5

Browse files
committed
docs(Runkit): Update runkit example with new API
1 parent a558258 commit 93202c5

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

example.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
const Postcode = require("postcode");
1+
const { parse, isValid, toOutcode } = require("postcode");
22

3-
const postcode = new Postcode("ec1v9lb");
3+
// Quickly sanity check postcode
4+
console.log(isValid("SW1A 2AA"));
45

5-
postcode.valid();
6-
postcode.normalise();
6+
// Extract outward code
7+
console.log(toOutcode("SW1A 2AA"));
78

8-
postcode.outcode();
9-
postcode.incode();
10-
postcode.area();
11-
postcode.district();
12-
postcode.subDistrict();
13-
postcode.sector();
14-
postcode.unit();
9+
// Parse postcode to access different parts
10+
const postcode = parse("Sw1a 2AA");

0 commit comments

Comments
 (0)