# node-onix

> Library for parsing and generating ONIX XML files.

Latest version **1.0.2** (published 2023-01-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-onix
pnpm add node-onix
yarn add node-onix
bun add node-onix
```

## Health

**Score 5/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: insecure dependencies; abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-01-06 |
| First published | 2022-12-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.6 |
| Dependencies | 5 |
| Unpacked size | 99.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | RedCards |
| Maintainers | lewissmallwood |

## Links

- npm: https://www.npmjs.com/package/node-onix
- Repository: https://github.com/RedCards/node-onix
- Homepage: https://github.com/RedCards/node-onix#readme
- Issues: https://github.com/RedCards/node-onix/issues
- npm.io page: https://npm.io/package/node-onix

## Dependencies (5)

- [chai](https://npm.io/package/chai.md) ^4.3.7
- [mocha](https://npm.io/package/mocha.md) ^10.2.0
- [should](https://npm.io/package/should.md) ^13.2.3
- [xml-schema](https://npm.io/package/xml-schema.md) git+ssh://git@github.com/christianroy/xml-schema.git
- [subjects-utils](https://npm.io/package/subjects-utils.md) ^0.0.2

## Recent versions

- 1.0.2 (latest) — 2023-01-06
- 1.0.1 — 2022-12-22
- 1.0.0 — 2022-12-22

## README

# node-onix

[![NPM version](https://badge.fury.io/js/node-onix.svg)](http://badge.fury.io/js/node-onix)

This is a Node.JS library for parsing and generating ONIX files. It includes basic ONIX 2.1 and ONIX 3.0 support.

### Installation

```
$ npm install node-onix
```

### Usage

```js
let onix = require("node-onix");

let xml = onix.create({
    from: {
        company: "RedCards",
        person: "John Doe",
        email: "john@doe.com"
    },
    supplier: {
        name: "ePubDirect",
        availabilityCode: "IP"
    },
    products: [
        {
            // Single record reference which will uniquely identify the product
            record: "book.com-bookId",

            // Notification type
            notification: onix.codes.NOTIFICATION.ADVANCE,

            // ISBN or other id
            id: {
                type: onix.codes.PRODUCTID.ISBN_13,
                value: '9780333370070'
            },

            // Title
            title: "Alice's Adventures in Wonderland",

            // Language code as ISO 639
            language: "eng",

            // List of prices (number or object) or unique "price"
            prices: [
                {
                    amount: 6,
                    currency: 'eur'
                },

                // Number will default to usd currency
                5
            ]
        }
    ]
});
```

ONIX data can also be parsed, using the following code.

```js
let data = onix.parse('...');
```

---
_Source: https://npm.io/package/node-onix · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
