Socket
Socket
Sign inDemoInstall

arktype

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arktype - npm Package Compare versions

Comparing version 1.0.3-alpha to 1.0.4-alpha

2

dist/cjs/main.js

@@ -15,3 +15,3 @@ "use strict";

ark: ()=>_arkTs.ark,
arkscope: ()=>_arkTs.arkscope,
arkScope: ()=>_arkTs.arkScope,
intersection: ()=>_expressionsTs.intersection,

@@ -18,0 +18,0 @@ union: ()=>_expressionsTs.union,

@@ -12,3 +12,3 @@ "use strict";

_export(exports, {
arkscope: ()=>arkscope,
arkScope: ()=>arkScope,
ark: ()=>ark,

@@ -23,3 +23,3 @@ scopes: ()=>scopes,

const _validationTs = require("./validation/validation.js");
const arkscope = (0, _scopeTs.scope)({}, {
const arkScope = (0, _scopeTs.scope)({}, {
name: "standard",

@@ -33,3 +33,3 @@ includes: [

});
const ark = arkscope.compile();
const ark = arkScope.compile();
const scopes = {

@@ -40,3 +40,3 @@ root: _scopeTs.rootScope,

validation: _validationTs.validationScope,
ark: arkscope
ark: arkScope
};

@@ -49,2 +49,2 @@ const spaces = {

};
const type = arkscope.type;
const type = arkScope.type;

@@ -108,3 +108,5 @@ "use strict";

this.path.pop();
lastData[key] = this.data;
if (lastData[key] !== this.data) {
lastData[key] = this.data;
}
this.data = lastData;

@@ -111,0 +113,0 @@ return isValid;

export { scope } from "./scopes/scope.js";
export { type, ark, arkscope } from "./scopes/ark.js";
export { type, ark, arkScope } from "./scopes/ark.js";
export { intersection, union, arrayOf, instanceOf, valueOf, morph, narrow, keyOf } from "./scopes/expressions.js";
export { Problems, Problem } from "./traverse/problems.js";

@@ -5,3 +5,3 @@ import { jsObjects, jsObjectsScope } from "./jsObjects.js";

import { validation, validationScope } from "./validation/validation.js";
export const arkscope = scope({}, {
export const arkScope = scope({}, {
name: "standard",

@@ -15,3 +15,3 @@ includes: [

});
export const ark = arkscope.compile();
export const ark = arkScope.compile();
export const scopes = {

@@ -22,3 +22,3 @@ root: rootScope,

validation: validationScope,
ark: arkscope
ark: arkScope
};

@@ -31,2 +31,2 @@ export const spaces = {

};
export const type = arkscope.type;
export const type = arkScope.type;

@@ -92,3 +92,5 @@ function _checkPrivateRedeclaration(obj, privateCollection) {

this.path.pop();
lastData[key] = this.data;
if (lastData[key] !== this.data) {
lastData[key] = this.data;
}
this.data = lastData;

@@ -95,0 +97,0 @@ return isValid;

export { scope } from "./scopes/scope.js";
export { type, ark, arkscope } from "./scopes/ark.js";
export { type, ark, arkScope } from "./scopes/ark.js";
export { intersection, union, arrayOf, instanceOf, valueOf, morph, narrow, keyOf } from "./scopes/expressions.js";

@@ -4,0 +4,0 @@ export type { Scope, Space } from "./scopes/scope.js";

import type { error, stringKeyOf } from "../../../../utils/generics.js";
import type { BigintLiteral, NumberLiteral, writeMalformedNumericLiteralMessage } from "../../../../utils/numericLiterals.js";
import type { BigintLiteral, NumberLiteral } from "../../../../utils/numericLiterals.js";
import type { DynamicState } from "../../reduce/dynamic.js";

@@ -9,3 +9,3 @@ import type { state, StaticState } from "../../reduce/static.js";

export type isResolvableIdentifier<token, $> = token extends stringKeyOf<$> ? true : false;
type tryResolve<s extends StaticState, token extends string, $> = isResolvableIdentifier<token, $> extends true ? token : token extends NumberLiteral<infer value> ? number extends value ? error<writeMalformedNumericLiteralMessage<token, "number">> : token : token extends BigintLiteral<infer value> ? bigint extends value ? error<writeMalformedNumericLiteralMessage<token, "bigint">> : token : error<token extends "" ? writeMissingOperandMessage<s> : writeUnresolvableMessage<token>>;
type tryResolve<s extends StaticState, token extends string, $> = isResolvableIdentifier<token, $> extends true ? token : token extends NumberLiteral ? token : token extends BigintLiteral ? token : error<token extends "" ? writeMissingOperandMessage<s> : writeUnresolvableMessage<token>>;
export declare const writeUnresolvableMessage: <token extends string>(token: token) => `'${token}' is unresolvable`;

@@ -12,0 +12,0 @@ type writeUnresolvableMessage<token extends string> = `'${token}' is unresolvable`;

import type { InferredObjectKinds } from "../utils/objectKinds.js";
import type { Space } from "./scope.js";
import type { TypeParser } from "./type.js";
export declare const arkscope: import("./scope.js").Scope<[{
export declare const arkScope: import("./scope.js").Scope<[{
any: any;

@@ -6,0 +6,0 @@ bigint: bigint;

{
"name": "arktype",
"description": "The first isomorphic type system for TS/JS",
"version": "1.0.3-alpha",
"version": "1.0.4-alpha",
"author": {

@@ -35,2 +35,3 @@ "name": "David Blass",

"@changesets/cli": "2.26.0",
"@changesets/changelog-github": "0.4.8",
"@swc/cli": "0.1.62",

@@ -75,3 +76,6 @@ "@swc/core": "1.3.35",

"mocha": {
"spec": "test/*.test.ts",
"spec": [
"dev/test/*.test.ts",
"test/*.test.ts"
],
"ignore": "**/node_modules/*",

@@ -100,3 +104,3 @@ "node-option": [

"testTsVersions": "ts-node ./dev/scripts/testTsVersions.ts",
"testDeno": "deno task test",
"testDeno": "deno test -c ./dev/configs/deno.jsonc --no-check --allow-all",
"bench": "ts-node ./dev/attest/cli.ts bench --benchmarksPath ./test/benchmarks.json",

@@ -103,0 +107,0 @@ "lint": "eslint --max-warnings=0 .",

@@ -1,27 +0,25 @@

<div align="center">
<img src="./dev/arktype.io/static/img/logo.svg" height="64px" />
<h1>ArkType</h1>
</div>
<div align="center">
<h1 align="center">ArkType <sub><sup>Isomorphic types for TS/JS</sup></sub></h1>
The first isomorphic type system for TS/JS
![Intro GIF](./dev/arktype.io/static/img/arktype.gif)
<sub><i>`typescript@4.9.5` in VS Code— no extensions or plugins required (<a href="#how">how?</a>)</i></sub>
</div>
## Install <sub><sub>📦`4KB` gzipped, `0` dependencies</sub></sub>
![](./dev/arktype.io/static/img/arktypeGithub.gif)
<img src="./dev/arktype.io/static/img/npm.svg" alt="Npm Icon" height="16px"> `npm install arktype` <sub>(or whatever package manager you prefer)</sub>
## Installation 📦
<img src="./dev/arktype.io/static/img/deno.svg" alt="Deno Icon" height="16px"> `import { type } from "https://deno.land/x/arktype"`
`npm install arktype`
<img src="./dev/arktype.io/static/img/logo.svg" alt="ArkType Icon" height="16px"> <i>Try it in-browser at [arktype.io/try](https://arktype.io/try)</i> <sub>(the types aren't quite as snappy as they will be in
your IDE)</sub>
If you're using TypeScript, you'll need at least `4.8`
Our types are tested in [strict-mode](https://www.typescriptlang.org/tsconfig#strict) with TypeScript versions `4.8`, `4.9`, and `5.0`.
_Note: Our APIs have largely stabilized at this point, but some may still change during the alpha/beta stages of our 1.0 release. If you have feedback that may require a breaking change, now is the time to let us know!_
_Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know!_ ⛵
### Your first type
## Types
[Try it out.](https://arktype.io/docs/#your-first-type)
[Try it in-browser.](https://arktype.io/docs/#your-first-type)
```ts @blockFrom:examples/type.ts
import { type } from "../src/main.ts"
```ts @blockFrom:dev/examples/type.ts
import { type } from "arktype"

@@ -56,6 +54,6 @@ // Define a type...

[Try it out.](https://arktype.io/docs/scopes)
[Try it in-browser.](https://arktype.io/docs/scopes)
```ts @blockFrom:examples/scope.ts
import { scope } from "../src/main.ts"
```ts @blockFrom:dev/examples/scope.ts
import { scope } from "arktype"

@@ -92,3 +90,3 @@ // Scopes are collections of types that can reference each other.

ArkType supports many of TypeScript's built-in types and operators, as well as some new nes dedicated exclusively to runtime validation. In fact, we got a little ahead of ourselves and built a ton of cool features, but we're still working on getting caught up syntax and API docs. Keep an eye out for more in the next couple weeks! In the meantime, check out the examples from this README and use the type hints you get to learn how you can customize your types and scopes. If you have any questions, don't hesitate to reach out on the [dedicated Discord channel](https://discord.gg/WSNF3Kc4xh)!
ArkType supports many of TypeScript's built-in types and operators, as well as some new nes dedicated exclusively to runtime validation. In fact, we got a little ahead of ourselves and built a ton of cool features, but we're still working on getting caught up syntax and API docs. Keep an eye out for more in the next couple weeks! In the meantime, check out the examples from this README and use the type hints you get to learn how you can customize your types and scopes. If you have any questions, don't hesitate to reach out on our [Discord channel](https://discord.gg/WSNF3Kc4xh)!

@@ -100,4 +98,10 @@ ## Contributing

1. Thank you! We'll do everything we can to make this as straightforward as possible, regardless of your level of experience.
2. Check out our [guide](./CONTRIBUTING.md) to get started!
2. Check out our [guide](./dev/configs/CONTRIBUTING.md) to get started!
### How
(`TODO`)
![](https://media2.giphy.com/media/CAYVZA5NRb529kKQUc/giphy.gif?cid=ecf05e47sdo4ysq8yl97j7xfo5sr3c2e3e4im6ipspci5v0k&rid=giphy.gif)
## License

@@ -104,0 +108,0 @@

Sorry, the diff of this file is not supported yet

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