<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Goldza Open Source]]></title><description><![CDATA[Technical notes, transparent calculations, and reusable JavaScript from the Goldza Open Source project.]]></description><link>https://goldza-open-source.hashnode.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1593680282896/kNC7E8IR4.png</url><title>Goldza Open Source</title><link>https://goldza-open-source.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Mon, 14 Sep 2026 13:20:25 GMT</lastBuildDate><atom:link href="https://goldza-open-source.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to compare a South African gold offer with melt value in JavaScript]]></title><description><![CDATA[A gold offer is easier to evaluate when the calculation is visible. The useful question is not whether a quoted rand amount sounds large, but what percentage of the item's calculated metal value remai]]></description><link>https://goldza-open-source.hashnode.dev/how-to-compare-a-south-african-gold-offer-with-melt-value-in-javascript</link><guid isPermaLink="true">https://goldza-open-source.hashnode.dev/how-to-compare-a-south-african-gold-offer-with-melt-value-in-javascript</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Components]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[privacy]]></category><category><![CDATA[gold]]></category><dc:creator><![CDATA[Goldza Open Source]]></dc:creator><pubDate>Wed, 29 Jul 2026 11:03:00 GMT</pubDate><content:encoded><![CDATA[<p>A gold offer is easier to evaluate when the calculation is visible. The useful question is not whether a quoted rand amount sounds large, but what percentage of the item's calculated metal value remains after stated deductions.</p>
<p>The <a href="https://goldza.co.za/gold-offer-checker/">Goldza Fair Offer Checker</a> turns that comparison into a small, dependency-free JavaScript calculation. The complete implementation is available in the <a href="https://github.com/G-O-L-D-123/goldza-fair-offer-checker">MIT-licensed source repository</a>.</p>
<p>This is a metal-only comparison. It is not an assay, jewellery valuation, buyer ranking, transaction-safety check, or financial recommendation.</p>
<h2>The calculation</h2>
<p>The input values are:</p>
<ul>
<li>the live or reference price of pure gold per gram in rand;</li>
<li>the total item weight;</li>
<li>an optional estimate for stones and other non-gold weight;</li>
<li>the item's karat or hallmark;</li>
<li>the buyer's gross offer; and</li>
<li>any stated fees or deductions.</li>
</ul>
<p>The calculation is deliberately explicit:</p>
<pre><code class="language-text">gold-bearing weight = total weight - estimated non-gold weight
fine gold grams = gold-bearing weight × karat purity
melt value = fine gold grams × pure gold price per gram
net offer = gross offer - stated fees
payout percentage = net offer ÷ melt value × 100
</code></pre>
<p>The project uses these purities:</p>
<table>
<thead>
<tr>
<th>Karat</th>
<th>Hallmark</th>
<th>Purity</th>
</tr>
</thead>
<tbody><tr>
<td>9ct</td>
<td>375</td>
<td>37.5%</td>
</tr>
<tr>
<td>14ct</td>
<td>585</td>
<td>58.5%</td>
</tr>
<tr>
<td>18ct</td>
<td>750</td>
<td>75.0%</td>
</tr>
<tr>
<td>22ct</td>
<td>916</td>
<td>91.6667%</td>
</tr>
<tr>
<td>24ct</td>
<td>999</td>
<td>99.9%</td>
</tr>
</tbody></table>
<h2>Use the calculation engine</h2>
<p>The versioned module can be imported directly from the public repository through jsDelivr:</p>
<pre><code class="language-js">import {
  calculateOffer,
  formatZAR,
} from 'https://cdn.jsdelivr.net/gh/G-O-L-D-123/goldza-fair-offer-checker@v0.2.0/src/calculate-offer.js';

const result = calculateOffer({
  pureGramZAR: 2200,
  weightGrams: 10,
  nonGoldWeightGrams: 0,
  karat: 9,
  grossOfferZAR: 6500,
  feesZAR: 0,
});

console.log(formatZAR(result.meltValueZAR));
console.log(result.payoutPercentage);
</code></pre>
<p>A host should replace the example price with a timestamped source and label any fallback accurately. The function returns the intermediate values as well as the final payout percentage, which makes it easier to test and explain the result.</p>
<h2>Embed the web component</h2>
<p>The same calculation is packaged as a standards-based custom element:</p>
<pre><code class="language-html">&lt;script type="module"
  src="https://cdn.jsdelivr.net/gh/G-O-L-D-123/goldza-fair-offer-checker@v0.2.0/src/goldza-offer-checker.js"&gt;
&lt;/script&gt;

&lt;goldza-offer-checker
  price-url="https://goldza.co.za/api/gold-price.json"
  pure-price="2200"
  price-source="Host-provided fallback"&gt;
&lt;/goldza-offer-checker&gt;
</code></pre>
<p>The component reads a public, timestamped price document when available and uses the labelled fallback only if that request fails. It supports common South African karats, optional non-gold weight, stated fees, shareable input links, JSON exports, and print-friendly reports.</p>
<h2>Privacy by default</h2>
<p>Weight and offer values stay in the browser. The project has no account requirement, analytics, cookies, server-side form, lead collection, or buyer ranking. A share link includes entered values only after the user chooses to copy it.</p>
<p>The output still depends on the supplied weight, non-gold estimate, karat, offer, and price. Stones, collectability, workmanship, taxes, unstated deductions, and buyer trust remain outside the model.</p>
<h2>Try it or inspect it</h2>
<ul>
<li><a href="https://goldza.co.za/gold-offer-checker/">Use the live Goldza Fair Offer Checker</a></li>
<li><a href="https://g-o-l-d-123.github.io/goldza-fair-offer-checker/">Run the public GitHub Pages demo</a></li>
<li><a href="https://github.com/G-O-L-D-123/goldza-fair-offer-checker">Review the source, tests, and licence on GitHub</a></li>
<li><a href="https://github.com/G-O-L-D-123/goldza-fair-offer-checker/releases/tag/v0.2.0">Download release v0.2.0</a></li>
</ul>
<p>A transparent formula cannot remove uncertainty from a physical item, but it can make the buyer's percentage clear before a decision is made.</p>
]]></content:encoded></item></channel></rss>