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

amberalertjs

v1.1.3

Published

Simplifies the pulling of Amber Alert information.

Downloads

14

Readme

amberalertjs

A simple Node.js module for pulling Amber alerts

Example

In this example we will console.log() the circumstance of the most recent, the first alert, in KY.

const amberalertjs = require('amberalertjs');

amberalertjs.GetAlerts('KY').then((res) => {
    if(res[0]){
        amberalertjs.GetDetails(res[0].amberId).then((res) => {
            console.log(res.circumstances);
        })
    } else {
        console.log("Good news!  No active alerts.");
    }
});

Docs

amberalertjs has two functions, GetAlerts() and GetDetails(). Both have an optional timeout parameter that defaults to 10 seconds on their requests, it is measured in milliseconds.

Remember the Amber Alert API returns an object with an amberId of 0 when it cannon find the query on GetDetails().

An invalid state tag on GetAlerts() will return an empty array just like a state with no active alerts.

GetAlerts() returns a promise that when fulfilled returns an array of alert objects. GetAlerts() can take an input two-letter state code. For example: GetAlerts("KY")

Alert objects follow this schema:

{
    amberId: 99999,
    personId: 99999,
    firstName: 'First',
    midName: 'Middle',
    lastName: 'Last',
    state: 'FL',
    city: 'Miami',
    issuedFor: 'FL',
    imageUrl: '',
    alertDate: 'Jan 29, 2020 12:00:00 AM'
}

GetDetails(amberId) returns a promise that when fulfilled returns on object containing the details of an alert. It requires an amberId input.

Details objects follow this schema:

{
  amberId: 99999,
  isPreview: false,
  lastSeenState: 'FL',
  lastSeenCity: 'Miami',
  timeZone: '',
  lastSeenDate: 'Jan 28, 2020 12:00:00 AM',
  orgName: '',
  circumstances: 'UPDATE AMBER ALERT: The suspect has been found deceased but the child is still missing. UPDATE AMBER ALERT: The vehicle information and tag number has been updated.  A Florida AMBER Alert has been issued for First Last, last seen in the area of the 21900 block of Southwest 187th Avenue in Miami.The child may be in the company of First Last Sr. They may be traveling in a white Ford Passenger Van, FL tag number NOTR3AL. If located, DO NOT APPROACH. Contact law enforcement immediately. #FLAMBER.',
  contactOrg: 'Miami-Dade Police Department',
  contactPhone: '555-555-5555',
  personList: [
    {
      amberId: 0,
      personId: 99999,
      personType: 'MissingChild',
      firstName: 'First',
      middleName: 'Middle',
      lastName: 'Last',
      suffix: '',
      monikerName: '',
      gender: 'Male',
      eyeColor: 'Black',
      hairColor: 'Bald',
      skinColor: 'White-Hispanic',
      height: `0'20"`,
      weight: '7 lbs',
      pictureFormat: '',
      imageUrl: 'https://amberimages.ncmec.org/99999/p60939.jpg',
      externalPictureImageHeight: 0,
      externalPictureImageWidth: 0,
      pictureDescription: '',
      description: '',
      age: '1 week',
      newPerson: 1,
      hasPicture: true,
      fullName: 'First Last'
    },
    {
      amberId: 0,
      personId: 55555,
      personType: 'SuspectPerson',
      firstName: 'First',
      middleName: 'Middle',
      lastName: 'Last',
      suffix: 'Sr(or Sr. I do not know)',
      monikerName: '',
      gender: 'Male',
      eyeColor: 'Brown',
      hairColor: 'Black',
      skinColor: 'White-Hispanic',
      height: `5'7"`,
      weight: '240 lbs',
      pictureFormat: '',
      imageUrl: 'https://amberimages.ncmec.org/99999/p60940.jpg',
      externalPictureImageHeight: 0,
      externalPictureImageWidth: 0,
      pictureDescription: '',
      description: '',
      age: '49 years',
      newPerson: 1,
      vehicleList:[
          {
            vehicleId:5555,
            personId:0,
            amberId:0,
            make:"GMC",
            model:"Yukon",
            modelYear:"",
            style:"SUV",
            colorPrimary:"Maroon",
            colorSecondary:"",
            colorInterior:"",
            licensePlateText:"",
            licensePlateState:"",
            vehicleDescription:"Unknown license plate.",
            newVehicle:0
        }
    ]
      hasPicture: true,
      fullName: 'First Last'
    }
  ],
  vehicleList: [],
  targetList: [ 'Florida: Statewide' ],
  messageList: [],
  missingFrom: 'Miami, FL',
  missingDate: '01/28/2020 12:00 AM '
}

Keep in mind for both of these the format of the string information is fairly inconsistent. For example, age occasionally includes the words "years" or "months".