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 🙏

© 2026 – Pkg Stats / Ryan Hefner

airship-nodejs

v1.1.8

Published

SDK for Airship

Downloads

12

Readme

Airship Node.js

Installation

npm install --save airship-nodejs

Usage

import Airship from "airship-nodejs"

// Create an instance with apiKey and envKey
let airship = new Airship({apiKey: <apiKey>, envKey: <envKey>})
// Should be used as a singleton

// e.g.,
// let airship = new Airship({apiKey: "r9b72kqdh1wbzkpkf7gntwfapqoc26bl", envKey: "nxmqp35umrd3djth"})

// Initialize the instance, returns a Promise.
airship.init()

// Define your object
let object = {
  type: "User", // "type" starts with a capital letter "[U]ser", "[H]ome", "[C]ar". If omitted, it will default to "User"
  id: "1234", // "id" must be a string or integer
  displayName: "[email protected]" // must be a string. If omitted, the SDK will use the same value as "id" (converted to a string)
}

// The most compact form can be:
let object = {
  id: 1234
}
// as this will translate into:
let object = {
  type: "User",
  id: "1234",
  displayName: "1234"
}

airship.isEnabled("bitcoin-pay", object) // Does the object have the feature "bitcoin-pay"?
airship.getVariation("bitcoin-pay", object) // Get the variation associated with a multi-variate flag
airship.isEligible("bitcoin-pay", object)
// Returns true if the object can potentially receive the feature via sampling
// or is already receiving the feature.

// Note: It may take up to a minute for objects gated to show up on our web app.

Attributes (for complex targeting)

// Define your object with an attributes dictionary of key-value pairs.
// Values must be a string, a number, or a boolean. null values are not accepted.
// For date or datetime string value, use iso8601 format.
let object = {
  type: "User",
  id: "1234",
  displayName: "[email protected]",
  attributes: {
    tShirtSize: "M",
    dateCreated: "2018-02-18",
    timeConverted: "2018-02-20T21:54:00.630815+00:00",
    ownsProperty: true,
    age: 39
  }
}

// Now in app.airshiphq.com, you can target this particular user using its
// attributes

Group (for membership-like cascading behavior)

// An object can be a member of a group.
// The structure of a group object is just like that of the base object.
let object = {
  type: "User",
  id: "1234",
  displayName: "[email protected]",
  attributes: {
    tShirtSize: "M",
    dateCreated: "2018-02-18",
    timeConverted: "2018-02-20T21:54:00.630815+00:00",
    ownsProperty: true,
    age: 39
  },
  group: {
    type: "Club",
    id: "5678",
    displayName: "SF Homeowners Club",
    attributes: {
      founded: "2016-01-01",
      active: true
    }
  }
}

// Inheritance of values `isEnabled`, `getVariation`, and `isEligible` works as follows:
// 1. If the group is enabled, but the base object is not,
//    then the base object will inherit the values `isEnabled`, `getVariation`, and
//    `isEligible` of the group object.
// 2. If the base object is explicitly blacklisted, then it will not inherit.
// 3. If the base object is not given a variation in rule-based variation assignment,
//    but the group is and both are enabled, then the base object will inherit
//    the variation of the group's.


// You can ask questions about the group directly (use the `isGroup` flag):
let object = {
  isGroup: true,
  type: "Club",
  id: "5678",
  displayName: "SF Homeowners Club",
  attributes: {
    founded: "2016-01-01",
    active: true
  }
}

airship.isEnabled("bitcoin-pay", object)

License

MIT

StackShare