Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@thi.ng/api
Advanced tools
@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.
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
Lodash is a modern JavaScript utility library delivering modularity, performance, and extras. It provides similar functional programming utilities like map, filter, and type-checking functions. However, it does not focus on event handling.
RxJS is a library for reactive programming using Observables, to make it easier to compose asynchronous or callback-based code. It offers more advanced event handling and functional programming utilities compared to @thi.ng/api.
Ramda is a practical functional library for JavaScript programmers. It focuses on immutability and side-effect-free functions, providing utilities similar to @thi.ng/api's functional programming features.
[!IMPORTANT] ‼️ Announcing the thi.ng user survey 2024 📋
Please participate in the survey here!
(open until end of February)To achieve a better sample size, I'd highly appreciate if you could circulate the link to this survey in your own networks.
[!NOTE] This is one of 190 standalone projects, maintained as part of the @thi.ng/umbrella monorepo and anti-framework.
🚀 Help me to work full-time on these projects by sponsoring me on GitHub. Thank you! ❤️
Common, generic types, interfaces & mixins.
This package is implicitly used by most other projects in this repository. It defines:
STABLE - used in production
Search or submit any issues for this package
yarn add @thi.ng/api
ES module import:
<script type="module" src="https://cdn.skypack.dev/@thi.ng/api"></script>
For Node.js REPL:
const api = await import("@thi.ng/api");
Package sizes (brotli'd, pre-treeshake): ESM: 2.37 KB
None
If this project contributes to an academic publication, please cite it as:
@misc{thing-api,
title = "@thi.ng/api",
author = "Karsten Schmidt and others",
note = "https://thi.ng/api",
year = 2016
}
© 2016 - 2024 Karsten Schmidt // Apache License 2.0
FAQs
Common, generic types, interfaces & mixins
The npm package @thi.ng/api receives a total of 100,724 weekly downloads. As such, @thi.ng/api popularity was classified as popular.
We found that @thi.ng/api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.