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

@pa-media-group/ts-iptc-ninjs-type

v1.0.4

Published

Types for IPTCs Ninjs standard 1.3

Downloads

201

Readme

IPTC NinJS V1.3 Type Definition

Typescript type definition of IPTCs NinJS V1.3 standard.

Installation

npm i @pa-media-group/ts-iptc-ninjs-type

Usage

IptcNinjs Type

import { IptcNinjs } from 'ts-iptc-ninjs-type';

const typed: IptcNinjs = {
  "uri": "https://myuri.com/test/1"
};

The IPTC NinJS 1.3 schema allows for pattern properties as defined at the top level by: -

"^description_[a-zA-Z0-9_]+": {
  "title": "Description",
  "description": "A free-form textual description of the content of the item. (The string appended to description_ in the property name should reflect the format and/or the purpose of the text, separating the parts with _). nar:description",
  "type": "string"
},
"^body_[a-zA-Z0-9_]+": {
  "title": "Body",
  "description": "The textual content of the news object. (The string appended to body_ in the property name should reflect the format and/or the purpose of the text, separating the parts with _). nar:inlineData or nar:inlineXML",
  "type": "string"
},
"^headline_[a-zA-Z0-9_]+": {
  "title": "Extra headlines",
  "description": "Additional headlines or strings of that type can be handled here. This is not replacing the main headline-property in ninjs. (The string appended to headline_ in the property name should reflect the format and/or the purpose of the text, separating the parts with _) nar:headline with roles issue #13. (Added in 1.3)",
  "type": "string"
}

Also within 'place': -

"^geometry_[a-zA-Z0-9_]+": {
  "description": "An object holding geo data of this place. Could be of any relevant geo data JSON object definition.",
  "type": "object"
}

Without being opinionated on the patterns users of the IptcNinjs interface will choose to use these partially defined pattern properties could not be represented in the interface.

To use these it is recommended you extend the interface to your needs e.g.

import { IptcNinjs } from 'ts-iptc-ninjs-type';

interface Ninjs extends IptcNinjs {
  description_html?: string,
  description_text?: string,
}
import { IptcNinjs, NinjsLink } from 'ts-iptc-ninjs-type';

interface NinjsPlace extends NinjsLink {
  geometry_example?: Record<string, unknown>;
}

interface Ninjs extends IptcNinjs {
  place?: NinjsPlace[]
}

Validating JSON

Included is a validator which can be used to ensure JSON conforms to the IPTC Ninjs 1.3 schema it can be used as follows: -

import { IptcNinjs, IptcNinjsValidator } from 'ts-iptc-ninjs-type';

const validator: IptcNinjsValidator = new IptcNinjsValidator();
const typed: IptcNinjs = {
  "uri": "https://myuri.com/test/1"
};
const valid: boolean = validator.validate(typed);