UNPKG

coldstitch

Version:

A code generation library, that helps you craft code snippets in code for multiple languages

4 lines (3 loc) 1.02 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../index-lPwhCPkI.cjs");function p(e,{module:o}={}){return{namespace:o??"",name:e,language:"swift",toString:()=>e}}function f(e,o={}){const{formatter:n}=o,i=r.stringify(e,{objectTokens:["[","]"],arrayTokens:["[","]"],assignToken:": ",formatKey:t=>`"${t}"`,formatValue:t=>{if(n){const s=n(t);if(s!==void 0)return s}if(t==null)return"nil";if(typeof t=="string")return`"${r.escapeStringQuotes(t)}"`;if(typeof t=="number"||typeof t=="bigint")return t.toString();if(typeof t=="boolean")return t?"true":"false";throw new Error(`Unsupported value type: ${typeof t}`)}},r.formatOptionsForLanguage("swift"));return r.CodeImpl.fromString(i)}function c(e){return f(e)}class a extends r.ImportResolver{resolve(o){const n=r.groupTypesByNamespace(o);return Object.keys(n).sort().map(t=>`import ${t}`).join(` `)}}function g(){return new a}exports.dict=f;exports.imports=g;exports.list=c;exports.typeRef=p; //# sourceMappingURL=swift.cjs.map