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

@frui.ts/helpers

Package Overview
Dependencies
Maintainers
5
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frui.ts/helpers

Frui.ts helper functions

  • 0.17.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
637
increased by24.17%
Maintainers
5
Weekly downloads
 
Created
Source

@frui.ts/helpers

Helper functions for various use cases.

@bound

A function decorator that binds context of the function to the parent class. This is useful for direct use of the function as event handler <Xxx onClick={vm.decoratedFunction} /> so that new anonymous functions are not allocated for each render (compare to <Xxx onClick={() => vm.decoratedFunction()} />).

Usage

// in view model
class MyViewModel {
  @bound someAction() {
    // you can safely use 'this' here
  }
}

// in view
<button onClick={vm.someAction} />

createMap

Helper function for easily creating Maps.

Usage

const items = [
  { id: 1, name: "One" },
  { id: 2, name: "Two" },
  { id: 3, name: "Three" },
];

// map of items by key
const itemsById = createMap(items, x => x.id); // Map<number, { id, name }>

// map of values by key
const namesById = createMap(items, x => x.id, x => x.name); // Map<number, string>

nameof

Syntactic sugar for creating strings that are also a key of a type.

Usage

this.pagingFilter.sortColumn = nameof<User>("login"); // the same as ="login", but checked on compile time that the class 'User' actually has a 'login' field

ManualPromise

TODO

Keywords

FAQs

Package last updated on 31 Oct 2021

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