v0.9.0
0.9.0 (2022-02-05)
Features
You can use these symbols to read or transform entities dynamically:
import { PRIMARY_KEY } from '@mswjs/data'
// This utility replaces the actual entity values
// with their primary key/values pairs for lazy evaluation later
// (custom logic from your client, if any).
function toLazyEntity(entity) {
const primaryKeyName = entity[PRIMARY_KEY]
return { [primaryKeyName]: entity[primaryKeyName] }
}
// Usage
db.users.findMany({}).map(toLazyEntity)