Comments (5)
Thanks for the issue @scarf005. I think this is a reasonable suggestion. Perhaps we could make this the default, provided that the functions body fits within the remaining truncate
length; so something like:
export default function inspectFunction(func, options) {
const source = func.toString()
if (source.length < options.truncate - 12) {
return options.stylize(`[Function: ${source}]`, 'special')
}
const name = getFunctionName(func)
if (!name) {
return options.stylize('[Function]', 'special')
}
return options.stylize(`[Function ${truncate(name, options.truncate - 11)}]`, 'special')
}
from loupe.
alright, could i create a PR for it?
from loupe.
Please do! That would be awesome! A robust set of tests against this would be excellent too!
from loupe.
alright. also out of context, will chai (and its related packages) consider migrating to typescript?
from loupe.
It's indeed on the radar, alongside making it a first class citizen of Deno. Any help in either direction is very welcome!
from loupe.
Related Issues (20)
- TODO for v2 Release HOT 4
- Time representation difference in Chai.js HOT 6
- Loupe doesn't work correctly for buffers HOT 2
- Return value for number 0 HOT 6
- `inspect( 1n )` => no joy HOT 2
- broken dependency `get-function-name` HOT 2
- Handle circular references HOT 1
- Quote complex keys in objects HOT 1
- The automated release is failing 🚨 HOT 1
- IE9+ not supported since 4.3.5 because of loupe HOT 4
- inspect of Object with null prototype causes primitive value error
- Invalid Date object will throw a TypeError HOT 5
- Package `loupe` seems to be an ES Module but shipped in a CommonJS package HOT 1
- `depth` option HOT 1
- vulnerability in loupe HOT 1
- New release for Dependabot Fix? HOT 1
- prevent `playwright` installation HOT 2
- Is the custom `inspect()` still needed?
- Handle circular references better HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loupe.