Coder Social home page Coder Social logo

Comments (1)

itshikanov avatar itshikanov commented on June 3, 2024

I'm trying to use Custom filters JavaScript replace filter.
Here is example
https://github.com/HeavyHorst/remco/blob/26a321844506ca53d2840f22e41ed6ea89043cba/docs/content/template/template-filters.md

{% for member in gets("/members/*") %}
{% set data = member.Value | parseJSON %}
{{ data.conn_url | split:"/" | index:"2" | replace:"@,/"  }}
{% endfor %}

got error

2023-07-11T15:30:29.414+0300 [INFO]  set backend nodes: backend=zookeeper nodes=["192.168.50.1:2181"] prefix=remco[1642]
2023/07/11 15:30:29 Connected to 192.168.50.1:2181
2023/07/11 15:30:29 Authenticated: id=72058294651455021, timeout=4000
2023/07/11 15:30:29 Re-submitting `0` credentials after reconnect
2023-07-11T15:30:29.420+0300 [ERROR] failed to process: prefix=remco[1642] resource=haproxy error="createStageFileAndSync failed: create stage file failed: template execution failed: [Error (where: javascript-filter:replace) | Line 35 Col 44 near 'replace'] TypeError: Object has no member 'replace' at replace (<eval>:10:23(48))"
2023-07-11T15:30:29.420+0300 [ERROR] not all templates could be rendered, trying again after 22 seconds: prefix=remco[1642] resource=haproxy

That work

{{ data.conn_url | toJSON | replace:"@,/" }}

I think because "data.conn_url | toJSON" become String. But if use another pipe, the type of data is changing. If there was toSRING filter at least, it will work

from remco.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.