mirror of
https://github.com/developit/microbundle.git
synced 2026-01-18 13:56:35 +00:00
* feat(babel): merges babelrc with microbunde babel config * update tests * Fix README.md Fix examples description * remove unused rollup-plugin-flow dependency (#379)
25 lines
677 B
JavaScript
25 lines
677 B
JavaScript
import fs from 'fs';
|
|
import { promisify } from 'es6-promisify';
|
|
|
|
export const readFile = promisify(fs.readFile);
|
|
// export const writeFile = promisify(fs.writeFile);
|
|
export const stat = promisify(fs.stat);
|
|
export const isDir = name =>
|
|
stat(name)
|
|
.then(stats => stats.isDirectory())
|
|
.catch(() => false);
|
|
export const isFile = name =>
|
|
stat(name)
|
|
.then(stats => stats.isFile())
|
|
.catch(() => false);
|
|
export const stdout = console.log.bind(console); // eslint-disable-line no-console
|
|
export const stderr = console.error.bind(console);
|
|
|
|
export const isTruthy = obj => {
|
|
if (!obj) {
|
|
return false;
|
|
}
|
|
|
|
return obj.constructor !== Object || Object.keys(obj).length > 0;
|
|
};
|