New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@typinghare/extrum

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typinghare/extrum

A lightweight data collector library.

latest
npmnpm
Version
2.4.2
Version published
Weekly downloads
2
-50%
Maintainers
0
Weekly downloads
 
Created
Source

Extrum

Get Started

Create a MyConfig interface and a MyConfigMetadata interface, then create a data collection.

import { DataCollection, Datum } from '@typinghare/extrum'

interface MyConfig {
    username: string,
    fontSize: number
}

interface MyConfigMetadata {
    label: string
    optionList?: any[]
}

const dataCollection = new DataCollection<MyConfig, MyConfigMetadata>({
    username: Datum.of('TypingHare').setMetadata({
        label: 'The username of the user.',
    }),
    fontSize: Datum.of(16).setMetadata({
        label: 'The font size.',
        optionList: [12, 16, 20],
    }),
})

Get values from the data collection and set values.

const username = dataCollection.getValue('username')     // TypingHare 
const fontSize = dataCollection.getValue('fontSize')     // 16

dataCollection.setValue('username', 'James Chan')
dataCollection.setValue('fontSize', 20)

Get and set metadata.

dataCollection.getDatum('username').meta('label')
dataCollection.getDatum('fontSize').meta('optionList')

dataCollection.getDatum('username').meta('label')
dataCollection.getDatum('fontSize').meta('optionList', [8, 12, 16, 20, 24])

Keywords

metadata

FAQs

Package last updated on 15 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts