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

@floralink/core

v2.0.1

Published

Library for querying and statistically analyzing plant occurrence data in combination with taxon specific traits like Ellenberg indicator values or Red List classifications

Readme

@floralink/core

Floralink Core

A small library for working with plant occurrence data, taxon specific data and taxon reference data.

It consists of methods for calculating statistics for a set of taxa, taxon traits, occurrences or taxa in occurrences as well as utilities for defining plugins, transforming data formats and working with dates among others. Currently only supports local JSON databases for taxa or traits and API connectors for occurrences. Documentation is limited.

Setup

Install

npm install @floralink/core

Import

import * as floralink from "@floralink/core";

Plugins

To get the scales of measure of properties in a group or all groups of a traits plugin, you can use one of the following methods respectively:

function getGroupScalesOfMeasure(group: TraitsJsonGroup): ScaleOfMeasure[];
function getPluginScalesOfMeasure(plugin: SourcePlugin): ScaleOfMeasure[];

type ScaleOfMeasure = "nominal" | "ordinal" | "interval";

Queries

Taxon - resolveTaxon

function resolveTaxon(
  data: IdentifierIndexedObject<Taxon>,
  taxonID: string,
  path?: string[],
): Taxon;

Resolve potential synonyms of a taxonID defined in data and return Taxon object. Returns the resolved taxon's data.

Outer taxon hierarchy - getOuterTaxonHierarchy

function getOuterTaxonHierarchy(
  data: IdentifierIndexedObject<Taxon>,
  taxonID: string,
): Taxon[];

Traits - getTraitsByTaxonIDs

function getTraitsByTaxonIDs<T>(
  data: IdentifierIndexedObject<T>,
  ids: string[],
): IdentifierIndexedObject<T>;

Occurrences - queryAPI

function queryAPI(
  group: ApiGroup,
  query: OccurrenceQuery,
  options?: ApiOptions,
): Promise<Occurrence[]>;

Transformations

convertToTaxonOccurrenceIDs

function convertToTaxonOccurrenceIDs(
  occurrences: Occurrence[],
): TaxonIndexedObject<string[]>;

Convert an object of occurrence data indexed by occurrence IDs to a new object where each key is a taxon ID and each value is an object with an "occurrenceIDs" property containing an array of occurrence IDs from the original object.

getTaxonIDsFromOccurrences

function getTaxonIDsFromOccurrences(occurrences: Occurrence[]): string[];

Returns a deduplicated list of taxon IDs referenced in the given array of occurrences.

Statistics

getOccurrencesStatistics

function getOccurrencesStatistics(
  occurrences: Occurrence[],
): QueryOccurrencesStatistics;

Calculate and return statistics based on the given array of occurrences including total occurrences count, unique taxa count, extreme dates, and yearly frequencies.

getTaxaStatistics

function getTaxaStatistics(taxa: Taxon[]): TaxaStatistics;

getTaxonOccurrencesStatistics

function getTaxonOccurrencesStatistics(
  taxonOccurrenceIDs: TaxonIndexedObject<string[]>,
  occurrencesData: OccurrenceIndexedObject<Occurrence>,
): TaxonIndexedObject<QueryOccurrencesStatistics>;

getTraitsStatistics

function getTraitsStatistics(
  traitsGroup: TraitsJsonGroup,
  data: TaxonIndexedObject<Traits>,
  taxonIDs: string[],
  filterIDs?: string[],
): TraitsStatistics;

Date utilities

getDateStringFromISO

function getGermanDateStringFromISO(
  isoDate: string,
  localeCode?: string,
): string;

Helps to display an ISO date with time in a German locale.

getDateStringFromVagueDate

function getDateStringFromVagueDate(
  vagueDate: VagueDate,
  localeCode?: string,
): string;

Helps to display a VagueDate localized.

VagueDate is a type specific to the NetPhyD API. It allows to define resolution of data and date ranges where the actual data lies within.

getYearStringFromVagueDate

function getYearStringFromVagueDate(vagueDate: VagueDate): string;

Takes in a VagueDate and returns

  • the year as a string if start and end year are the same
  • or a German year range like "von 2010 bis 2019".

Defining plugins

You can use define functions to declare or export a typed object in a type-safe way.

  • defineGeneratorConfig
  • defineGroup
  • defineJsonGroup
  • definePlugin
  • defineProperty
  • defineTaxaJsonGroup
  • defineTraitsJsonGroup
import { definePlugin } from "@floralink/web";

export default definePlugin({
  id: "germansl",
  version: "1.5.6",
  title: "GermanSL",
  sourceType: "json",
  description: "Die GermanSL ist eine taxonomische Referenzdatenbank ...",
  license: {
    spdx: "CC-BY-4.0",
    title: "CC BY 4.0",
    url: "https://creativecommons.org/licenses/by/4.0/deed.de",
  },
  homepage: "https://germansl.infinitenature.org/",
  taxonReference: true,
  // ...
});

Regions

In a traits group of a plugin you can specify the region this data applies to on the meta.region key with a Describable object. This library exports some regions for reusal.

import { de } from "@floralink/core";

// {
//   title: "Deutschland",
//   short: "DE",
// }