Socket
Socket
Sign inDemoInstall

@thi.ng/api

Package Overview
Dependencies
1
Maintainers
1
Versions
180
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
Maintainers
1
Created

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

npm version npm downloads

This project is part of the @thi.ng/umbrella monorepo.

About

This package is implicitly used by most other projects in this repository. It defines:

  • 30+ generic, common interfaces & types
  • class & method decorators
  • mixins

Installation

yarn add @thi.ng/api

Dependencies

Authors

  • Karsten Schmidt

License

© 2016-2018 Karsten Schmidt // Apache Software License 2.0

Keywords

FAQs

Last updated on 10 Sep 2018

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