Acme.BookStore.HttpApi.Host/node_modules/nanomatch/lib/compiler2.js
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
'use strict';
/**
* Nanomatch compilers
*/
module.exports = function(nanomatch, options) {
var star = '[^/]*?';
var compiler = nanomatch.compiler;
var ast = nanomatch.ast = nanomatch.parser.ast;
ast.state = nanomatch.parser.state;
compiler.state = ast.state;
/**
* Negation / escaping
*/
compiler.set('not', function(node) {
var prev = this.prev();
if (this.options.nonegate === true || prev.type !== 'bos') {
return this.emit('\\' + node.val, node);
}
return this.emit(node.val, node);
});
compiler.set('escape', function(node) {
if (this.options.unescape && /^[\w_.-]/.test(node.val)) {
return this.emit(node.val, node);
}
return this.emit('\\' + node.val, node);
});
compiler.set('quoted', function(node) {
return this.emit(node.val, node);
});
/**
* Regex
*/
compiler.set('dollar', function(node) {
if (node.parent.type === 'bracket') {
return this.emit(node.val, node);
}
return this.emit('\\' + node.val, node);
});
/**
* Dot: "."
*/
compiler.set('dot', function(node) {
if (node.dotfiles === true) this.dotfiles = true;
return this.emit('\\' + node.val, node);
});
/**
* Slashes: "/" and "\"
*/
后面还有 260 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
