How to use the urijs.decodeQuery function in urijs

To help you get started, we’ve selected a few urijs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cryptowatch / embed / tests / index.js View on Github external
textStrong:   "e5e5e5",
      textWeak:     "7f7f7f",
      short:        "C60606",
      shortFill:    "C60606",
      long:         "00B909",
      longFill:     "000000",
      cta:          "363D52",
      ctaHighlight: "414A67",
      alert:        "FFD506"
    };

    var encodedColors = encodeURIComponent(JSON.stringify(colors));
    var embed = new Embed('bitfinex', 'btcusd', { customColorScheme: colors });
    var uri = new URI(embed.src);
    var encodedColors = uri.query(true)['customColorScheme'];
    var decodedColors = JSON.parse(URI.decodeQuery(encodedColors));

    // Verify that the colors were encoded correctly (order does not matter)
    for (var key in colors) {
      if (colors.hasOwnProperty(key)) {
        assert.equal(colors[key], decodedColors[key]);
      }
    }
  });