@neoncitylights/types
v0.0.0
Published
A library of utility types for TypeScript
Readme
types
A small library of utility types for TypeScript.
Install
npm install @neoncitylights/typesAPI
Functions (fn.d.ts)
FnArity1<T1, R>- A type representing a function with an arity of 1, or a function that takes 1 argument (T1) and a return type ofR.FnArity2<T1, T2, R>- A type representing a function with an arity of 2, or a function that takes 2 arguments (T1,T2) and a return type ofR.FnArity3<T1, T2, T3, R>- A type representing a function with an arity of 3, or a function that takes 3 arguments (T1,T2,T3) and a return type ofR.FnArity4<T1, T2, T3, T4, R>- A type representing a function with an arity of 4, or a function that takes 4 arguments (T1,T2,T3,T4) and a return type ofR.PredicateFnArity1<T1>- A type representing a predicate function with an arity of 1, or a function that takes 1 argument (T1) and returns aboolean.PredicateFnArity2<T1, T2>- A type representing a predicate function with an arity of 2, or a function that takes 2 arguments (T1,T2) and returns aboolean.PredicateFnArity3<T1, T2, T3>- A type representing a predicate function with an arity of 3, or a function that takes 3 arguments (T1,T2,T3) and returns aboolean.PredicateFnArity4<T1, T2, T3, T4>- A type representing a predicate function with an arity of 4, or a function that takes 4 arguments (T1,T2,T3,T4) and returns aboolean.
Logic gates (logic.d.ts)
Not<A>: A type representing the logical NOT gate ofA, or logical negation.And<A, B>: A type representing the logical AND gate ofAandB, or logical conjunction.Or<A, B>: A type representing the logical OR gate ofAandB, or logical disjunction.Nor<A, B>: A type representing the logical NOR gate ofAandB, or logical non-disjunction. A special type of gate that is functionally complete (capable of expressing all possible truth tables).Nand<A, B>: A type representing the logical NAND gate ofAandB. A special type of gate that is functionally complete (capable of expressing all possible truth tables).Xor<A, B>: A type representing the logical XOR gate ofAandB, or exclusive disjunction/exclsuive OR.Xnor<A, B>: A type representing the logical XNOR gate ofAandB, or logical biconditional.
Strings (strings.d.ts)
Affix: A string union type representing the possible affixes of a string:'prefix'or'suffix'. Intended for use with generic types such asAffixedWithorRemoveAffix.StartsWith<V, P>: A conditional type representing whether a string valueVstarts with a prefixP; evaluates to aboolean.EndsWith<V, S>: A conditional type representing whether a string valueVends with a suffixS; evaluates to aboolean.AffixedWith<V, Lit, A>: A conditional type representing whether a string valueVis affixed with an affixLitwith an affix kind ofA; evaluates to aboolean.PrefixWith<V, Lit>: A template literal type representing the result of prefixing a string valueVwith a prefixLit; evaluates to a string literal.SuffixWith<V, Lit>: A template literal type representing the result of suffixing a string valueVwith a suffixS; evaluates to a string literal.RemovePrefix<V, Lit>: A template literal type representing the result of removing a prefixLitfrom a string valueV; evaluates to a string literal.RemoveSuffix<V, Lit>: A template literal type representing the result of removing a suffixLitfrom a string valueV; evaluates to a string literal.RemoveAffix<V, Lit, A>: A template literal type representing the result of removing an affixLitfrom a string valueVwith an affix kind ofA; evaluates to a string literal.
License
This library is licensed under the MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT).
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the MIT license, shall be licensed as above, without any additional terms or conditions.
