@leonardorick/three v1.0.78
lthree
Javascript utility functions for handling three.js stuff
usage
`pnpm i @leonardorick/three`on plain javascript
import lthree from './node_modules/@leonardorick/three/index.js';on a modern JS application working with bundlers
import lthree from '@leoanrdorick/three';publish
npm run deployadd new functions
If you are going to add a new "module" (file) make sure to keep the same structure present on the project. The following three folders should have (almost) the same structure:
src/Where the.jsfile is located and the function is actually implemented. This function should be imported insidesrc/index.js, which is the only file that is not repeated on the other folders. This file abastracts the complexity of the actualindex.jsoutside thesrcfolder that import stuff from './dist' and we don't want to keep updating it everytime.Make sure to add some JSDocs one each function explaining it usage
tests/Any function should have at least one test for it implementation. Preferably the module will have more than one test per function implement to contemplate multiple scenariostypes/The signature of the exported classes/functions should be present ontypes/as a.d.tsfile. This file should also be imported on thetypes/index.d.tsso all types of the exported package members can be properly infered by IDE's
Try to make the functions inside each module ordered alphabetically as much as possible!
Code patterns
Optional parameters: Usually optional parameters are the last param of the function and are inside a object with default values.
funciton something(a, {
opt1 = true,
opt2 = null,
opt3 = 5,
} = {})internal imports: If some module imports another one internally it needs to import it with the extension. This allows the builded version to work as expected
import { hypotenuse, round } from './math.js'; // right
//...
import { hypotenuse, round } from './math'; // wrong1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago