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

@nara-way/accent

v4.1.0-1

Published

NARA Way Accent

Downloads

4

Readme

@nara-way/accent

The accent module provides a basic types and ubiquitous language for developing drama on NARA Way. For a detailed usage or guide document, please see NARA Way.

Features

  • Domain base model types
  • Interface for message types
  • Base model types for kollection and drama
  • Tenant base model types
  • Utility functions and classes

Installation

npm install @nara-way/accent

Usage

Entities

You can generate a list of changed properties from a Domain Entity source and a changed object. Or you can provide a function for the purpose of generating a NameValueList object.

Getting changed nameValues between source and modified entity:

// NameValueList

const sourceEntity: Foo = foo;
const modifiedEntity: Foo = fooOther;

const nameValue: NameValueList<Foo> =
  Entities.modifiedNameValues<T = Foo>(sourceEntity, modifiedEntity, FooUpdatable);

// IdNameValueList

const sourceEntities: Foo[] = foos;
const modifiedEntities: Foo[] = fooOthers;

const idNameValues: NameValueList<Foo> =
  Entities.modifiedIdNameValues<T = Foo>(sourceEntities, modifiedEntities, FooUpdatable);

Create NameValue and NameValueList type variable:

const nameValue1: NameValue = Entities.nameValue('prop', 'value');
const nameValue2: NameValue = Entities.nameValue('compositProp', compositValue);

const nameValues: NameValueList = Entities.nameValues(
  'prop', 'value',
  'compositProp', compositValue,
);

TenantKeys

You can generate id key values for types derived from object id key values for tenant and workspace types used on the NARA platform. For example, you can generate a stage key value from actor or get a citizen key value from actor.

const actorKey = TenantKeys.actorKey('1@1:1:1:1-1');

actorKey.type       // -> Actor

actorKey.audienceId // -> 1@1:1:1:1
actorKey.citizenId  // -> 1@1:1:1

actorKey.stageId    // -> 1:1:1:1-1
actorKey.cineroomId // -> 1:1:1:1
actorKey.pavilionId // -> 1:1:1

Paginations

A helper class that can be used in lists that support pages. It takes an Offset type as an argument and supports various properties and functions for handling pages.

| Property | Type | Description | |-------------|----------|-----------------------| | total | number | Total count | | count | number | Page count | | size | number | Size per page | | page | number | Current page (1, 2..) | | next | Offset | Next page offset | | previous | Offset | Previous page offset | | first | Offset | First page offset | | last | Offset | Last page offset | | hasNext | boolean | Has next page | | hasPrevious | boolean | Has previous page | | hasFirst | boolean | Has first page | | hasLast | boolean | Has last page |

To get the offset information by specifying the page to navigate to, use the following function:

import {Paginations} from "./Paginations";

const paginations: Paginations = new Paginations({
  offset: 0,
  limit: 10,
  totalCount: 55,
} as Offset);

const offset: Offset = paginations.navigate(5);
// offset     -> 50
// limit      -> 10
// totalCount -> 55

Getting more help

Visit the Nara Way page to get more information about the library:
https://github.com/naraway

You can ask any question about Nara Way using the NARA Way Page.