Socket
Socket
Sign inDemoInstall

@thi.ng/api

Package Overview
Dependencies
0
Maintainers
1
Versions
179
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @thi.ng/api

Common, generic types & interfaces for thi.ng projects


Version published
Weekly downloads
126K
decreased by-0.43%
Maintainers
1
Created
Weekly downloads
 

Package description

What is @thi.ng/api?

@thi.ng/api is a collection of TypeScript interfaces, types, and utility functions for functional programming, event handling, and other common tasks in JavaScript/TypeScript projects.

What are @thi.ng/api's main functionalities?

Event Handling

This feature allows you to create and manage custom events. The code sample demonstrates creating an event, adding a listener, and dispatching the event.

const { Event } = require('@thi.ng/api');

const event = new Event('test');
event.addListener('test', (e) => console.log('Event received:', e));
event.dispatch('test', { message: 'Hello, World!' });

Functional Programming Utilities

This feature provides utility functions for functional programming. The code sample demonstrates filtering an array to get even numbers and then mapping the array to get their squares.

const { map, filter } = require('@thi.ng/api');

const nums = [1, 2, 3, 4, 5];
const evenNums = filter((x) => x % 2 === 0, nums);
const squaredNums = map((x) => x * x, evenNums);
console.log(squaredNums); // [4, 16]

Type Utilities

This feature includes type-checking utilities. The code sample demonstrates checking if a value is a string or a number.

const { isString, isNumber } = require('@thi.ng/api');

console.log(isString('hello')); // true
console.log(isNumber(123)); // true
console.log(isNumber('123')); // false

Other packages similar to @thi.ng/api

Readme

Source

@thi.ng/api

Generic, common interfaces, types, decorators and mixins for thi.ng TypeScript projects (and others).

Installation

yarn add @thi.ng/api
yarn run build
yarn run test

FAQs

Last updated on 31 Dec 2017

Did you know?

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc