Skip to main content
Glama
tests.js•911 B
'use strict'; var forEach = require('foreach'); module.exports = function (escape, t) { t.test('simple strings', function (st) { var strings = [ 'The Quick Brown Fox', 'hello there', '' ]; forEach(strings, function (str) { st.equal(escape(str), str, JSON.stringify(str) + ' escapes to itself.'); }); st.end(); }); t.test('strings that need escaping', function (st) { st.equal(escape('hi. how are you?'), 'hi\\. how are you\\?'); var syntaxCharacters = '^$\\.*+?()[]{}|'; st.equal(escape(syntaxCharacters).length, syntaxCharacters.length * 2); st.equal(escape('\uD834\uDF06.'), '\uD834\uDF06\\.'); st.end(); }); t.test('non-strings', function (st) { var strings = [ 'hello there', '^$\\.*+?()[]{}|', '\uD834\uDF06.' ]; forEach(strings, function (str) { st.equal(escape({ toString: function () { return str; } }), escape(str)); }); st.end(); }); };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/guangxiangdebizi/PPT-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server