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

@kompanion/style

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kompanion/style

Tiny snippets of useful javascript code for websites and apps.

  • 0.0.1
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Kompanion utils

Tiny snippets of useful javascript code for websites and apps.

npm i @kompanion/utils

# or
yarn add @kompanion/utils

Utilities

As @kompanion/utils is written in Typescript, you get automatic intellisense by default if using editors like VS Code.

Arrays

shuffleArray

Self explanatory. The only argument is an array:

import { shuffleArray } from '@kompanion/utils';

const emojis = ['😄', '🤨', '🧡', '😝'];
const randomEmoji = shuffleArray(emojis)[0];
scrollToId

Single argument: id: string

Uses the scrollIntoView API to smoothly scroll the screen to the object defined by the given id. If no object is found, does nothing.

<button onClick="scrollToId('contact')">Get in contact</button>
getWindowSize

Checks if there's a window object (if it's a browser) and returns an object: {width: num, height: num}

TODO

  • Add another tsconfig for an ES5 bundle
  • Finish documentation

Keywords

FAQs

Package last updated on 15 Mar 2019

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