code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
clearCaches() {
this.clearLoadCache();
this.clearSearchCache();
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | clearCaches | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
validateConfig() {
const config = this.config;
config.searchPlaces.forEach(place => {
const loaderKey = _path.default.extname(place) || 'noExt';
const loader = config.loaders[loaderKey];
if (!loader) {
throw new Error(`No loader specified for ${getExtensionDescription(plac... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | validateConfig | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
shouldSearchStopWithResult(result) {
if (result === null) return false;
if (result.isEmpty && this.config.ignoreEmptySearchPlaces) return false;
return true;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | shouldSearchStopWithResult | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
nextDirectoryToSearch(currentDir, currentResult) {
if (this.shouldSearchStopWithResult(currentResult)) {
return null;
}
const nextDir = nextDirUp(currentDir);
if (nextDir === currentDir || currentDir === this.config.stopDir) {
return null;
}
return nextDir;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | nextDirectoryToSearch | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
loadPackageProp(filepath, content) {
const parsedContent = loaders_1.loaders.loadJson(filepath, content);
const packagePropValue = (0, getPropertyByPath_1.getPropertyByPath)(parsedContent, this.config.packageProp);
return packagePropValue || null;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | loadPackageProp | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
getLoaderEntryForFile(filepath) {
if (_path.default.basename(filepath) === 'package.json') {
const loader = this.loadPackageProp.bind(this);
return loader;
}
const loaderKey = _path.default.extname(filepath) || 'noExt';
const loader = this.config.loaders[loaderKey];
if (!... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | getLoaderEntryForFile | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
loadedContentToCosmiconfigResult(filepath, loadedContent) {
if (loadedContent === null) {
return null;
}
if (loadedContent === undefined) {
return {
filepath,
config: undefined,
isEmpty: true
};
}
return {
config: loadedConten... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | loadedContentToCosmiconfigResult | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
validateFilePath(filepath) {
if (!filepath) {
throw new Error('load must pass a non-empty string');
}
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | validateFilePath | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function nextDirUp(dir) {
return _path.default.dirname(dir);
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | nextDirUp | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function getExtensionDescription(filepath) {
const ext = _path.default.extname(filepath);
return ext ? `extension "${ext}"` : 'files without extensions';
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | getExtensionDescription | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
async function fsReadFileAsync(pathname, encoding) {
return new Promise((resolve, reject) => {
_fs.default.readFile(pathname, encoding, (error, contents) => {
if (error) {
reject(error);
return;
}
resolve(contents);
});
});
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | fsReadFileAsync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
async function readFile(filepath, options = {}) {
const throwNotFound = options.throwNotFound === true;
try {
const content = await fsReadFileAsync(filepath, 'utf8');
return content;
} catch (error) {
if (throwNotFound === false && error.code === 'ENOENT') {
return null;
}
... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | readFile | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function readFileSync(filepath, options = {}) {
const throwNotFound = options.throwNotFound === true;
try {
const content = _fs.default.readFileSync(filepath, 'utf8');
return content;
} catch (error) {
if (throwNotFound === false && error.code === 'ENOENT') {
return null;
}... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | readFileSync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
async function cacheWrapper(cache, key, fn) {
const cached = cache.get(key);
if (cached !== undefined) {
return cached;
}
const result = await fn();
cache.set(key, result);
return result;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | cacheWrapper | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function cacheWrapperSync(cache, key, fn) {
const cached = cache.get(key);
if (cached !== undefined) {
return cached;
}
const result = fn();
cache.set(key, result);
return result;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | cacheWrapperSync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
async function isType(fsStatType, statsMethodName, filePath) {
if (typeof filePath !== 'string') {
throw new TypeError(`Expected a string, got ${typeof filePath}`);
}
try {
const stats = await promisify(fs[fsStatType])(filePath);
return stats[statsMethodName]();
} catch (error) {
if (error.code... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | isType | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function isTypeSync(fsStatType, statsMethodName, filePath) {
if (typeof filePath !== 'string') {
throw new TypeError(`Expected a string, got ${typeof filePath}`);
}
try {
return fs[fsStatType](filePath)[statsMethodName]();
} catch (error) {
if (error.code === 'ENOENT') {
return false;
}
... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | isTypeSync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
async function getDirectory(filepath) {
const filePathIsDirectory = await (0, pathType.isDirectory)(filepath);
if (filePathIsDirectory === true) {
return filepath;
}
const directory = _path.default.dirname(filepath);
return directory;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | getDirectory | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function getDirectorySync(filepath) {
const filePathIsDirectory = (0, pathType.isDirectorySync)(filepath);
if (filePathIsDirectory === true) {
return filepath;
}
const directory = _path.default.dirname(filepath);
return directory;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | getDirectorySync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _asyncIterator(iterable) {
var method;
if (typeof Symbol !== "undefined") {
if (Symbol.asyncIterator) {
method = iterable[Symbol.asyncIterator];
if (method != null) return method.call(iterable);
}
if (Symbol.iterator) {
method = iterable[Symbol.iterator];
... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | _asyncIterator | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
async search(searchFrom = process.cwd()) {
const startDirectory = await (0, getDirectory_1.getDirectory)(searchFrom);
const result = await this.searchFromDirectory(startDirectory);
return result;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | search | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
async searchFromDirectory(dir) {
const absoluteDir = _path.default.resolve(process.cwd(), dir);
const run = async () => {
const result = await this.searchDirectory(absoluteDir);
const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
if (nextDir) {
return this.se... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | searchFromDirectory | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
run = async () => {
const result = await this.searchDirectory(absoluteDir);
const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
if (nextDir) {
return this.searchFromDirectory(nextDir);
}
const transformResult = await this.config.transform(result);
... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | run | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
run = async () => {
const result = await this.searchDirectory(absoluteDir);
const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
if (nextDir) {
return this.searchFromDirectory(nextDir);
}
const transformResult = await this.config.transform(result);
... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | run | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
async searchDirectory(dir) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError;
try {
for (var _iterator = _asyncIterator(this.config.searchPlaces), _step, _value; _step = await _iterator.next(), _iteratorNormalCompletion = _step.done, _value = awa... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | searchDirectory | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
async loadSearchPlace(dir, place) {
const filepath = _path.default.join(dir, place);
const fileContents = await (0, readFile_1.readFile)(filepath);
const result = await this.createCosmiconfigResult(filepath, fileContents);
return result;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | loadSearchPlace | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
async loadFileContent(filepath, content) {
if (content === null) {
return null;
}
if (content.trim() === '') {
return undefined;
}
const loader = this.getLoaderEntryForFile(filepath);
const loaderResult = await loader(filepath, content);
return loaderResult;
... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | loadFileContent | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
async createCosmiconfigResult(filepath, content) {
const fileContent = await this.loadFileContent(filepath, content);
const result = this.loadedContentToCosmiconfigResult(filepath, fileContent);
return result;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | createCosmiconfigResult | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
async load(filepath) {
this.validateFilePath(filepath);
const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
const runLoad = async () => {
const fileContents = await (0, readFile_1.readFile)(absoluteFilePath, {
throwNotFound: true
});
const resul... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | load | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
runLoad = async () => {
const fileContents = await (0, readFile_1.readFile)(absoluteFilePath, {
throwNotFound: true
});
const result = await this.createCosmiconfigResult(absoluteFilePath, fileContents);
const transformResult = await this.config.transform(result);
return... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | runLoad | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
runLoad = async () => {
const fileContents = await (0, readFile_1.readFile)(absoluteFilePath, {
throwNotFound: true
});
const result = await this.createCosmiconfigResult(absoluteFilePath, fileContents);
const transformResult = await this.config.transform(result);
return... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | runLoad | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
searchSync(searchFrom = process.cwd()) {
const startDirectory = (0, getDirectory_1.getDirectorySync)(searchFrom);
const result = this.searchFromDirectorySync(startDirectory);
return result;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | searchSync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
searchFromDirectorySync(dir) {
const absoluteDir = _path.default.resolve(process.cwd(), dir);
const run = () => {
const result = this.searchDirectorySync(absoluteDir);
const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
if (nextDir) {
return this.searchFromDi... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | searchFromDirectorySync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
run = () => {
const result = this.searchDirectorySync(absoluteDir);
const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
if (nextDir) {
return this.searchFromDirectorySync(nextDir);
}
const transformResult = this.config.transform(result);
return tr... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | run | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
run = () => {
const result = this.searchDirectorySync(absoluteDir);
const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
if (nextDir) {
return this.searchFromDirectorySync(nextDir);
}
const transformResult = this.config.transform(result);
return tr... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | run | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
searchDirectorySync(dir) {
for (const place of this.config.searchPlaces) {
const placeResult = this.loadSearchPlaceSync(dir, place);
if (this.shouldSearchStopWithResult(placeResult) === true) {
return placeResult;
}
} // config not found
return null;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | searchDirectorySync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
loadSearchPlaceSync(dir, place) {
const filepath = _path.default.join(dir, place);
const content = (0, readFile_1.readFileSync)(filepath);
const result = this.createCosmiconfigResultSync(filepath, content);
return result;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | loadSearchPlaceSync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
loadFileContentSync(filepath, content) {
if (content === null) {
return null;
}
if (content.trim() === '') {
return undefined;
}
const loader = this.getLoaderEntryForFile(filepath);
const loaderResult = loader(filepath, content);
return loaderResult;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | loadFileContentSync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
createCosmiconfigResultSync(filepath, content) {
const fileContent = this.loadFileContentSync(filepath, content);
const result = this.loadedContentToCosmiconfigResult(filepath, fileContent);
return result;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | createCosmiconfigResultSync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
loadSync(filepath) {
this.validateFilePath(filepath);
const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
const runLoadSync = () => {
const content = (0, readFile_1.readFileSync)(absoluteFilePath, {
throwNotFound: true
});
const cosmiconfigResul... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | loadSync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
runLoadSync = () => {
const content = (0, readFile_1.readFileSync)(absoluteFilePath, {
throwNotFound: true
});
const cosmiconfigResult = this.createCosmiconfigResultSync(absoluteFilePath, content);
const transformResult = this.config.transform(cosmiconfigResult);
return... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | runLoadSync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
runLoadSync = () => {
const content = (0, readFile_1.readFileSync)(absoluteFilePath, {
throwNotFound: true
});
const cosmiconfigResult = this.createCosmiconfigResultSync(absoluteFilePath, content);
const transformResult = this.config.transform(cosmiconfigResult);
return... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | runLoadSync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} // eslint-disable-next-line @typescript-eslint/explicit-function-return-type | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function cosmiconfig(moduleName, options = {}) {
const normalizedOptions = normalizeOptions(moduleName, options);
const explorer = new Explorer_1.Explorer(normalizedOptions);
return {
search: explorer.search.bind(explorer),
load: explorer.load.bind(explorer),
clearLoadCache: explorer.clear... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | cosmiconfig | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function cosmiconfigSync(moduleName, options = {}) {
const normalizedOptions = normalizeOptions(moduleName, options);
const explorerSync = new ExplorerSync_1.ExplorerSync(normalizedOptions);
return {
search: explorerSync.searchSync.bind(explorerSync),
load: explorerSync.loadSync.bind(explorerSyn... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | cosmiconfigSync | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function normalizeOptions(moduleName, options) {
const defaults = {
packageProp: moduleName,
searchPlaces: ['package.json', `.${moduleName}rc`, `.${moduleName}rc.json`, `.${moduleName}rc.yaml`, `.${moduleName}rc.yml`, `.${moduleName}rc.js`, `${moduleName}.config.js`],
ignoreEmptySearchPlaces: true... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | normalizeOptions | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
identity = function identity(x) {
return x;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | identity | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
identity = function identity(x) {
return x;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | identity | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function splitPath(path) {
var parts = path.split(/(\/|\\)/);
if (!parts.length) return parts; // when path starts with a slash, the first part is empty string
return !parts[0].length ? parts.slice(1) : parts;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | splitPath | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function testDir(parts) {
if (parts.length === 0) return cb(null, null);
var p = parts.join('');
exists(path.join(p, clue), function (itdoes) {
if (itdoes) return cb(null, p);
testDir(parts.slice(0, -1));
});
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | testDir | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function testDir(parts) {
if (parts.length === 0) return null;
var p = parts.join('');
var itdoes = existsSync(path.join(p, clue));
return itdoes ? p : testDir(parts.slice(0, -1));
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | testDir | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function wrappy(fn, cb) {
if (fn && cb) return wrappy(fn)(cb);
if (typeof fn !== 'function') throw new TypeError('need wrapper function');
Object.keys(fn).forEach(function (k) {
wrapper[k] = fn[k];
});
return wrapper;
function wrapper() {
var args = new Array(arguments.length);
for (var i = 0;... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | wrappy | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function wrapper() {
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}
var ret = fn.apply(this, args);
var cb = args[args.length - 1];
if (typeof ret === 'function' && ret !== cb) {
Object.keys(cb).forEach(function (k) {
... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | wrapper | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function once(fn) {
var f = function () {
if (f.called) return f.value;
f.called = true;
return f.value = fn.apply(this, arguments);
};
f.called = false;
return f;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | once | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
f = function () {
if (f.called) return f.value;
f.called = true;
return f.value = fn.apply(this, arguments);
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | f | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function onceStrict(fn) {
var f = function () {
if (f.called) throw new Error(f.onceError);
f.called = true;
return f.value = fn.apply(this, arguments);
};
var name = fn.name || 'Function wrapped with `once`';
f.onceError = name + " shouldn't be called more than once";
f.called = false;
return ... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | onceStrict | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
f = function () {
if (f.called) throw new Error(f.onceError);
f.called = true;
return f.value = fn.apply(this, arguments);
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | f | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
isRequest = function (stream) {
return stream.setHeader && typeof stream.abort === 'function';
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | isRequest | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
isChildProcess = function (stream) {
return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3;
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | isChildProcess | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
eos = function (stream, opts, callback) {
if (typeof opts === 'function') return eos(stream, null, opts);
if (!opts) opts = {};
callback = once_1(callback || noop);
var ws = stream._writableState;
var rs = stream._readableState;
var readable = opts.readable || opts.readable !== false && stream.readable;
v... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | eos | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
onlegacyfinish = function () {
if (!stream.writable) onfinish();
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | onlegacyfinish | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
onfinish = function () {
writable = false;
if (!readable) callback.call(stream);
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | onfinish | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
onend = function () {
readable = false;
if (!writable) callback.call(stream);
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | onend | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
onexit = function (exitCode) {
callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null);
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | onexit | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
onerror = function (err) {
callback.call(stream, err);
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | onerror | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
onclosenexttick = function () {
if (cancelled) return;
if (readable && !(rs && rs.ended && !rs.destroyed)) return callback.call(stream, new Error('premature close'));
if (writable && !(ws && ws.ended && !ws.destroyed)) return callback.call(stream, new Error('premature close'));
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | onclosenexttick | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
onrequest = function () {
stream.req.on('finish', onfinish);
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | onrequest | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
isFn = function (fn) {
return typeof fn === 'function';
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | isFn | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
isFS = function (stream) {
if (!ancient) return false; // newer node version do not need to care about fs is a special way
if (!fs) return false; // browser
return (stream instanceof (fs.ReadStream || noop$1) || stream instanceof (fs.WriteStream || noop$1)) && isFn(stream.close);
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | isFS | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
isRequest$1 = function (stream) {
return stream.setHeader && isFn(stream.abort);
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | isRequest$1 | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
destroyer = function (stream, reading, writing, callback) {
callback = once_1(callback);
var closed = false;
stream.on('close', function () {
closed = true;
});
endOfStream(stream, {
readable: reading,
writable: writing
}, function (err) {
if (err) return callback(err);
closed = true;
... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | destroyer | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
pipe = function (from, to) {
return from.pipe(to);
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | pipe | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
pump = function () {
var streams = Array.prototype.slice.call(arguments);
var callback = isFn(streams[streams.length - 1] || noop$1) && streams.pop() || noop$1;
if (Array.isArray(streams[0])) streams = streams[0];
if (streams.length < 2) throw new Error('pump requires two streams per minimum');
var error;
v... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | pump | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
bufferStream = options => {
options = Object.assign({}, options);
const {
array
} = options;
let {
encoding
} = options;
const isBuffer = encoding === 'buffer';
let objectMode = false;
if (array) {
objectMode = !(encoding || isBuffer);
} else {
encoding = encoding || 'utf8';
}
if... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | bufferStream | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor() {
super('maxBuffer exceeded');
this.name = 'MaxBufferError';
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
async function getStream(inputStream, options) {
if (!inputStream) {
return Promise.reject(new Error('Expected a stream'));
}
options = Object.assign({
maxBuffer: Infinity
}, options);
const {
maxBuffer
} = options;
let stream;
await new Promise((resolve, reject) => {
const rejectPromis... | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | getStream | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
rejectPromise = error => {
if (error) {
// A null check
error.bufferedData = stream.getBufferedValue();
}
reject(error);
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | rejectPromise | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
rejectPromise = error => {
if (error) {
// A null check
error.bufferedData = stream.getBufferedValue();
}
reject(error);
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | rejectPromise | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
buffer = (stream, options) => getStream(stream, Object.assign(Object.assign({}, options), {}, {
encoding: 'buffer'
})) | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | buffer | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
array = (stream, options) => getStream(stream, Object.assign(Object.assign({}, options), {}, {
array: true
})) | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | array | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function checkEnv(obj) {
if (typeof obj === 'string') return !!env[obj];
return Object.keys(obj).every(function (k) {
return env[k] === obj[k];
});
} | Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob) | checkEnv | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function loop () {
for (var i = 0; i < 100; i++) {
assert.equal(Math.abs(-i), func(-i))
}
(typeof setImmediate != 'undefined' ? setImmediate : process.nextTick)(loop)
} | This example creates an ffi.Callback from the "Math.abs()" JavaScript function
then creates a ffi.ForeignFunction from that callback function pointer.
The result is basically the same as calling "Math.abs()" directly, haha!
This example should basically just run forever, in an endless loop.
This file is a "pummel tes... | loop | javascript | node-ffi/node-ffi | example/abs.js | https://github.com/node-ffi/node-ffi/blob/master/example/abs.js | MIT |
function Callback (retType, argTypes, abi, func) {
debug('creating new Callback')
if (typeof abi === 'function') {
func = abi
abi = void(0)
}
// check args
assert(!!retType, 'expected a return "type" object as the first argument')
assert(Array.isArray(argTypes), 'expected Array of arg "type" objec... | Turns a JavaScript function into a C function pointer.
The function pointer may be used in other C functions that
accept C callback functions. | Callback | javascript | node-ffi/node-ffi | lib/callback.js | https://github.com/node-ffi/node-ffi/blob/master/lib/callback.js | MIT |
function CIF (rtype, types, abi) {
debug('creating `ffi_cif *` instance')
// the return and arg types are expected to be coerced at this point...
assert(!!rtype, 'expected a return "type" object as the first argument')
assert(Array.isArray(types), 'expected an Array of arg "type" objects as the second argument... | JS wrapper for the `ffi_prep_cif` function.
Returns a Buffer instance representing a `ffi_cif *` instance. | CIF | javascript | node-ffi/node-ffi | lib/cif.js | https://github.com/node-ffi/node-ffi/blob/master/lib/cif.js | MIT |
function CIF_var (rtype, types, numFixedArgs, abi) {
debug('creating `ffi_cif *` instance with `ffi_prep_cif_var()`')
// the return and arg types are expected to be coerced at this point...
assert(!!rtype, 'expected a return "type" object as the first argument')
assert(Array.isArray(types), 'expected an Array ... | JS wrapper for the `ffi_prep_cif_var` function.
Returns a Buffer instance representing a variadic `ffi_cif *` instance. | CIF_var | javascript | node-ffi/node-ffi | lib/cif_var.js | https://github.com/node-ffi/node-ffi/blob/master/lib/cif_var.js | MIT |
function DynamicLibrary (path, mode) {
if (!(this instanceof DynamicLibrary)) {
return new DynamicLibrary(path, mode)
}
debug('new DynamicLibrary()', path, mode)
if (null == mode) {
mode = DynamicLibrary.FLAGS.RTLD_LAZY
}
this._handle = dlopen(path, mode)
assert(Buffer.isBuffer(this._handle), 'e... | `DynamicLibrary` loads and fetches function pointers for dynamic libraries
(.so, .dylib, etc). After the libray's function pointer is acquired, then you
call `get(symbol)` to retreive a pointer to an exported symbol. You need to
call `get___()` on the pointer to dereference it into its actual value, or
turn the pointer... | DynamicLibrary | javascript | node-ffi/node-ffi | lib/dynamic_library.js | https://github.com/node-ffi/node-ffi/blob/master/lib/dynamic_library.js | MIT |
function ForeignFunction (funcPtr, returnType, argTypes, abi) {
debug('creating new ForeignFunction', funcPtr)
// check args
assert(Buffer.isBuffer(funcPtr), 'expected Buffer as first argument')
assert(!!returnType, 'expected a return "type" object as the second argument')
assert(Array.isArray(argTypes), 'ex... | Represents a foreign function in another library. Manages all of the aspects
of function execution, including marshalling the data parameters for the
function into native types and also unmarshalling the return from function
execution. | ForeignFunction | javascript | node-ffi/node-ffi | lib/foreign_function.js | https://github.com/node-ffi/node-ffi/blob/master/lib/foreign_function.js | MIT |
function VariadicForeignFunction (funcPtr, returnType, fixedArgTypes, abi) {
debug('creating new VariadicForeignFunction', funcPtr)
// the cache of ForeignFunction instances that this
// VariadicForeignFunction has created so far
var cache = {}
// check args
assert(Buffer.isBuffer(funcPtr), 'expected Buff... | For when you want to call to a C function with variable amount of arguments.
i.e. `printf()`.
This function takes care of caching and reusing ForeignFunction instances that
contain the same ffi_type argument signature. | VariadicForeignFunction | javascript | node-ffi/node-ffi | lib/foreign_function_var.js | https://github.com/node-ffi/node-ffi/blob/master/lib/foreign_function_var.js | MIT |
function variadic_function_generator () {
debug('variadic_function_generator invoked')
// first get the types of variadic args we are working with
var argTypes = fixedArgTypes.slice()
var key = fixedKey.slice()
for (var i = 0; i < arguments.length; i++) {
var type = ref.coerceType(arguments[... | For when you want to call to a C function with variable amount of arguments.
i.e. `printf()`.
This function takes care of caching and reusing ForeignFunction instances that
contain the same ffi_type argument signature. | variadic_function_generator | javascript | node-ffi/node-ffi | lib/foreign_function_var.js | https://github.com/node-ffi/node-ffi/blob/master/lib/foreign_function_var.js | MIT |
function getId (type) {
if (!type.hasOwnProperty(idKey)) {
type[idKey] = (((1+Math.random())*0x10000)|0).toString(16)
}
return type[idKey]
} | For when you want to call to a C function with variable amount of arguments.
i.e. `printf()`.
This function takes care of caching and reusing ForeignFunction instances that
contain the same ffi_type argument signature. | getId | javascript | node-ffi/node-ffi | lib/foreign_function_var.js | https://github.com/node-ffi/node-ffi/blob/master/lib/foreign_function_var.js | MIT |
function Function (retType, argTypes, abi) {
if (!(this instanceof Function)) {
return new Function(retType, argTypes, abi)
}
debug('creating new FunctionType')
// check args
assert(!!retType, 'expected a return "type" object as the first argument')
assert(Array.isArray(argTypes), 'expected Array of a... | Creates and returns a "type" object for a C "function pointer".
@api public | Function | javascript | node-ffi/node-ffi | lib/function.js | https://github.com/node-ffi/node-ffi/blob/master/lib/function.js | MIT |
function Library (libfile, funcs, lib) {
debug('creating Library object for', libfile)
if (libfile && libfile.indexOf(EXT) === -1) {
debug('appending library extension to library name', EXT)
libfile += EXT
}
if (!lib) {
lib = {}
}
var dl = new DynamicLibrary(libfile || null, RTLD_NOW)
Objec... | Provides a friendly abstraction/API on-top of DynamicLibrary and
ForeignFunction. | Library | javascript | node-ffi/node-ffi | lib/library.js | https://github.com/node-ffi/node-ffi/blob/master/lib/library.js | MIT |
function Type (type) {
type = ref.coerceType(type)
debug('Type()', type.name || type)
assert(type.indirection >= 1, 'invalid "type" given: ' + (type.name || type))
var rtn
// first we assume it's a regular "type". if the "indirection" is greater than
// 1, then we can just use "pointer" ffi_type, otherwise... | Returns a `ffi_type *` Buffer appropriate for the given "type".
@param {Type|String} type A "ref" type (or string) to get the `ffi_type` for
@return {Buffer} A buffer pointing to a `ffi_type` instance for "type"
@api private | Type | javascript | node-ffi/node-ffi | lib/type.js | https://github.com/node-ffi/node-ffi/blob/master/lib/type.js | MIT |
proxy = function () {
debug('invoking proxy function')
if (arguments.length !== numArgs) {
throw new TypeError('Expected ' + numArgs +
' arguments, got ' + arguments.length)
}
// storage buffers for input arguments and the return value
var result = new Buffer(resultSize)
, ar... | This is the actual JS function that gets returned.
It handles marshalling input arguments into C values,
and unmarshalling the return value back into a JS value | proxy | javascript | node-ffi/node-ffi | lib/_foreign_function.js | https://github.com/node-ffi/node-ffi/blob/master/lib/_foreign_function.js | MIT |
function finish () {
kill()
gc() // now ensure the inner "cb" Buffer is collected
// should throw an Error asynchronously!,
// because the callback has been garbage collected.
// hijack the "uncaughtException" event for this test
var listeners = process.listeners('uncaughtException... | We should make sure that callbacks or errors gets propagated back to node's main thread
when it called on a non libuv native thread.
See: https://github.com/node-ffi/node-ffi/issues/199 | finish | javascript | node-ffi/node-ffi | test/callback.js | https://github.com/node-ffi/node-ffi/blob/master/test/callback.js | MIT |
function finish () {
bindings.call_cb()
assert.equal(4, invokeCount)
kill()
gc() // now ensure the inner "cb" Buffer is collected
// should throw an Error synchronously
try {
bindings.call_cb()
assert(false) // shouldn't get here
} catch (e) ... | See https://github.com/rbranson/node-ffi/issues/72.
This is a tough issue. If we pass the ffi_closure Buffer to some foreign
C function, we really don't know *when* it's safe to dispose of the Buffer,
so it's left up to the developer.
In this case, we wrap the responsibility in a simple "kill()" function
that, when ca... | finish | javascript | node-ffi/node-ffi | test/callback.js | https://github.com/node-ffi/node-ffi/blob/master/test/callback.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.