You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

firststreet-js

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

firststreet-js

"A Javascript API Client for the First Street Foundation API"

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
1
-50%
Maintainers
2
Weekly downloads
 
Created
Source

First Street JavaScript Client

CircleCI codecov

This is the official implementation of the First Street Foundation API in JavaScript.

For more in-depth guides, usage and API access, please see the documentation at docs.firststreet.dev.

Installation

First install firststreet-js:

npm install firststreet-js

Next, import it into your project

import FirstStreet from 'firststreet-js';

// Or commonjs
const FirstStreet = require('firststreet-js');

Documentation

In order to use the First Street Foundation API, you must register for an API key at https://firststreet.dev.

Intializing Client

// Create a new First Street Foundation API Client
const fs = new FirstStreet("api-key");

Using the client

The client supports querying Firststreet API endpoints corresponding to documentation, extensive examples can be found in ./tests directory.

Generally, for endpoints that require location and fsid, first need to initialize lookup object as in below example, and then use it for querying the data:

    const fs = new FirstStreet(apiKey);
    const lookup = fs.lookup('city', { fsid: 4808860 });
    const probability = await lookup.probability('count');

For endpoints that do not use fsid, please pass the parameter(s) directly to the endpoint call, as in this example:

    const fs = new FirstStreet(apiKey);
    const historic = await fs.historic('event', { id: 12 });

Similarly, if endpoint accepts other parameters in addition to location lookup, then these can be passed to the endpoint call directly:

    const fs = new FirstStreet(apiKey);
    const lookup = fs.lookup('property', { fsid: 4801470191 });
    const aal = await lookup.economic('aal', { basement: true, floorElevation: 122, depth: 100 });

Errors

Errors from the API and network errors are propagated to caller.

Keywords

firststreet

FAQs

Package last updated on 17 May 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.