Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function stringify(v) {
let s = compactStringify(v);
// http://timelessrepo.com/json-isnt-a-javascript-subset
if (s.indexOf('\u2028') >= 0) {
s = s.replace(/\u2028/g, '\\u2028');
}
if (s.indexOf('\u2029') >= 0) {
s = s.replace(/\u2029/g, '\\u2029');
}
return s;
}
static formatWarningToStr(value) {
if (arguments.length >= 2) {
try {
if (typeof arguments[1] === 'string') {
value += `\n${arguments[1]}`;
} else {
value += '\n' + compactStringify(arguments[1], { maxLength: 70 });
}
} catch (err) {
// ignore
}
}
return value;
}
if (isImmutable(item)) {
result = serializeItem(item.toJS(), options, delimit);
} else if (typeof item === 'string') {
result = delimit ? `'${item}'` : item;
} else if (typeof item === 'number' || typeof item === 'boolean') {
result = `${item}`;
} else if (Array.isArray(item)) {
var indentation = new Array(options.spacing + 1).join(' ');
const delimiter = delimit ? ', ' : `\n${indentation}`;
const items = item.map(i => serializeItem(i, options)).join(delimiter);
result = delimit ? `[${items}]` : `${items}` ;
} else if (isValidElement(item)) {
result = jsxToString(item, options);
} else if (typeof item === 'object') {
result = stringify(stringifyObject(item, options));
// remove string quotes from embeded JSX values
result = result.replace(_JSX_REGEXP, function (match) {
return match.slice(1, match.length - 1);
});
} else if (typeof item === 'function') {
result = options.useFunctionCode ?
options.functionNameOnly ?
item.name.toString() : item.toString() : `...`;
}
return result;
}
// Convert this type array to an object with this key
for (type in data) {
for (entry in data[type]) {
for (field in data[type][entry]) {
if (objKeys.indexOf(`${type}.${field}`) > -1) {
if (Array.isArray(data[type])) {
data[type] = arrayToObject(data[type], field);
}
}
}
}
}
if (dataIsJSON) {
return stringify(data);
}
return data;
}
if (compileOk && !evalOk) {
const differences = `Original\n${diffOutputs(result.outputs)}\n`;
diffOutput.text += differences;
diffOutput.html += differences;
}
if (recompileOk && !roundTripOk) {
const differences = `\nRoundtripped through serialize()\n${diffOutputs(result.roundTripOutputs)}\n`;
diffOutput.text += differences;
diffOutput.html += differences;
}
params.difference = diffOutput.html;
if (diffOutput.text) { console.log(diffOutput.text); }
params.expression = compactStringify(fixture.expression);
params.serialized = compactStringify(result.serialized);
done();
} catch (e) {
done(e);
}
});
}
function run(file: string, args: Args): string {
const {types, schema} = collect(file);
switch (args.type) {
case 'intermediate':
return yaml.dump(types, null, null, {
indent: args.indent,
width: args.maxWidth,
}).trimRight();
case 'json-schema':
default:
return stringifyJson(schema, {
indent: args.indent,
maxLength: args.maxWidth,
});
}
}
<div>
<input value="getAccountResources" type="button">this.getAccountResources()}/>
</div>
<div>
<input value="getChainParameters" type="button">this.getChainParameters()}/>
</div>
<div>
<input value="listSuperRepresentatives" type="button">this.listSuperRepresentatives()}/>
</div>
<div style="{{position:'fixed',left:0,top:0}}">
<textarea value="{stringify(data)}" rows="10" cols="100">{}}></textarea>
</div>
<style>{`
label{
display:inline-block;
width:150px;
}
`}
</style>
)
}
}
.on('click', function() {
post(window, editorURL, {
mode: 'vega-lite',
spec: compactStringify(spec),
config: vgSpec.config,
renderer: 'svg'
});
event.preventDefault();
});
}
_renderRaw () {
const { boxes, rawBoxes } = this.state;
return (
<div>
<header size="large">
Raw
<button>}
onClick={() => {
this.setState({ raw: false, rawBoxes: undefined });
}} />
</button></header>
<textarea value="{rawBoxes" rows="20"> {
this.setState({ rawBoxes: event.target.value });
}} />
</FormField>
</FormFields>
<Footer pad='medium'>
<Button label='Submit' primary={true}
onClick={() => {
const nextBoxes = JSON.parse(this.state.rawBoxes);
this.setState({
boxes: nextBoxes, raw: false, rawBoxes: undefined,
activeId: this.state.rootId
});
}} />
</Footer>
</div></textarea></div>
))
) : (
)}
);
});
}
if (
format !== 'function' &&
syntax[0] !== '(' &&
syntax[0] !== '<' &&
syntax[0] !== '['
) {
content = stringify(syntax, { maxLength: 40 });
content = <code>{content}</code>;
}
if (defaultValue !== undefined && syntax === defaultValue) {
content = <strong>{content}</strong>;
}
return <pre style="{{">{content}</pre>;
};