Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@harmoniclabs/plu-ts

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@harmoniclabs/plu-ts - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

src/onchain/pluts/stdlib/TermPair.ts

18

CHANGELOG.md
# Changelog
## Unreleased v0.1.5
- [ ] inline `HoistedUPLC` used only once
## Unreleased v0.1.4
- [ ] `papp` (and `$` method) tries to accept ts values and convert it automatically when possible
> _example_
>
> if `Term<PInt>` is expected it should be possible to pass `1` without having to do `pInt(1)`
- [ ] simple constants (`int`, `bs`, `bool`, etc... )
- [ ] functions (`lam`, `fn`)
- `papp` (and `$` method) accepts ts values and converts it automatically when possible
> _example_: if `Term<PInt>` is expected it should be possible to pass `1` without having to do `pInt(1)`
- simple constants (`int`, `bs`, `bool`, etc... )
- functions (`lam`, `fn`)
- structured types (`list`, `pair`)
- modified exsisting utility terms methods accordingly
- added `TermPair`
- added `pPair` for constants pairs

@@ -16,0 +14,0 @@ ## v0.1.3

{
"name": "@harmoniclabs/plu-ts",
"version": "0.1.3",
"version": "0.1.4",
"description": "An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript",

@@ -5,0 +5,0 @@ "main": "./src/index.ts",

@@ -90,3 +90,2 @@ import PTxInfo from "../PTxInfo";

console.log( res );
//*

@@ -93,0 +92,0 @@ expect(

@@ -11,5 +11,4 @@ export * from "./PStruct";

export * from "./PList";
export * from "./PMap";
export * from "./PPair";
export * from "./PString";
export * from "./PUnit";

@@ -7,2 +7,3 @@ import PFn from "./PFn";

import Term from "../../Term";
import { PappArg } from "../../Syntax/pappArg";

@@ -38,6 +39,6 @@ export default class PLam<A extends PType, B extends PType > extends PType

Out extends PLam<infer A extends PType, infer B extends PType> ? TermFn<[ Ins[0], ...Tail<Ins> , A ], B> :
Ins extends [ infer PInstance extends PType ] ? Term<PLam<PInstance, Out>> & { $: ( input: Term<PInstance> ) => UtilityTermOf<Out> } :
Ins extends [ infer PInstance extends PType ] ? Term<PLam<PInstance, Out>> & { $: ( input: PappArg<PInstance> ) => UtilityTermOf<Out> } :
Ins extends [ infer PInstance extends PType, ...infer RestIns extends [ PType, ...PType[] ] ] ?
Term<PLam<PInstance,PFn<RestIns, Out>>>
& { $: ( input: Term< PInstance > ) => TermFn< RestIns, Out > } :
& { $: ( input: PappArg< PInstance > ) => TermFn<RestIns, Out> } :
never

@@ -44,0 +45,0 @@

@@ -11,2 +11,3 @@ import Integer from "../../../types/ints/Integer";

import PLam from "./PFn/PLam";
import { PappArg } from "../Syntax/pappArg";

@@ -31,3 +32,3 @@ export default class PInt extends PDataRepresentable

static override get fromDataTerm(): Term<PLam<PData, PInt>> & { $: (input: Term<PData>) => Term<PInt>; }
static override get fromDataTerm(): Term<PLam<PData, PInt>> & { $: (input: PappArg<PData>) => Term<PInt>; }
{

@@ -44,5 +45,5 @@ return punIData;

static override get toDataTerm(): Term<PLam<any, PData>> & { $: (input: Term<any>) => Term<PData>; }
static override get toDataTerm(): Term<PLam<any, PData>> & { $: (input: PappArg<any>) => Term<PData>; }
{
return pIntToData;
return pIntToData as any;
}

@@ -49,0 +50,0 @@ /**

@@ -16,2 +16,4 @@ import Data, { isData } from "../../../types/Data";

import punsafeConvertType from "../Syntax/punsafeConvertType";
import { PappArg } from "../Syntax/pappArg";
import TermList, { addPListMethods } from "../stdlib/UtilityTerms/TermList";

@@ -32,3 +34,3 @@

static override get fromDataTerm(): Term<PLam<PData, PList<PData>>> & { $: (input: Term<PData>) => Term<PList<PData>>; }
static override get fromDataTerm(): Term<PLam<PData, PList<PData>>> & { $: (input: PappArg<PData>) => Term<PList<PData>>; }
{

@@ -45,5 +47,5 @@ return punListData( Type.Data.Any );

static override get toDataTerm(): Term<PLam<PList<PData>, PData>> & { $: (input: Term<PList<PData>>) => Term<PData>; }
static override get toDataTerm():Term<PLam<any, PData>> & { $: (input: PappArg<any>) => Term<PData>; }
{
return pListToData( Type.Data.Any );
return pListToData( Type.Data.Any ) as any;
}

@@ -67,3 +69,3 @@ /**

export function pnil<ElemsT extends ConstantableTermType>( elemsT: ElemsT ): Term<PList<ToPType<ElemsT>>>
export function pnil<ElemsT extends ConstantableTermType>( elemsT: ElemsT ): TermList<ToPType<ElemsT>>
{

@@ -79,14 +81,16 @@ assertValidListType( elemsT );

return new Term<PList<ToPType<ElemsT>>>(
Type.List( elemsT ),
_dbn => UPLCConst.listOf( termTyToConstTy( elemsT ) )([]),
true
return addPListMethods(
new Term<PList<ToPType<ElemsT>>>(
Type.List( elemsT ),
_dbn => UPLCConst.listOf( termTyToConstTy( elemsT ) )([]),
true
)
);
}
export function pconstList<ElemsT extends ConstantableTermType>( elemsT: ElemsT ): ( elems: Term<ToPType<ElemsT>>[] ) => Term<PList<ToPType<ElemsT>>>
export function pconstList<ElemsT extends ConstantableTermType>( elemsT: ElemsT ): ( elems: Term<ToPType<ElemsT>>[] ) => TermList<ToPType<ElemsT>>
{
assertValidListType( elemsT );
return ( elems: Term<ToPType<ElemsT>>[] ) => {
return ( elems: Term<ToPType<ElemsT>>[] ): TermList<ToPType<ElemsT>> => {
JsRuntime.assert(

@@ -104,11 +108,13 @@ Array.isArray( elems ) && elems.every(

return new Term<PList<ToPType<ElemsT>>>(
Type.List( elemsT ),
dbn => UPLCConst.listOf( termTyToConstTy( elemsT ) )
(
elems.map(
el => ( el.toUPLC( dbn ) as UPLCConst ).value
) as any
),
true
return addPListMethods(
new Term<PList<ToPType<ElemsT>>>(
Type.List( elemsT ),
dbn => UPLCConst.listOf( termTyToConstTy( elemsT ) )
(
elems.map(
el => ( el.toUPLC( dbn ) as UPLCConst ).value
) as any
),
true
)
);

@@ -118,5 +124,5 @@ }

export function pList<ElemsT extends ConstantableTermType>( elemsT: ElemsT ): ( elems: Term<ToPType<ElemsT>>[] ) => Term<PList<ToPType<ElemsT>>>
export function pList<ElemsT extends ConstantableTermType>( elemsT: ElemsT ): ( elems: Term<ToPType<ElemsT>>[] ) => TermList<ToPType<ElemsT>>
{
return ( elems: Term<ToPType<ElemsT>>[] ) => {
return ( elems: Term<ToPType<ElemsT>>[] ): TermList<ToPType<ElemsT>> => {
JsRuntime.assert(

@@ -123,0 +129,0 @@ Array.isArray( elems ) && elems.every(

import JsRuntime from "../../../utils/JsRuntime";
import { pfstPair, pid, ppairData, psndPair, punMapData } from "../stdlib/Builtins";
import PType, { PDataRepresentable } from "../PType";
import { phoist, plam } from "../Syntax/syntax";
import Term from "../Term";
import Type, { data, DataType, pair, TermType } from "../Term/Type/base";
import Type, { ConstantableTermType, data, DataType, pair, TermType, ToPType } from "../Term/Type/base";
import { typeExtends } from "../Term/Type/extension";
import PData from "./PData/PData";
import PDataMap from "./PData/PDataMap";
import PLam from "./PFn/PLam";
import PList from "./PList";
import { punsafeConvertType } from "../Syntax";
import { isConstantableTermType } from "../Term/Type/kinds";
import UPLCConst from "../../UPLC/UPLCTerms/UPLCConst";
import { termTyToConstTy } from "../Term/Type/constTypeConversion";
import TermPair, { addPPairMethods } from "../stdlib/TermPair";

@@ -68,1 +69,46 @@ export default class PPair<A extends PType, B extends PType > extends PDataRepresentable

}
export function pPair<FstT extends ConstantableTermType, SndT extends ConstantableTermType>(
fstT: FstT,
sndT: SndT
): ( fst: Term<ToPType<FstT>>, snd: Term<ToPType<SndT>> ) => TermPair<ToPType<FstT>,ToPType<SndT>>
{
JsRuntime.assert(
isConstantableTermType( fstT ),
"plutus only supports pairs of types that can be converted to constants"
);
JsRuntime.assert(
isConstantableTermType( sndT ),
"plutus only supports pairs of types that can be converted to constants"
);
return ( _fst: Term<ToPType<FstT>>, _snd: Term<ToPType<SndT>> ): TermPair<ToPType<FstT>,ToPType<SndT>> => {
JsRuntime.assert(
_fst instanceof Term &&
(_fst as any).isConstant &&
typeExtends( _fst.type, fstT ),
"first element of a constant pair was not a constant"
);
JsRuntime.assert(
_snd instanceof Term &&
(_snd as any).isConstant &&
typeExtends( _snd.type, sndT ),
"second element of a constant pair was not a constant"
);
return addPPairMethods(
new Term<PPair<ToPType<FstT>,ToPType<SndT>>>(
pair( fstT, sndT ),
dbn => UPLCConst.pairOf(
termTyToConstTy( fstT ),
termTyToConstTy( sndT )
)(
(_fst.toUPLC( dbn ) as UPLCConst).value,
(_snd.toUPLC( dbn ) as UPLCConst).value
),
true // isConstant
)
);
}
}

@@ -131,3 +131,3 @@ import ByteString from "../../../../types/HexString/ByteString"

return peqBs.$( ownHash as Term<PByteString> ).$( valHash as Term<PByteString> )
return peqBs.$( ownHash ).$( valHash )
}))

@@ -134,0 +134,0 @@ .onPPubKeyCredential( _ => pBool( false ) )

@@ -36,2 +36,4 @@ import BasePlutsError from "../../../errors/BasePlutsError";

import PDelayed from "../PTypes/PDelayed";
import { PappArg } from "../Syntax/pappArg";
import { UtilityTermOf } from "./UtilityTerms/addUtilityForType";

@@ -49,8 +51,8 @@ function pBool( bool: boolean ): TermBool

export function addApplications<Ins extends [ PType, ...PType[] ], Out extends PType, TermOutput extends TermFn< Ins, Out > = TermFn< Ins, Out >>
export function addApplications<Ins extends [ PType, ...PType[] ], Out extends PType>
(
lambdaTerm: Term< PFn< Ins, Out > >,
addOutputMethods?: ( termOut: Term<Out> ) => TermOutput // useless since papp handles all that with addUtility...
addOutputMethods?: ( termOut: Term<Out> ) => any // TermOutput // useless since papp handles all that with addUtility...
)
: TermOutput
: TermFn< Ins, Out >
{

@@ -64,3 +66,3 @@ const nMissingArgs = getNRequiredLambdaArgs( lambdaTerm.type );

"$",
( input: Term< Head<Ins> > ) => {
( input: PappArg< Head<Ins> > ) => {
let output: any = papp( lambdaTerm, input );

@@ -76,3 +78,3 @@

"$",
( input: Term< Head<Ins> > ) =>
( input: PappArg< Head<Ins> > ) =>
// @ts-ignore

@@ -95,6 +97,6 @@ // Type 'PType[]' is not assignable to type '[PType, ...PType[]]'.

& {
$: ( input: Term<PInt> ) =>
$: ( input: PappArg<PInt> ) =>
Term<PLam<PInt,PInt>>
& {
$: ( input: Term<PInt> ) =>
$: ( input: PappArg<PInt> ) =>
TermInt

@@ -115,3 +117,3 @@ }

"$",
( fstIn: Term<PInt> ): Term<PLam<PInt, PInt>> => {
( fstIn: PappArg<PInt> ): Term<PLam<PInt, PInt>> => {
const oneIn = papp( op, fstIn );

@@ -122,3 +124,3 @@

"$",
( sndIn: Term<PInt> ): TermInt => {
( sndIn: PappArg<PInt> ): TermInt => {
return papp( oneIn, sndIn )

@@ -133,6 +135,6 @@ }

& {
$: ( input: Term<PInt> ) =>
$: ( input: PappArg<PInt> ) =>
Term<PLam<PInt,PBool>>
& {
$: ( input: Term<PInt> ) =>
$: ( input: PappArg<PInt> ) =>
TermBool

@@ -169,6 +171,6 @@ }

& {
$: ( input: Term<PByteString> ) =>
$: ( input: PappArg<PByteString> ) =>
Term<PLam<PByteString,PByteString>>
& {
$: ( input: Term<PByteString> ) =>
$: ( input: PappArg<PByteString> ) =>
TermBS

@@ -205,6 +207,6 @@ }

& {
$: ( input: Term<PByteString> ) =>
$: ( input: PappArg<PByteString> ) =>
Term<PLam<PByteString,PBool>>
& {
$: ( input: Term<PByteString> ) =>
$: ( input: PappArg<PByteString> ) =>
TermBool

@@ -300,6 +302,6 @@ }

& {
$: ( input: Term<PInt> ) =>
$: ( input: PappArg<PInt> ) =>
Term<PLam<PByteString,PByteString>>
& {
$: ( input: Term<PByteString> ) =>
$: ( input: PappArg<PByteString> ) =>
TermBS

@@ -344,9 +346,9 @@ }

& {
$: ( fromIndex: Term<PInt> ) =>
$: ( fromIndex: PappArg<PInt> ) =>
Term<PLam< PInt, PLam<PByteString,PByteString>>>
& {
$: ( ofLength: Term<PInt> ) =>
$: ( ofLength: PappArg<PInt> ) =>
Term<PLam<PByteString,PByteString>>
& {
$: ( onByteString: Term<PByteString> ) => TermBS
$: ( onByteString: PappArg<PByteString> ) => TermBS
}

@@ -363,8 +365,8 @@ }

"$",
( fromIndex: Term<PInt> ): Term<PLam< PInt, PLam<PByteString,PByteString>>>
( fromIndex: PappArg<PInt> ): Term<PLam< PInt, PLam<PByteString,PByteString>>>
& {
$: ( ofLength: Term<PInt> ) =>
$: ( ofLength: PappArg<PInt> ) =>
Term<PLam<PByteString,PByteString>>
& {
$: ( onByteString: Term<PByteString> ) => TermBS
$: ( onByteString: PappArg<PByteString> ) => TermBS
}

@@ -399,7 +401,3 @@ } =>{

export const plengthBs
:TermFn<[ PByteString ], PInt >
& {
$: ( ofByteString: Term<PByteString> ) => TermInt
}
export const plengthBs :TermFn<[ PByteString ], PInt >
= (() => {

@@ -414,3 +412,3 @@ const lenBS = new Term<PLam< PByteString, PInt >>(

"$",
( ofByteString: Term<PByteString> ): TermInt =>
( ofByteString: PappArg<PByteString> ): TermInt =>
addPIntMethods( papp( lenBS, ofByteString ) )

@@ -423,6 +421,6 @@ );

& {
$: ( ofByteString: Term<PByteString> ) =>
$: ( ofByteString: PappArg<PByteString> ) =>
Term<PLam<PInt, PInt>>
& {
$: ( index: Term<PInt> ) => TermInt
$: ( index: PappArg<PInt> ) => TermInt
}

@@ -439,6 +437,6 @@ }

"$",
( ofByteString: Term<PByteString> ):
( ofByteString: PappArg<PByteString> ):
Term<PLam<PInt, PInt>>
& {
$: ( index: Term<PInt> ) => TermInt
$: ( index: PappArg<PInt> ) => TermInt
} =>

@@ -451,3 +449,3 @@ {

"$",
( index: Term<PInt> ): TermInt =>
( index: PappArg<PInt> ): TermInt =>
addPIntMethods( papp( idxOfBS, index ) )

@@ -522,6 +520,6 @@ ) as any;

& {
$: ( input: Term<PString> ) =>
$: ( input: PappArg<PString> ) =>
Term<PLam<PString,PString>>
& {
$: ( input: Term<PString> ) =>
$: ( input: PappArg<PString> ) =>
TermStr

@@ -556,6 +554,6 @@ }

& {
$: ( input: Term<PString> ) =>
$: ( input: PappArg<PString> ) =>
Term<PLam<PString,PBool>>
& {
$: ( input: Term<PString> ) =>
$: ( input: PappArg<PString> ) =>
TermBool

@@ -589,3 +587,3 @@ }

& {
$: ( str: Term<PString> ) => TermBS
$: ( str: PappArg<PString> ) => TermBS
} = (() => {

@@ -600,3 +598,3 @@ const encodeUtf8 =new Term<PLam<PString, PByteString>>(

"$",
( str: Term<PString> ): TermBS => addPByteStringMethods( papp( encodeUtf8, str ) )
( str: PappArg<PString> ): TermBS => addPByteStringMethods( papp( encodeUtf8, str ) )
)

@@ -607,3 +605,3 @@ })()

& {
$: ( str: Term<PByteString> ) => TermStr
$: ( str: PappArg<PByteString> ) => TermStr
} = (() => {

@@ -618,3 +616,3 @@ const decodeUtf8 =new Term<PLam<PByteString, PString>>(

"$",
( byteStr: Term<PByteString> ): TermStr => addPStringMethods( papp( decodeUtf8, byteStr ) )
( byteStr: PappArg<PByteString> ): TermStr => addPStringMethods( papp( decodeUtf8, byteStr ) )
)

@@ -708,14 +706,14 @@ })()

& {
$: (condition: Term<PBool>) =>
$: (condition: PappArg<PBool>) =>
Term<PLam< ToPType<ReturnT>, PLam< ToPType<ReturnT>, ToPType<ReturnT>>>>
& {
then: ( caseTrue: Term<ToPType<ReturnT>> ) =>
then: ( caseTrue: PappArg<ToPType<ReturnT>> ) =>
TermFn<[ ToPType<ReturnT> ], ToPType<ReturnT> >
& {
else: ( caseFalse: Term<ToPType<ReturnT>> ) =>
else: ( caseFalse: PappArg<ToPType<ReturnT>> ) =>
Term<ToPType<ReturnT>>
},
$: ( caseTrue: Term<ToPType<ReturnT>> ) =>
$: ( caseTrue: PappArg<ToPType<ReturnT>> ) =>
TermFn<[ ToPType<ReturnT> ], ToPType<ReturnT> > & {
else: ( caseFalse: Term<ToPType<ReturnT>> ) =>
else: ( caseFalse: PappArg<ToPType<ReturnT>> ) =>
Term<ToPType<ReturnT>>

@@ -809,3 +807,3 @@ }

& {
$: ( bool: Term<PBool> ) => TermBool
$: ( bool: PappArg<PBool> ) => TermBool
}

@@ -827,6 +825,6 @@ =

& {
$: ( bool: Term<PBool> ) =>
$: ( bool: PappArg<PBool> ) =>
Term<PLam<PBool, PBool>>
& {
$: ( bool: Term<PBool> ) => TermBool
$: ( bool: PappArg<PBool> ) => TermBool
}

@@ -851,6 +849,6 @@ }

& {
$: ( bool: Term<PBool> ) =>
$: ( bool: PappArg<PBool> ) =>
Term<PLam<PDelayed<PBool>, PBool>>
& {
$: ( bool: Term<PDelayed<PBool>> ) => TermBool
$: ( bool: PappArg<PDelayed<PBool>> ) => TermBool
}

@@ -875,6 +873,6 @@ }

& {
$: ( bool: Term<PBool> ) =>
$: ( bool: PappArg<PBool> ) =>
Term<PLam<PBool, PBool>>
& {
$: ( bool: Term<PBool> ) => TermBool
$: ( bool: PappArg<PBool> ) => TermBool
}

@@ -899,6 +897,6 @@ }

& {
$: ( bool: Term<PBool> ) =>
$: ( bool: PappArg<PBool> ) =>
Term<PLam<PDelayed<PBool>, PBool>>
& {
$: ( bool: Term<PDelayed<PBool>> ) => TermBool
$: ( bool: PappArg<PDelayed<PBool>> ) => TermBool
}

@@ -996,14 +994,14 @@ }

& {
$: ( list: Term<PList< ToPType<ListElemT> >>) =>
$: ( list: PappArg<PList< ToPType<ListElemT> >>) =>
Term<PLam<ToPType<ReturnT>, PLam<ToPType<ReturnT>, ToPType<ReturnT>>>>
& {
caseNil: ( nilCase: Term<ToPType<ReturnT>> ) =>
caseNil: ( nilCase: PappArg<ToPType<ReturnT>> ) =>
TermFn<[ ToPType<ReturnT> ], ToPType<ReturnT> >
& {
caseCons: ( consCase: Term<ToPType<ReturnT>> ) =>
caseCons: ( consCase: PappArg<ToPType<ReturnT>> ) =>
Term<ToPType<ReturnT>>
},
$: ( nilCase: Term<ToPType<ReturnT>> ) =>
$: ( nilCase: PappArg<ToPType<ReturnT>> ) =>
TermFn<[ ToPType<ReturnT> ], ToPType<ReturnT> > & {
caseCons: ( consCase: Term<ToPType<ReturnT>> ) =>
caseCons: ( consCase: PappArg<ToPType<ReturnT>> ) =>
Term<ToPType<ReturnT>>

@@ -1144,4 +1142,4 @@ }

// without this it would be impossoble to read
type CaseBFn<RetT extends PType> = ( bCase: Term< RetT > ) => Term<RetT>
export type CaseIFn<RetT extends PType> = ( iCase: Term< RetT > ) =>
type CaseBFn<RetT extends PType> = ( bCase: PappArg< RetT > ) => UtilityTermOf<RetT>
export type CaseIFn<RetT extends PType> = ( iCase: PappArg< RetT > ) =>
Term<PLam<RetT , RetT >>

@@ -1152,3 +1150,3 @@ & {

};
export type CaseListFn<RetT extends PType> = ( listCase: Term<RetT> ) =>
export type CaseListFn<RetT extends PType> = ( listCase: PappArg<RetT> ) =>
Term<PLam<RetT, PLam<RetT , RetT >>>

@@ -1159,3 +1157,3 @@ & {

}
export type CaseMapFn<RetT extends PType> = ( mapCase: Term< RetT > ) =>
export type CaseMapFn<RetT extends PType> = ( mapCase: PappArg< RetT > ) =>
Term<PLam<RetT, PLam<RetT, PLam<RetT , RetT >>>>

@@ -1166,3 +1164,3 @@ & {

}
export type CaseConstrFn<RetT extends PType> = ( constrCase: Term< RetT > ) =>
export type CaseConstrFn<RetT extends PType> = ( constrCase: PappArg< RetT > ) =>
Term<PLam<RetT, PLam<RetT, PLam<RetT, PLam<RetT , RetT >>>>>

@@ -1184,3 +1182,3 @@ & {

& {
$: ( pdata: Term<PData> ) =>
$: ( pdata: PappArg<PData> ) =>
Term<PLam< ToPType<ReturnT>, PLam<ToPType<ReturnT>, PLam<ToPType<ReturnT>, PLam<ToPType<ReturnT>, PLam<ToPType<ReturnT> , ToPType<ReturnT> >>>>>>

@@ -1402,3 +1400,3 @@ & {

& {
$: ( dataBS: Term<PDataBS> ) => TermBS
$: ( dataBS: PappArg<PDataBS> ) => TermBS
} = (() => {

@@ -1405,0 +1403,0 @@ const unBData = new Term<PLam<PDataBS, PByteString>>(

import PType from "../../PType";
import { pBool, TermFn } from "../../PTypes";
import PBool from "../../PTypes/PBool";
import PBool, { pBool } from "../../PTypes/PBool";
import { TermFn } from "../../PTypes/PFn/PLam";
import pmatch from "../../PTypes/PStruct/pmatch";
import { phoist, plam } from "../../Syntax/syntax";
import Term from "../../Term";
import { bool, tyVar } from "../../Term/Type/base";
import type Term from "../../Term";
import { bool } from "../../Term/Type/base";
import PMaybe, { PMaybeT } from "./PMaybe";

@@ -9,0 +9,0 @@

@@ -1,2 +0,2 @@

import { PFn, PLam, TermFn } from "../..";
import { PFn, PLam, PPair, TermFn } from "../..";
import ObjectUtils from "../../../../utils/ObjectUtils";

@@ -13,6 +13,8 @@ import PType, { PDataRepresentable } from "../../PType";

import { papp } from "../../Syntax";
import { PappArg } from "../../Syntax/pappArg";
import Term from "../../Term";
import Type, { AliasTermType, bool, bs, ConstantableTermType, int, list, PrimType, str, structType, TermType, ToPType } from "../../Term/Type/base";
import Type, { AliasTermType, bool, bs, ConstantableTermType, int, list, pair, PrimType, str, structType, TermType, ToPType } from "../../Term/Type/base";
import { typeExtends } from "../../Term/Type/extension";
import { isAliasType, isConstantableStructType, isLambdaType, isStructType } from "../../Term/Type/kinds";
import TermPair, { addPPairMethods } from "../TermPair";
import TermAlias from "./TermAlias";

@@ -42,2 +44,3 @@ import TermBool, { addPBoolMethods } from "./TermBool";

PElem extends PList<infer PListElem extends PType> ? TermList<PListElem> :
PElem extends PPair<infer PFst extends PType,infer PSnd extends PType> ? TermPair<PFst,PSnd> :
PElem extends PString ? TermStr :

@@ -47,3 +50,3 @@ PElem extends PStruct<infer SDef extends ConstantableStructDefinition> ? TermStruct<SDef> :

Term<PElem> & {
$: ( input: Term<PInput> ) => UtilityTermOf<POutput>
$: ( input: PappArg<PInput> ) => UtilityTermOf<POutput>
} :

@@ -63,2 +66,3 @@ PElem extends PAlias<infer T extends ConstantableTermType, infer AliasId extends symbol, any> ? FiniteTermAlias<T, AliasId> :

if( typeExtends( t , list( Type.Any ) ) ) return addPListMethods as any;
if( typeExtends( t , pair( Type.Any, Type.Any ) ) ) return addPPairMethods as any;
if( typeExtends( t , str ) ) return addPStringMethods as any;

@@ -65,0 +69,0 @@

import { por, pand, pstrictOr, pstrictAnd } from "../Builtins";
import ObjectUtils from "../../../../utils/ObjectUtils";
import PBool from "../../PTypes/PBool";
import PBool, { pBool } from "../../PTypes/PBool";
import Term from "../../Term";

@@ -9,3 +9,4 @@ import { TermFn } from "../../PTypes/PFn/PLam";

import PDelayed from "../../PTypes/PDelayed";
import { delayed } from "../../Term/Type/base";
import { bool, delayed } from "../../Term/Type/base";
import type { PappArg } from "../../Syntax/pappArg";

@@ -15,12 +16,12 @@ type TermBool = Term<PBool> & {

readonly orTerm: TermFn<[ PDelayed<PBool> ], PBool>
readonly or: ( other: Term<PBool> ) => TermBool
readonly or: ( other: PappArg<PBool> ) => TermBool
readonly strictOrTerm: TermFn<[ PBool ], PBool>
readonly strictOr: ( other: Term<PBool> ) => TermBool
readonly strictOr: ( other: PappArg<PBool> ) => TermBool
readonly andTerm: TermFn<[ PDelayed<PBool> ], PBool>
readonly and: ( other: Term<PBool> ) => TermBool
readonly and: ( other: PappArg<PBool> ) => TermBool
readonly strictAndTerm: TermFn<[ PBool ], PBool>
readonly strictAnd: ( other: Term<PBool> ) => TermBool
readonly strictAnd: ( other: PappArg<PBool> ) => TermBool

@@ -55,3 +56,9 @@ }

"or",
( other: Term<PBool> ): TermBool => por.$( term ).$( pdelay( other ) )
( other: Term<PBool> | boolean ): TermBool =>
por
.$( term )
.$( pdelay(
typeof other === "boolean" ?
pBool( other ) : other
))
);

@@ -67,3 +74,3 @@

"strictOr",
( other: Term<PBool> ): TermBool => pstrictOr.$( term ).$( other )
( other: PappArg<PBool> ): TermBool => pstrictOr.$( term ).$( other )
);

@@ -80,3 +87,9 @@

"and",
( other: Term<PBool> ): TermBool => pand.$( term ).$( pdelay( other ) )
( other: Term<PBool> | boolean ): TermBool =>
pand
.$( term )
.$( pdelay(
typeof other === "boolean" ?
pBool( other ) : other
))
);

@@ -92,3 +105,3 @@

"strictAnd",
( other: Term<PBool> ): TermBool => pstrictAnd.$( term ).$( other )
( other: PappArg<PBool> ): TermBool => pstrictAnd.$( term ).$( other )
);

@@ -95,0 +108,0 @@

@@ -13,2 +13,3 @@ import { flippedCons, pappendBs, pconsBs, pdecodeUtf8, peqBs, pgreaterBS, pgreaterEqBS, pindexBs, plengthBs, plessBs, plessEqBs, psliceBs, psub } from "../Builtins";

import TermBool from "./TermBool";
import { PappArg } from "../../Syntax/pappArg";

@@ -24,33 +25,33 @@

readonly concatTerm: TermFn<[PByteString], PByteString>
readonly concat: ( other: Term<PByteString>) => TermBS
readonly concat: ( other: PappArg<PByteString>) => TermBS
// pconsBs
readonly prependTerm: TermFn<[PInt], PByteString>
readonly prepend: ( byte: Term<PInt> ) => TermBS
readonly prepend: ( byte: PappArg<PInt> ) => TermBS
// psliceBs
readonly subByteStringTerm: TermFn<[PInt, PInt], PByteString>
readonly subByteString: ( fromInclusive: Term<PInt>, ofLength: Term<PInt> ) => TermBS
readonly subByteString: ( fromInclusive: PappArg<PInt>, ofLength: PappArg<PInt> ) => TermBS
readonly sliceTerm: TermFn<[PInt, PInt], PByteString>
readonly slice: ( fromInclusive: Term<PInt>, toExclusive: Term<PInt> ) => TermBS
readonly slice: ( fromInclusive: PappArg<PInt>, toExclusive: PappArg<PInt> ) => TermBS
// pindexBs
readonly atTerm: TermFn<[PInt], PInt>
readonly at: ( index: Term<PInt> ) => TermInt
readonly at: ( index: PappArg<PInt> ) => TermInt
readonly eqTerm: TermFn<[PByteString], PBool>
readonly eq: ( other: Term<PByteString> ) => TermBool
readonly eq: ( other: PappArg<PByteString> ) => TermBool
readonly ltTerm: TermFn<[PByteString], PBool>
readonly lt: ( other: Term<PByteString> ) => TermBool
readonly lt: ( other: PappArg<PByteString> ) => TermBool
readonly ltEqTerm: TermFn<[PByteString], PBool>
readonly ltEq: ( other: Term<PByteString> ) => TermBool
readonly ltEq: ( other: PappArg<PByteString> ) => TermBool
readonly gtTerm: TermFn<[PByteString], PBool>
readonly gt: ( other: Term<PByteString> ) => TermBool
readonly gt: ( other: PappArg<PByteString> ) => TermBool
readonly gtEqTerm: TermFn<[PByteString], PBool>
readonly gtEq: ( other: Term<PByteString> ) => TermBool
readonly gtEq: ( other: PappArg<PByteString> ) => TermBool

@@ -109,3 +110,3 @@ }

"concat",
( other: Term<PByteString>): TermBS => pappendBs.$( term ).$( other )
( other: PappArg<PByteString>): TermBS => pappendBs.$( term ).$( other )
);

@@ -121,3 +122,3 @@

"prepend",
( byte: Term<PInt>): TermBS => pconsBs.$( byte ).$( term )
( byte: PappArg<PInt>): TermBS => pconsBs.$( byte ).$( term )
);

@@ -133,3 +134,3 @@

"subByteString",
( fromInclusive: Term<PInt>, ofLength: Term<PInt> ): TermBS => psliceBs.$( fromInclusive ).$( ofLength ).$( term )
( fromInclusive: PappArg<PInt>, ofLength: PappArg<PInt> ): TermBS => psliceBs.$( fromInclusive ).$( ofLength ).$( term )
);

@@ -145,3 +146,3 @@

"slice",
( fromInclusive: Term<PInt>, toExclusive: Term<PInt> ): TermBS => jsLikeSlice.$( term ).$( fromInclusive ).$( toExclusive )
( fromInclusive: PappArg<PInt>, toExclusive: PappArg<PInt> ): TermBS => jsLikeSlice.$( term ).$( fromInclusive ).$( toExclusive )
);

@@ -157,3 +158,3 @@

"at",
( index: Term<PInt> ): TermInt => pindexBs.$( term ).$( index )
( index: PappArg<PInt> ): TermInt => pindexBs.$( term ).$( index )
);

@@ -169,3 +170,3 @@

"eq",
( other: Term<PByteString> ): TermBool => peqBs.$( term ).$( other )
( other: PappArg<PByteString> ): TermBool => peqBs.$( term ).$( other )
);

@@ -181,3 +182,3 @@

"lt",
( other: Term<PByteString> ): TermBool => plessBs.$( term ).$( other )
( other: PappArg<PByteString> ): TermBool => plessBs.$( term ).$( other )
);

@@ -193,3 +194,3 @@

"ltEq",
( other: Term<PByteString> ): TermBool => plessEqBs.$( term ).$( other )
( other: PappArg<PByteString> ): TermBool => plessEqBs.$( term ).$( other )
);

@@ -205,3 +206,3 @@

"gt",
( other: Term<PByteString> ): TermBool => pgreaterBS.$( term ).$( other )
( other: PappArg<PByteString> ): TermBool => pgreaterBS.$( term ).$( other )
);

@@ -217,3 +218,3 @@

"gtEq",
( other: Term<PByteString> ): TermBool => pgreaterEqBS.$( term ).$( other )
( other: PappArg<PByteString> ): TermBool => pgreaterEqBS.$( term ).$( other )
);

@@ -220,0 +221,0 @@

@@ -8,2 +8,3 @@ import { padd, psub, pmult, pdiv, pquot, prem, pmod, peqInt, plessInt, plessEqInt, pgreaterInt, pgreaterEqInt } from "../Builtins"

import PBool from "../../PTypes/PBool"
import { PappArg } from "../../Syntax/pappArg"

@@ -13,37 +14,37 @@ type TermInt = Term<PInt> & {

readonly addTerm: TermFn<[PInt], PInt>
readonly add: ( other: Term<PInt> ) => TermInt
readonly add: ( other: PappArg<PInt> ) => TermInt
readonly subTerm: TermFn<[PInt], PInt>
readonly sub: ( other: Term<PInt> ) => TermInt
readonly sub: ( other: PappArg<PInt> ) => TermInt
readonly multTerm: TermFn<[PInt], PInt>
readonly mult: ( other: Term<PInt> ) => TermInt
readonly mult: ( other: PappArg<PInt> ) => TermInt
readonly divTerm: TermFn<[PInt], PInt>
readonly div: ( other: Term<PInt> ) => TermInt
readonly div: ( other: PappArg<PInt> ) => TermInt
readonly quotTerm: TermFn<[PInt], PInt>
readonly quot: ( other: Term<PInt> ) => TermInt
readonly quot: ( other: PappArg<PInt> ) => TermInt
readonly remainderTerm: TermFn<[PInt], PInt>
readonly remainder: ( other: Term<PInt> ) => TermInt
readonly remainder: ( other: PappArg<PInt> ) => TermInt
readonly modTerm: TermFn<[PInt], PInt>
readonly mod: ( other: Term<PInt> ) => TermInt
readonly mod: ( other: PappArg<PInt> ) => TermInt
readonly eqTerm: TermFn<[PInt], PBool>
readonly eq: ( other: Term<PInt> ) => TermBool
readonly eq: ( other: PappArg<PInt> ) => TermBool
readonly ltTerm: TermFn<[PInt], PBool>
readonly lt: ( other: Term<PInt> ) => TermBool
readonly lt: ( other: PappArg<PInt> ) => TermBool
readonly ltEqTerm: TermFn<[PInt], PBool>
readonly ltEq: ( other: Term<PInt> ) => TermBool
readonly ltEq: ( other: PappArg<PInt> ) => TermBool
readonly gtTerm: TermFn<[PInt], PBool>
readonly gt: ( other: Term<PInt> ) => TermBool
readonly gt: ( other: PappArg<PInt> ) => TermBool
readonly gtEqTerm: TermFn<[PInt], PBool>
readonly gtEq: ( other: Term<PInt> ) => TermBool
readonly gtEq: ( other: PappArg<PInt> ) => TermBool

@@ -65,3 +66,3 @@ };

"add",
( other: Term<PInt> ): TermInt => padd.$( term ).$( other )
( other: PappArg<PInt> ): TermInt => padd.$( term ).$( other )
);

@@ -77,3 +78,3 @@

"sub",
( other: Term<PInt> ): TermInt => psub.$( term ).$( other )
( other: PappArg<PInt> ): TermInt => psub.$( term ).$( other )
);

@@ -89,3 +90,3 @@

"mult",
( other: Term<PInt> ): TermInt => pmult.$( term ).$( other )
( other: PappArg<PInt> ): TermInt => pmult.$( term ).$( other )
);

@@ -101,3 +102,3 @@

"div",
( other: Term<PInt> ): TermInt => pdiv.$( term ).$( other )
( other: PappArg<PInt> ): TermInt => pdiv.$( term ).$( other )
);

@@ -113,3 +114,3 @@

"quot",
( other: Term<PInt> ): TermInt => pquot.$( term ).$( other )
( other: PappArg<PInt> ): TermInt => pquot.$( term ).$( other )
);

@@ -125,3 +126,3 @@

"remainder",
( other: Term<PInt> ): TermInt => prem.$( term ).$( other )
( other: PappArg<PInt> ): TermInt => prem.$( term ).$( other )
);

@@ -137,3 +138,3 @@

"mod",
( other: Term<PInt> ): TermInt => pmod.$( term ).$( other )
( other: PappArg<PInt> ): TermInt => pmod.$( term ).$( other )
);

@@ -150,3 +151,3 @@

"eq",
( other: Term<PInt> ): TermBool => peqInt.$( term ).$( other )
( other: PappArg<PInt> ): TermBool => peqInt.$( term ).$( other )
);

@@ -162,3 +163,3 @@

"lt",
( other: Term<PInt> ): TermBool => plessInt.$( term ).$( other )
( other: PappArg<PInt> ): TermBool => plessInt.$( term ).$( other )
);

@@ -174,3 +175,3 @@

"ltEq",
( other: Term<PInt> ): TermBool => plessEqInt.$( term ).$( other )
( other: PappArg<PInt> ): TermBool => plessEqInt.$( term ).$( other )
);

@@ -186,3 +187,3 @@

"gt",
( other: Term<PInt> ): TermBool => pgreaterInt.$( term ).$( other )
( other: PappArg<PInt> ): TermBool => pgreaterInt.$( term ).$( other )
);

@@ -198,3 +199,3 @@

"gtEq",
( other: Term<PInt> ): TermBool => pgreaterEqInt.$( term ).$( other )
( other: PappArg<PInt> ): TermBool => pgreaterEqInt.$( term ).$( other )
);

@@ -201,0 +202,0 @@

@@ -9,2 +9,3 @@

import PList from "../../PTypes/PList"
import { PappArg } from "../../Syntax/pappArg";
import { phoist } from "../../Syntax/syntax";

@@ -17,3 +18,3 @@ import Term from "../../Term";

import { plength, preverse } from "../List";
import { pevery, pfilter, pfind, pfindList, pindexList, pmap, psome } from "../List/methods";
import { pevery, pfilter, pfind, pindexList, pmap, psome } from "../List/methods";
import { pflip } from "../PCombinators";

@@ -78,6 +79,6 @@ import { PMaybeT } from "../PMaybe/PMaybe";

readonly atTerm: TermFn<[PInt], PElemsT>
readonly at: ( index: Term<PInt> ) => UtilityTermOf<PElemsT>
readonly at: ( index: PappArg<PInt> ) => UtilityTermOf<PElemsT>
readonly findTerm: TermFn<[PLam<PElemsT,PBool>], PMaybeT<PElemsT>>
readonly find: ( predicate: Term<PLam<PElemsT,PBool>> ) => Term<PMaybeT<PElemsT>>
readonly find: ( predicate: PappArg<PLam<PElemsT,PBool>> ) => Term<PMaybeT<PElemsT>>

@@ -87,7 +88,7 @@ // readonly includes: TermFn<[PElemsT], PBool>

readonly filterTerm: TermFn<[PLam<PElemsT,PBool>], PList<PElemsT>>
readonly filter: ( predicate: Term<PLam<PElemsT,PBool>> ) => TermList<PElemsT>
readonly filter: ( predicate: PappArg<PLam<PElemsT,PBool>> ) => TermList<PElemsT>
// list creation
readonly prependTerm: TermFn<[PElemsT], PList<PElemsT>>
readonly prepend: ( elem: Term<PElemsT> ) => TermList<PElemsT>
readonly prepend: ( elem: PappArg<PElemsT> ) => TermList<PElemsT>
// readonly concat: TermFn<[PList<PElemsT>], PList<PElemsT>>

@@ -97,3 +98,3 @@

readonly mapTerm: <ResultT extends ConstantableTermType>( resultT: ResultT ) => TermFn<[PLam<PElemsT, ToPType<ResultT>>], PList<ToPType<ResultT>>>
readonly map: <PResultElemT extends PType>( f: Term<PLam<PElemsT,PResultElemT>> ) => TermList<PResultElemT>
readonly map: <PResultElemT extends PType>( f: PappArg<PLam<PElemsT,PResultElemT>> ) => TermList<PResultElemT>
// readonly reduce: <ResultT extends ConstantableTermType>( resultT: ResultT ) => TermFn<[PLam<ToPType<ResultT>, PLam<PList<PElemsT>, ToPType<ResultT>>>], ToPType<ResultT>>

@@ -103,6 +104,6 @@

readonly everyTerm: TermFn<[PLam<PElemsT, PBool>], PBool>
readonly every: ( predicate: Term<PLam<PElemsT, PBool>> ) => TermBool
readonly every: ( predicate: PappArg<PLam<PElemsT, PBool>> ) => TermBool
readonly someTerm: TermFn<[PLam<PElemsT, PBool>], PBool>
readonly some: ( predicate: Term<PLam<PElemsT, PBool>> ) => TermBool
readonly some: ( predicate: PappArg<PLam<PElemsT, PBool>> ) => TermBool
};

@@ -186,3 +187,3 @@

"at",
( index: Term<PInt> ): UtilityTermOf<PElemsT> => pindexList( elemsT ).$( list ).$( index ) as any
( index: PappArg<PInt> ): UtilityTermOf<PElemsT> => pindexList( elemsT ).$( list ).$( index ) as any
);

@@ -198,4 +199,4 @@

"find",
( predicate: Term<PLam<PElemsT,PBool>> ): Term<PMaybeT<PElemsT>> =>
pfind( elemsT ).$( predicate ).$( list ) as any
( predicate: PappArg<PLam<PElemsT,PBool>> ): Term<PMaybeT<PElemsT>> =>
pfind( elemsT ).$( predicate as any ).$( list ) as any
);

@@ -211,4 +212,4 @@

"filter",
( predicate: Term<PLam<PElemsT,PBool>> ): TermList<PElemsT> =>
pfilter( elemsT ).$( predicate ).$( list ) as any
( predicate: PappArg<PLam<PElemsT,PBool>> ): TermList<PElemsT> =>
pfilter( elemsT ).$( predicate as any ).$( list ) as any
);

@@ -224,3 +225,3 @@

"prepend",
( elem: Term<PElemsT> ): TermList<PElemsT> => pprepend( elemsT ).$( elem ).$( list ) as any
( elem: PappArg<PElemsT> ): TermList<PElemsT> => pprepend( elemsT ).$( elem ).$( list ) as any
);

@@ -261,3 +262,3 @@

"every",
( predicate: Term<PLam<PElemsT, PBool>> ): TermBool => pevery( elemsT ).$( predicate ).$( list )
( predicate: PappArg<PLam<PElemsT, PBool>> ): TermBool => pevery( elemsT ).$( predicate as any ).$( list )
);

@@ -274,3 +275,3 @@

"some",
( predicate: Term<PLam<PElemsT, PBool>> ): TermBool => psome( elemsT ).$( predicate ).$( list )
( predicate: PappArg<PLam<PElemsT, PBool>> ): TermBool => psome( elemsT ).$( predicate as any ).$( list )
);

@@ -277,0 +278,0 @@

@@ -9,2 +9,3 @@ import { pappendStr, pencodeUtf8, peqStr } from "../Builtins";

import TermBool from "./TermBool";
import { PappArg } from "../../Syntax/pappArg";

@@ -16,6 +17,6 @@ type TermStr = Term<PString> & {

readonly concatTerm: TermFn<[ PString ], PString>
readonly concat: ( other: Term<PString> ) => TermStr
readonly concat: ( other: PappArg<PString> ) => TermStr
readonly eqTerm: TermFn<[ PString ], PBool >
readonly eq: ( other: Term<PString> ) => TermBool
readonly eq: ( other: PappArg<PString> ) => TermBool
}

@@ -41,3 +42,3 @@

"concat",
( other: Term<PString> ): TermStr => pappendStr.$( term ).$( other )
( other: PappArg<PString> ): TermStr => pappendStr.$( term ).$( other )
);

@@ -53,3 +54,3 @@

"eq",
( other: Term<PString> ): TermBool => peqStr.$( term ).$( other )
( other: PappArg<PString> ): TermBool => peqStr.$( term ).$( other )
);

@@ -56,0 +57,0 @@

@@ -26,2 +26,3 @@ import BasePlutsError from "../../../errors/BasePlutsError";

import punsafeConvertType from "./punsafeConvertType";
import pappArgToTerm, { PappArg } from "./pappArg";

@@ -45,3 +46,3 @@

& {
$: ( someInput: Term<OutIn> ) => PappResult<OutOut>
$: ( someInput: PappArg<OutIn> ) => PappResult<OutOut>
} :

@@ -58,3 +59,3 @@ UtilityTermOf<Output>

*/
export function papp<Input extends PType, Output extends PType>( a: Term<PLam<Input,Output>>, b: Term<Input> )
export function papp<Input extends PType, Output extends PType>( a: Term<PLam<Input,Output>>, b: PappArg<Input> )
: UtilityTermOf<Output>

@@ -68,7 +69,16 @@ {

JsRuntime.assert(
typeExtends( b.type, lambdaType[ 1 ] ),
"while applying 'Lambda'; unexpected type of input; it should be possible to assign the input to \"" + termTypeToString( lambdaType[1] ) +
"\"; received input was of type: \"" + termTypeToString( b.type ) + "\""
);
let _b: Term<Input>;
if( b instanceof Term )
{
JsRuntime.assert(
typeExtends( b.type, lambdaType[ 1 ] ),
"while applying 'Lambda'; unexpected type of input; it should be possible to assign the input to \"" + termTypeToString( lambdaType[1] ) +
"\"; received input was of type: \"" + termTypeToString( b.type ) + "\""
);
_b = b as any;
}
else
{
_b = pappArgToTerm( b, lambdaType[1] ) as any;
}

@@ -159,6 +169,6 @@ const outputType = applyLambdaType( lambdaType, b.type );

export type TermFnFromTypes<Ins extends [ TermType, ...TermType[] ], Out extends TermType> =
Ins extends [ infer T extends TermType ] ? Term<PLam<ToPType<T>, ToPType<Out>>> & { $: ( input: Term<ToPType<T>> ) => UtilityTermOf<ToPType<Out>> } :
Ins extends [ infer T extends TermType ] ? Term<PLam<ToPType<T>, ToPType<Out>>> & { $: ( input: PappArg<ToPType<T>> ) => UtilityTermOf<ToPType<Out>> } :
Ins extends [ infer T extends TermType, ...infer RestIns extends [ TermType, ...TermType[] ] ] ?
Term<PLam<ToPType<T>,PFnFromTypes<RestIns, Out>>>
& { $: ( input: Term<ToPType<T>> ) => TermFnFromTypes< RestIns, Out > } :
& { $: ( input: PappArg<ToPType<T>> ) => TermFnFromTypes< RestIns, Out > } :
never

@@ -165,0 +175,0 @@

@@ -5,3 +5,2 @@ import Type, { int, pair, TermType } from "../base";

import { typeExtends } from "../extension";
import { termTypeToString } from "../utils";

@@ -8,0 +7,0 @@ const allTypesFixed = [

@@ -69,3 +69,3 @@ import BasePlutsError from "../../errors/BasePlutsError";

this is not supposed to happen, please open an issue explaining how you got here: \
https://github.com/HarmonicPool/plu-ts/issues") as E);
https://github.com/HarmonicLabs/plu-ts/issues") as E);
}

@@ -72,0 +72,0 @@

@@ -41,3 +41,6 @@

{
return (Object.keys( obj ).length === n);
return (
ObjectUtils.isObject( obj ) &&
Object.keys( obj ).length === n
);
}

@@ -57,3 +60,3 @@

static has_n_determined_keys( obj: object, n : number, ...keys: string[] ): boolean
static has_n_determined_keys<Keys extends string[]>( obj: object, n : number, ...keys: Keys ): boolean
{

@@ -67,3 +70,7 @@ return (

static hasOwn: ( obj: object, propName: string | number | symbol ) => boolean = ((Object as any).hasOwn ?? Object.prototype.hasOwnProperty.call) ?? ObjectUtils.containsKeys;
static hasOwn: ( obj: object, propName: string | number | symbol ) => boolean =
(
(Object as any).hasOwn ??
Object.prototype.hasOwnProperty.call
) ?? ObjectUtils.containsKeys;

@@ -70,0 +77,0 @@ static isSerializable( obj: object ): boolean

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