如何使用 Javascript 在 Angular 2/4 中制作自定义管道(无打字稿)

How to make custom Pipes in Angular 2/4 with Javascript (no typescript)

我想为我的 angular 4 应用程序制作一个自定义管道,但我找到的所有资源都只展示了如何在 TypeScript 中制作管道。我必须使用 JavaScript。任何人都可以在 JavaScript 中解释如何执行此操作吗?

找到了。来自 https://angular.io/docs/ts/latest/cookbook/ts-to-js.html

app.MyPipe = ng.core.Pipe({
  name: 'myPipe'
}).Class({
    constructor: function () {
    }, transform: function (input) {
        return input ? 'Yep' : 'Oh, I don't think so';

    }
});