Skip to content

Instantly share code, notes, and snippets.

View indreklasn's full-sized avatar
👋

Trevor I. Lasn indreklasn

👋
View GitHub Profile
const street = user.address?.street
if (data && data.length > 0) {
data.map(item => <div>{item}<div>)
}
/* or */
data && data.length > 0 && data.map(item => <div>{item}<div>)
const data = []
data.map(item => <div>{item}</div>)
const street = user.address && user.address.street;
import { Chart } from "frappe-charts/dist/frappe-charts.min.esm";
const data = {
labels: [
"12am-3am",
"3am-6pm",
"6am-9am",
"9am-12am",
"12pm-3pm",
"3pm-6pm",
import { Chart } from "frappe-charts/dist/frappe-charts.min.esm";
new Chart("#pie", {
data: {
labels: ["android", "iOS", "KaiOS", "windows", "Samsung", "unknown"],
datasets: [
{
values: [76.03, 22.04, 0.79, 0.21, 0.21, 0.32]
}
]
import { Chart } from "frappe-charts/dist/frappe-charts.min.esm";
new Chart("#pie", {
data: {
labels: ["android", "iOS", "KaiOS", "windows", "Samsung", "unknown"],
datasets: []
},
title: "Mobile Operating System Market Share Worldwide",
type: "pie",
colors: ["#2947ff", "#f44336", "#aeff62", "#e91e63", "#9c27b0", "#141021"],
<body>
<div id="pie"></div>
<script src="src/pie.js"></script>
</body>
import { Chart } from "frappe-charts/dist/frappe-charts.min.esm"
let fs = require('fs');
console.log('1');
fs.readFile('test.txt', 'utf8', function(error, data) {
if (error) {
throw error;
}
console.log('2');