DEV Community

Pontakorn Paesaeng
Pontakorn Paesaeng

Posted on

2 1

Deno ฉบับรวบรัด

ตอนนี้ Deno เวอร์ชัน 1.0 ก็ออกมาเรียบร้อยแล้ว จึงทำให้ได้รับความสนใจจากโปรแกรมเมอร์ในฐานะตัวรัน JavaScript ตัวอื่นนอกจาก NodeJS

Deno คืออะไร

Deno คือตัวรัน JavaScript อีกตัวนอกจาก NodeJs ใช้เอนจินต์ V8 เหมือนกัน Deno เขียนโดยใช้ภาษา Rust มีโครงสร้างไลบรารี่คล้าย ๆ กับภาษา Go นอกจากนี้ยังสามารถรัน TypeScript ในตัวได้ด้วย

จุดเด่นของ Deno

Deno เป็นตัวรัน JavaScript ที่ตั้งค่าความปลอดภัยสูงสุดตั้งแต่ต้นเลย สคริปต์ต่าง ๆ จะใช้ระบบไฟล์ ต่อเน็ต อะไรก็ไม่ได้จนกว่าเราจะอนุญาต นอกจากนี้จะไม่มี node_module หรือ package.json แต่จะ import จาก url และไฟล์ภายในเครื่อง

นอกจากนี้ Deno ก็มีตัว Debugger รวมถึง Formatter ในตัวอีกด้วย เรียกได้ว่าเครื่องมือครบครันกันทีเดียว

ตัวอย่าง

// ดัดแปลงมาจาก https://deno.land/std/datetime
import { parseDate } from 'https://deno.land/std/datetime/mod.ts'
console.log(parseDate("20-01-2020", "dd-mm-yyyy"));
Enter fullscreen mode Exit fullscreen mode

จะเห็นได้ว่าเราใช้ Url ในการ import ไลบรารี่ ไฟล์ใน Url จะสามารถ cache ได้ครับ

ที่มาและแหล่งศึกษาเพิ่มเติม

ทาง Deno มีเว็บไซต์อย่างเป็นทางการที่ deno.land ครับ จะรวมคู่มือและเอกสารของตัว Deno เอง ส่วน standard library จะอยู่ในเว็บไซต์ deno.land/std ครับ

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more