Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svelte-common

Package Overview
Dependencies
Maintainers
1
Versions
378
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-common

common components and utils used in svelte apps

  • 4.22.22
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
526
decreased by-24.32%
Maintainers
1
Weekly downloads
 
Created
Source

Svelte v3 npm License bundlejs downloads GitHub Issues Build Status Styled with prettier Commitizen friendly Known Vulnerabilities Coverage Status Tested with TestCafe

svelte-common

common components utils used in svelte apps

usage

Check out the code in the example folder, or the live example.

API

Table of Contents

AttributeDefinition

Type: Object

Properties

  • type string
  • writable boolean
  • private boolean? should the value be shown
  • depends string? name of an attribute we depend on
  • additionalAttributes Array<string> extra attributes that are present in case our attribute is set
  • description string
  • default any? the default value
  • set Function? set the value
  • get Function? get the value can be used to calculate default values
  • env (Array<string> | string)? environment variable use to provide the value

tokens

Split property path into tokens

Parameters

setAttribute

Set Object attribute. The name may be a property path like 'a.b.c'.

Parameters

getAttribute

Deliver attribute value. The name may be a property path like 'a.b.c'.

Parameters

Returns any value associated with the given property name

getAttributeAndOperator

Deliver attribute value and operator. The name may be a property path like 'a.b.c <='.

Parameters

  • object Object
  • expression string
  • getters (optional, default {})

Returns [any, string] value associated with the given property name

filter

Generate filter function.

Parameters

Returns Function

initializeServiceWorker

Create a store holding a service worker

Parameters

  • script string The URL of the service worker script
  • options Object An object containing registration options

Returns Object store holding the service worker

toggleOrderBy

Deliver next value in the order by cycle. SORT_NONE -> SORT_ASCENDING -> SORT_DESCENDING -> SORT_NONE ...

Parameters

Returns string new order either SORT_NONE, SORT_ASCENDING or SORT_DESCENDING

sortable

Add sortable toggle button to a th node. Synchronizes store value with the nodes "aria-sort" attribute.

Parameters

  • th Element the header node
  • store WritableStore keep in sync with sorting properties

sorter

Generate a sort function for a given sort-by set.

Parameters

Returns (Function | undefined) sorter

keyPrefixStore

Create a derived store where all the object keys are prefixed.

{ a: 1, b: 2 } -> { foo_a: 1 foo_b: 2 } // prefix: foo_

Parameters

  • store WriteableStore we derive from
  • prefix string for each key

Returns WriteableStore

install

With npm do:

npm install svelte-common

or with yarn

yarn add svelte-common

license

BSD-2-Clause

Keywords

FAQs

Package last updated on 09 Jun 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc