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

xero-hero

v0.7.1

Published

Heroic utilities to simplify and enable your progress with the [xero-node](https://www.npmjs.com/package/xero-node) SDK.

Downloads

60

Readme

Xero Hero

Heroic utilities to simplify and enable your progress with the xero-node SDK.

Modules

While all the exports are at the top level, the project documentation and organization is the same as the Xero API.

Common

Common utilities for functionality across different Xero APIs.

Methods

dateInWhereFormat(date:Date)

Returns a date in the format required by the Xero API for the where parameter.

import { dateInWhereFormat } from 'xero-hero';

const date = new Date();
const formattedDate = dateInWhereFormat(date);
console.log(formattedDate); // DateTime(2020, 12, 31)

Accounting

You can read more about the Accounting API here.

Attachments

You can read more about the Attachments API here.

Methods

createInvoiceAttachment(client:XeroClient, tenantId:string, { invoiceId:string, fileName:string, contents:Buffer })

Creates an attachment for an invoice.

import { createInvoiceAttachment } from 'xero-hero';

const invoice = await getMyInvoice();
const attachment = await createInvoiceAttachment(xero, tenantId, {
  invoiceId: invoice.invoiceId,
  fileName: 'my-attachment.pdf',
  contents: fs.readFileSync('my-attachment.pdf'),
});

Contacts

You can read more about the Contacts API here.

Methods

getContactLink(contact:Contact | string)

Returns the link to the contact in the Xero UI.

import { getContactLink } from 'xero-hero';

const contact = await xero.contacts.getContacts();
const link = getContactLink(contact[0]);
console.log(link); // https://go.xero.com/Contacts/View/12345678-1234-1234-1234-123456789012

Invoices

You can read more about the Invoices API here.

Methods

getInvoiceLink(invoice:Invoice | string)

Returns the link to the invoice in the Xero UI.

import { getInvoiceLink } from 'xero-hero';

const invoice = await xero.invoices.getInvoices();
const link = getInvoiceLink(invoice[0]);
console.log(link); // https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=12345678-1234-1234-1234-123456789012

filterInvoiceLineItems(invoice:Invoice, filter:DecisionFunction)

Filters the line items of an invoice by the given filter.

import { filterInvoiceLineItems } from 'xero-hero';

const invoice = await xero.invoices.getInvoices();
const filteredLineItems = filterInvoiceLineItems(invoice[0], (lineItem) => lineItem.quantity > 1);
console.log(filteredLineItems); // [ { quantity: 2, ... }, { quantity: 3, ... } ]

Journals

You can read more about the Journals API here.

Methods

getManualJournalLink(journal:ManualJournal | string)

Returns the link to the journal in the Xero UI.

import { getManualJournalLink } from 'xero-hero';

const journal = await xero.journals.getManualJournals();
const link = getManualJournalLink(journal[0]);
console.log(link); // https://go.xero.com/GeneralLedger/View.aspx?invoiceID=12345678-1234-1234-1234-123456789012

Projects

You can read more about the Projects API here.

Methods

generateProjectAmountUSD(project:Project)

Generates the USD amount for a project.

import {generateProjectAmountUSD} from 'xero-hero';
import {Amount} from 'xero-node/dist/gen/model/projects/amount';

const project = await xero.projects.getProjects();
const amount = generateProjectAmountUSD(project[0]);
console.log(amount instanceof Amount); // true
console.log(amount.currencyCode); // USD

Acknowledgements

This package was generated using a tsup starter article found here.