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

target-position

v0.1.0

Published

Resolve target names to positions using the Sesame web service.

Readme

target-position

Resolve target names to positions with the Sesame web service.

Installation

target-position can be installed with npm:

npm install target-position

Alternatively you may use yarn:

yarn add target-position

Usage

You can use the targetPosition function for resolving a target name to the corresponding position.

import targetPosition from 'target-position';
// or: const targetPosition = require('target-position').default;

targetPosition('NGC 1234', ['Simbad', 'NED'])
  .then(pos => {
    if (pos) {
      console.log(`Target position:
    Right ascension: ${pos.rightAscension}
    Declination:     ${pos.declination}
    Equinox:         ${pos.equinox}
`);
    } else {
      console.log('No target could be found.');
    }
  })
  .catch(err => {
    console.error(err.message);
  });

As shown in this example, targetPosition returns a promise, which is either resolved with the target position (if a target is found for the target name) or null (otherwise). In case of an error the promise is rejected with an Error object.

The position is given as an object with the following properties.

Property | Explanation ---- | ---- rightAscension | The right ascension, in degrees between 0° and 360° declination | The declination, in degrees between -90° and 90° equinox | The equinox, as a float.

Sesame is used to resolve the target name passed as the first argument to targetPosition. The second argument specifies the resolvers Sesame should use. The available options are Simbad, NED and VizieR. They must be given as a list, and the order of the list items determines the order in which Sesame uses the resolvers. The search for a target stops once the first result is found.

For example, in the code above Sesame would first use Simbad to resolve NGC 1234. Only if Simbad returns no result, VizieR is used to resolve this name. If his also fails. the search stops.

The second argument is optional. If it isn't supplied, all of Simbad, NED and VizieR will be queried, in this order. But note that it is an error to pass an empty array as the second argument.

The Sesame web service at https://cdsweb.u-strasbg.fr/cgi-bin/nph-sesame/ is used. However, if you prefer, you may instead use its Harvard mirror, https://vizier.cfa.harvard.edu/viz-bin/nph-sesame/. You do this by calling the setMirror function before calling targetPosition.

import { setMirror } from 'target-position';
// or: const { setMirror } = require('target-position');

setMirror('https://vizier.cfa.harvard.edu/viz-bin/nph-sesame/');

Note the trailing slash at the end of the URL.

TypeScript

The package ships with a type definition file, so that you should be able to use it in a TypeScript project out of the box.

Support for browsers and NodeJS

This package works in browsers supported by the cross-fetch package. It can also be used with NodeJS.

Disclaimer

target-position is not endorsed by Sesame or any of the resolvers it uses.

Thanks

Thanks to the University of Strasbourg / CNRS for providing the Sesame web service. Thanks also to Carl-Johan Kihl for his instructive article on building and publishing a TypeScript package with npm.