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

@blockquote-web-components/blockquote-base-meta

v1.4.0

Published

Webcomponent blockquote-base-meta following open-wc recommendations

Downloads

67

Readme

Lit

BlockquoteBaseMeta is a generic class for sharing information across the DOM tree, inspired by Polymer's iron-meta. It employs the monostate pattern to allow any instance to access the shared information.

The class instances hold the actual data. They must be created before attempting to access them.

BlockquoteBaseMeta uses a Map to store the data. Unlike an Object, a Map allows keys of any type.

Demo

Open in StackBlitz

Usage

import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';

const myDefault = new BlockquoteBaseMeta({
  key: 'basic',
  value: 'foo/bar',
});

console.log(myDefault.byKey('basic')); // foo/bar

Value Getter - String

import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';

const myDefault = new BlockquoteBaseMeta({
  key: 'basic',
  value: 'foo/bar',
});

console.log(myDefault.value); // foo/bar

List Getter - Array

The list getter returns an array of all values stored in the BlockquoteBaseMeta instance.

import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';

const myDefault = new BlockquoteBaseMeta({
  type: 'three',
  key: 'basic',
  value: 'foo/bar',
});

console.log(myDefault.list); // ['foo/bar']

ObjectList Getter - Object

import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';

const myDefault = new BlockquoteBaseMeta({
  type: 'one',
  key: 'basic',
  value: 'foo/bar',
});

console.log(myDefault.objectList); // {basic: 'foo/bar'}

MapList Getter - Map

import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';

const keyInfo = { id: 'dsfaskj0' };
const myDefault = new BlockquoteBaseMeta({
  type: 'two',
  key: keyInfo,
  value: 'foo/bar',
});

console.log(myDefault.mapList); // Map(1) { { id: 'dsfaskj0' } => 'foo/bar' }

src/BlockquoteBaseMeta.js:

class: BlockquoteBaseMeta

Static Fields

| Name | Privacy | Type | Default | Description | Inherited From | | ------- | ------- | ---- | ------- | ----------- | -------------- | | types | | | | | | | uuid | | | | | |

Fields

| Name | Privacy | Type | Default | Description | Inherited From | | ------------ | ------- | ---- | ------- | --------------------------------------------------------------- | -------------- | | value | | | | Sets value to instance type and key | | | list | | | | Returns a list (Array) of the values for that instance `type` | | | mapList | | | | Returns a list (Map) for that instance `type` | | | objectList | | | | Returns a list (Object) for that instance `type` | | | type | | | type | Type of Meta | | | key | | | key | Key for Meta | |

Methods

| Name | Privacy | Description | Parameters | Return | Inherited From | | ------- | ------- | ---------------------------------------------------------------- | ---------- | ------ | -------------- | | byKey | | Returns the value of the provided key for that instance `type` | key: * | * | |

Exports

| Kind | Name | Declaration | Module | Package | | ---- | -------------------- | ------------------ | ------------------------- | ------- | | js | BlockquoteBaseMeta | BlockquoteBaseMeta | src/BlockquoteBaseMeta.js | |

src/index.js:

Exports

| Kind | Name | Declaration | Module | Package | | ---- | -------------------- | ------------------ | ----------------------- | ------- | | js | BlockquoteBaseMeta | BlockquoteBaseMeta | ./BlockquoteBaseMeta.js | |