Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
untyped
Advanced tools
Changelog
Readme
▶️ Check online playground
# npm
npm i untyped
# yarn
yarn add untyped
# pnpm
pnpm add untyped
First we have to define a reference object that describes types, defaults, and a $resolve
method (normalizer).
const defaultPlanet = {
name: "earth",
specs: {
gravity: {
$resolve: (val) => parseFloat(val),
$default: "9.8",
},
moons: {
$resolve: (val = ["moon"]) => [].concat(val),
$schema: {
title: "planet moons",
},
},
},
};
resolveSchema
import { resolveSchema } from "untyped";
const schema = await resolveSchema(defaultPlanet);
Output:
{
"properties": {
"name": {
"type": "string",
"default": "earth"
},
"specs": {
"properties": {
"gravity": {
"default": 9.8,
"type": "number"
},
"moons": {
"title": "planet moons",
"default": ["moon"],
"type": "array",
"items": [
{
"type": "string"
}
]
}
},
"type": "object"
}
},
"type": "object"
}
generateTypes
import { resolveSchema, generateTypes } from "untyped";
const types = generateTypes(await resolveSchema(defaultPlanet));
Output:
interface Untyped {
/** @default "earth" */
name: string;
specs: {
/** @default 9.8 */
gravity: number;
/**
* planet moons
* @default ["moon"]
*/
moons: string[];
};
}
generateMarkdown
import { resolveSchema, generateMarkdown } from "untyped";
const markdown = generateMarkdown(await resolveSchema(defaultPlanet));
Output:
# `name`
- **Type**: `string`
- **Default**: `"earth"`
# `specs`
## `gravity`
- **Type**: `number`
- **Default**: `9.8`
## `moons`
- **Type**: `array`
- **Default**: `["moon"]`
corepack enable
(use npm i -g corepack
for Node.js < 16.10)pnpm install
pnpm dev
pnpm web
to start playground websitepnpm test
before push to ensure all tests and lint checks passingThanks to @dominikschreiber for donating package name.
FAQs
[![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href] [![Github Actions][github-actions-src]][github-actions-href] [![Codecov][codecov-src]][codecov-href] [![bundle][bundle-src]][bundle-href]
The npm package untyped receives a total of 529,304 weekly downloads. As such, untyped popularity was classified as popular.
We found that untyped demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.