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

@kpopfan4life/chemical-number-validification-identification

v1.0.1

Published

A series of functions to determine a chemical number, as well as if it is formatted and valid

Downloads

13

Readme

chemical-number-identifier

A series of functions that allow you to identify chemical regulation numbers, if they are formatted correctly and if they are valid.

Installing and Using the Package

    npm i @kpopfan4life/chemical-number-validification-identification
import identifyChemicalNumber, { identifyChemicalNumbers } from 'kpopfan4life/chemical-number-identifier'

const example = identifyChemicalNumber('KE-12345')
const example2 = identifyChemicalNumbers(['KE-12345, 123-456-7'])

Numbers that are able to be identified

  1. CAS Registry Number
  2. EC (European Community)
  3. KECL Annex 1 (Korean Existing Chemicals List)
  4. KECL Annex 2 (Korean Existing Chemicals List)

If you would like more being added, please add an issue with any relevant details, format of the number, name and example numbers. They will be added in due course

Return Messages

I have tried to keep the return types similar to allow easier use. All functions return an object, with the ones that both check format and validity returning a few extra bits of information. All objects contain the following.

{
    success: boolean,
    message: string,
    originalInput: string,
}

The functions that both check format and validity return the following:

{
    success: boolean,
    message: string,
    originalInput: string,
    type: string, //what regulation it belongs to
    error: boolean, // default false
    formatted: boolean, // if the number is not formatted correctly, default false
    valid: boolean, // if the number is formatted correctly, but is not a valid number default false
}

Why I made this Project

I made this with knowledge I learnt from work, to show that I am learning Node/JS well, as well as benefit anyone who may work in chemical regulations or has an interest in these kind of things. Something to show that I've progressed at least somewhat.

Baseline

I had made a NPM package many months ago, it was terrible, it had no tests, no documentation no linting or standards and I was basically very new to JS. I'd progressed a lot with Node.js since then.

Purpose

To show new skills learnt, better practises and testing.

Goals

To show new skills, allow people with use for chemical regulations/identifying them a package that may help with workflows. Show a better understanding of unit testing.

Challenges

Developing this did become quite monotonous, due to basically writing the same function, testing dragged me down. However, I got through this by breaking each one down, and taking them one day at a time.

Future updates

I may transition this into TypeScript, however, not much is going to change, you guys won't see any change, so I think with this one for now it will stay vanilla JS, unless I see enough requests for it.

I will add more functions that you request, but please try to keep them to identifying the numbers. There is scope for others depending on time I can devote to this project.