npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@k-int/address-utils

v1.1.0

Published

Utility files for building location-specific address forms

Downloads

14

Readme

address-utils

This is a set of functions and components designed to work across many address-plugins. For the most part you shouldn't need to actually access any of these, but they're listed here for posterity.

Generic information

For the generic information about how these plugins operate, please see here. (I'd HIGHLY recommend starting there rather than trying to jump in blind here).

Functions

This set address-utils currently comprises of 2 functions and a component:

  • getExistingLineField
  • deleteFieldIfExists
  • AddressTextField

We'll go over these one by one.

getExistingLineField

This function accepts an array of lines (see the general documentation for more information about what those are) and a string containing the lowercase name of the field you're working on. Those follow the names set out by the general documentation, e.g. "premise".

This function simply parses the array of lines, and returns the one whose line.type?.value matches the field string, or null if none exist.

(This is NOT set up to allow multiple lines of the same type. This function will just return the first one it finds. See the general docs for more information.)

deleteFieldIfExists

This function accepts the same props as getExistingLineField above. It calls getExistingLineField in order to find the id of the saved line, and then returns an object {id: "some_id", _delete:true} In our backend setup this will delete the line saved with that id, but this may not be universal, and so you may need to write code to mimic this functionality for your backend model wherever it is used.

AddressTextField

This is a simple component which just returns a final-form Field with the props passed to it and parse={v => v}, which is simply there to allow "empty" inputs such as " " to be submitted. This component accepts props handed to it directly from AddressFields from each plugin. See the general documentation for the props expected by that component, as they are simply passed through to here.

Release Procedure

  • Check CHANGELOG.md
  • Check correct version in package.json
  • Check everything
  • Re-Check everything
  • Make preparatory commit
  • Tag - git tag -a vn.n.n -m "Tagged version n.n.n"
  • git push origin vn.n.n (Or your preferred variant)
  • Jenkins does it's magic causing release artefacts to appear in nexus
  • Update the version in package.json and open the new version in CHANGELOG.md