Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions packages/nx/src/native/hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ pub fn hash(content: &[u8]) -> String {

#[napi]
pub fn hash_array(input: Vec<Option<String>>) -> String {
let joined = input.iter().filter_map(|s| {
if s.is_none() {
trace!("Encountered None value in hash_array input: {:?}", input);
}
s.as_deref()
}).collect::<Vec<_>>().join(",");
let joined = input
.iter()
.filter_map(|s| {
if s.is_none() {
trace!("Encountered None value in hash_array input: {:?}", input);
}
s.as_deref()
})
.collect::<Vec<_>>()
.join(":");
let content = joined.as_bytes();
hash(content)
}
Expand All @@ -41,7 +45,7 @@ pub fn hash_file_path<P: AsRef<Path>>(path: P) -> Option<String> {

#[cfg(test)]
mod tests {
use crate::native::hasher::{hash_file, hash_array};
use crate::native::hasher::{hash_array, hash_file};
use assert_fs::prelude::*;
use assert_fs::TempDir;

Expand Down
Loading