Package Exports
- joycon
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (joycon) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
joycon
Install
yarn add joyconUsage
const JoyCon = require('joycon')
const joycon = new JoyCon(['package-lock.json', 'yarn.lock'])
joycon.load()
.then(result => {
// result is {} when files do not exist
// otherwise { path, data }
})By default only .js and .json file are parsed, otherwise raw data will be returned, so you can add custom loader to parse them:
const joycon = new JoyCon(['cargo.toml'])
joycon.addLoader({
test: /\.toml$/,
load(filepath) {
return require('toml').parse(filepath)
}
})
joycon.load()DOC
API
constructor(files, [options])
files
Type: string[]
The files to search.
options
cwd
Working directory to search files.
stopDir
Directory where the search will stop. By default it's path.parse(cwd).root.
resolve()
Search files and resolve the path of the file we found.
load()
Search files and resolve { path, data } of the file we found.
addLoader(Loader)
interface Loader {
test: RegExp
load(filepath: string): any
}Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :D
Author
joycon © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).
github.com/egoist · GitHub @egoist · Twitter @_egoistlily