All Projects → LeDDGroup → Typescript Transform Macros

LeDDGroup / Typescript Transform Macros

Licence: mit
Typescript Transform Macros

Programming Languages

typescript
32286 projects
macros
77 projects

Projects that are alternatives of or similar to Typescript Transform Macros

Ngx Dynamic Form Builder
FormBuilder + class-transformer + class-validator = dynamic form group builder for Angular10+
Stars: ✭ 93 (+9.41%)
Mutual labels:  transformer, transform
transform-graphql
⚙️ Transformer function to transform GraphQL Directives. Create model CRUD directive for example
Stars: ✭ 23 (-72.94%)
Mutual labels:  transformer, transform
Bentools Etl
PHP ETL (Extract / Transform / Load) library with SOLID principles + almost no dependency.
Stars: ✭ 45 (-47.06%)
Mutual labels:  transformer, transform
Gpt2
PyTorch Implementation of OpenAI GPT-2
Stars: ✭ 64 (-24.71%)
Mutual labels:  transformer
Kaggle Quora Insincere Questions Classification
Kaggle新赛(baseline)-基于BERT的fine-tuning方案+基于tensor2tensor的Transformer Encoder方案
Stars: ✭ 66 (-22.35%)
Mutual labels:  transformer
Distre
[ACL 19] Fine-tuning Pre-Trained Transformer Language Models to Distantly Supervised Relation Extraction
Stars: ✭ 75 (-11.76%)
Mutual labels:  transformer
Androidanimationexercise
Android 动画各种实现,包括帧动画、补间动画和属性动画的总结分享
Stars: ✭ 1,254 (+1375.29%)
Mutual labels:  transform
Viewpagertransformer
Viewpager动画,包括渐变,旋转,缩放,3D,立方体等多种酷炫效果动画,实现原理是自定义ViewpagerTransformer,当然你也可以自定义多种动画
Stars: ✭ 62 (-27.06%)
Mutual labels:  transformer
Transformers without tears
Transformers without Tears: Improving the Normalization of Self-Attention
Stars: ✭ 80 (-5.88%)
Mutual labels:  transformer
Nlp Tutorial
Natural Language Processing Tutorial for Deep Learning Researchers
Stars: ✭ 9,895 (+11541.18%)
Mutual labels:  transformer
Dialogpt
Large-scale pretraining for dialogue
Stars: ✭ 1,177 (+1284.71%)
Mutual labels:  transformer
Mixture Of Experts
A Pytorch implementation of Sparsely-Gated Mixture of Experts, for massively increasing the parameter count of language models
Stars: ✭ 68 (-20%)
Mutual labels:  transformer
Multimodal Toolkit
Multimodal model for text and tabular data with HuggingFace transformers as building block for text data
Stars: ✭ 78 (-8.24%)
Mutual labels:  transformer
Indonesian Language Models
Indonesian Language Models and its Usage
Stars: ✭ 64 (-24.71%)
Mutual labels:  transformer
Docker Nginx Image Proxy
on the fly image cropping with gravity, resize and compression microservice
Stars: ✭ 79 (-7.06%)
Mutual labels:  transform
Deeplearning Nlp Models
A small, interpretable codebase containing the re-implementation of a few "deep" NLP models in PyTorch. Colab notebooks to run with GPUs. Models: word2vec, CNNs, transformer, gpt.
Stars: ✭ 64 (-24.71%)
Mutual labels:  transformer
Awesome Typescript Ecosystem
😎 A list of awesome TypeScript transformers, plugins, handbooks, etc
Stars: ✭ 79 (-7.06%)
Mutual labels:  transformer
Se3 Transformer Pytorch
Implementation of SE3-Transformers for Equivariant Self-Attention, in Pytorch. This specific repository is geared towards integration with eventual Alphafold2 replication.
Stars: ✭ 73 (-14.12%)
Mutual labels:  transformer
Presento
Presento - Transformer & Presenter Package for PHP
Stars: ✭ 71 (-16.47%)
Mutual labels:  transformer
Ts Transform Css Modules
Extract css class names from required css module files for TypeScript
Stars: ✭ 75 (-11.76%)
Mutual labels:  transform

typescript-transform-macros

Typescript Transform Macros

Build Status Maintainability codecov

npm version code style: prettier Conventional Commits Built with Spacemacs

Examples from https://github.com/codemix/babel-plugin-macros.

Installation

npm install --save-dev typescript-transform-macros

Usage with ttypescript

Add it to plugins in your tsconfig.json

{
  "compilerOptions": {
    "plugins": [{ "transform": "typescript-transform-macros" }]
  }
}

Also declare globally the MACRO function:

declare function MACRO<T>(t: T): T;

Example

Input:

declare function MACRO<T>(t: T): T;

const MAP = MACRO(
  <T, L>(
    inputConst: T[],
    visitor: (value: T, index?: number, input?: T[]) => L
  ) => {
    const input = inputConst;
    const length = input.length;
    const result = new Array(length) as L[];
    for (let i = 0; i < length; i++) {
      result[i] = visitor(input[i], i, input);
    }
    return result;
  }
);

declare interface Array<T> {
  MAP: Array<T>["map"];
}

console.log([1, 2, 3].MAP(n => 3 * n + 1));

Output:

"use strict";
const input_1 = [1, 2, 3];
const length_1 = input_1.length;
const result_1 = new Array(length_1);
for (let i_1 = 0; i_1 < length_1; i_1++) {
  result_1[i_1] = 3 * input_1[i_1] + 1;
}
console.log(result_1);
//> [ 4, 7, 10 ]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].