summaryrefslogtreecommitdiff
path: root/ext/node/ops/buffer.rs
blob: 74a011ab80989d78dabd990bd0fe639ac7d9b09f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use deno_core::op2;

#[op2(fast)]
pub fn op_is_ascii(#[buffer] buf: &[u8]) -> bool {
  buf.is_ascii()
}

#[op2(fast)]
pub fn op_is_utf8(#[buffer] buf: &[u8]) -> bool {
  std::str::from_utf8(buf).is_ok()
}