_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q50900 | remove_null_undefined | train | function remove_null_undefined(object) {
Object.keys(object).forEach(key => {
if (object[key] === null || typeof object[key] | javascript | {
"resource": ""
} |
q50901 | get_related_columns | train | function get_related_columns(collection) {
return Object.keys(collection.attributes)
| javascript | {
"resource": ""
} |
q50902 | compile_constraints | train | function compile_constraints(request, constraints) {
const Constraints = require("./constraints")
// Exit if there aren't any constraints.
if (!constraints)
return {}
return new | javascript | {
"resource": ""
} |
q50903 | replace_env_values | train | function replace_env_values(val_in) {
if (!val_in)
return ""
let val_out = val_in
const matches = val_in.match(/\$\w+/g)
if (matches)
matches.forEach(env => {
const value = process.env[env.substring(1, | javascript | {
"resource": ""
} |
q50904 | getJunctionTableFromModelAndRelatedColumn | train | function getJunctionTableFromModelAndRelatedColumn(model, parentTableName, relatedColumnTableName) {
const junctionTableName = Object.keys(model.waterline.schema)
.find(schemaName => {
const tables = model.waterline.schema[schemaName].tables
if (!tables) return false
return tables[0] === paren... | javascript | {
"resource": ""
} |
q50905 | hash_password | train | function hash_password(values, next) {
// If no password was provided, just move on and exit.
if (!values.password || values.password.length > 1000) {
return next()
}
this
.findOne(values)
.then(user => {
// Create a salt for this user if they don't have one.
const salt = user && user.s... | javascript | {
"resource": ""
} |
q50906 | toJSON | train | function toJSON() {
const model = this.toObject()
delete model.password
delete model.salt
// Return the | javascript | {
"resource": ""
} |
q50907 | custom_routes | train | function custom_routes(hapi_server, multicolour) {
// Joi is an amazing validation library,
// read me at https://github.com/hapijs/joi/blob/v10.2.2/API.md
const Joi = require("joi")
// Set up a simple route that counts examples.
hapi_server.route({
method: "GET",
path: "/example/count"... | javascript | {
"resource": ""
} |
q50908 | random | train | function random (utxos, outputs, feeRate) {
utxos = shuffle(utxos)
| javascript | {
"resource": ""
} |
q50909 | train | function (point, geopoly) {
var inside = 0;
if(geopoly.type !== "Polygon" && geopoly.type !== "MultiPolygon") return false;
var shape = geopoly.type === 'Polygon' ? [geopoly.coordinates] : geopoly.coordinates;
shape.forEach(function (polygon) | javascript | {
"resource": ""
} | |
q50910 | train | function(fn) {
return function(evt, param) {
var p = TP.getPkg(evt);
if (p.ytplayer) {
var ret = fn(evt, param, p);
if (typeof(ret) === "undefined") {
| javascript | {
"resource": ""
} | |
q50911 | train | function(storybook, baseUrl, previewRoute) {
// clean baseUrl. remove query/hash/trailing-slash
var urlObj = url.parse(baseUrl);
urlObj = omit(urlObj, 'hash', 'search', 'query');
urlObj.pathname = urlObj.pathname.replace(/\/$/, '');
baseUrl = url.format(urlObj);
// transform into states
var states = [];
... | javascript | {
"resource": ""
} | |
q50912 | train | function(current) {
if (current && current.props) {
if (current.props.isScreenerComponent === true) {
return current.props.steps;
} else {
var steps = null;
if (typeof current.props.st... | javascript | {
"resource": ""
} | |
q50913 | train | function(current) {
if (typeof current.steps === 'object' && typeof current.steps.map === 'function' && current.steps.length > 0) {
return current.steps;
}
var steps = null;
if (typeof current.render === 'function') {
... | javascript | {
"resource": ""
} | |
q50914 | hasRest | train | function hasRest(pattern) {
for (let elem of pattern.elements) {
if (isRestElement(t, elem)) {
| javascript | {
"resource": ""
} |
q50915 | getDirective | train | function getDirective(path) {
for (let directive of path.node.directives) {
let dirstr = directive.value.value
if (dirstr.startsWith('use ')) {
let uses = dirstr.substr(4).split(',').map((use) => use.trim())
if (uses.indexOf('extensible') !== -1) { | javascript | {
"resource": ""
} |
q50916 | flipPixels | train | function flipPixels(buffer, width, height) {
const newBuffer = Buffer.alloc(buffer.length)
for (let x = 0; x < width; x += 1) {
for (let y = 0; y < height; y += 1) {
const offset = (width * y + x) << 2
const newOffset = (width * y + width - 1 - | javascript | {
"resource": ""
} |
q50917 | parseOrientationTag | train | function parseOrientationTag({buffer, exifData}) {
let orientation = null
if (exifData['0th'] && exifData['0th'][piexif.ImageIFD.Orientation]) {
orientation = parseInt(exifData['0th'][piexif.ImageIFD.Orientation])
}
if (orientation === null) {
throw new CustomError(m.errors.no_orientation, 'No orientati... | javascript | {
"resource": ""
} |
q50918 | computeFinalBuffer | train | function computeFinalBuffer(image, thumbnail, exifData, orientation) {
exifData['0th'][piexif.ImageIFD.Orientation] = 1
if (typeof exifData['Exif'][piexif.ExifIFD.PixelXDimension] !== 'undefined') {
exifData['Exif'][piexif.ExifIFD.PixelXDimension] = image.width
}
if (typeof exifData['Exif'][piexif.ExifIFD.P... | javascript | {
"resource": ""
} |
q50919 | contextRenderer | train | function contextRenderer (tpl, locals, options, noCache) {
var finalLocals = merge({}, helpers, defaultLocals, this.state, locals)
this.body | javascript | {
"resource": ""
} |
q50920 | train | function (restrict) {
return ['$compile', function ($compile) {
return {
restrict: restrict,
require: ['?^valdrType', '?^ngModel', '?^valdrFormGroup'],
link: function (scope, element, attrs, controllers) {
var valdrTypeController = controllers[0],
ngModelControll... | javascript | {
"resource": ""
} | |
q50921 | train | function (value, prefix) {
return angular.isString(value) &&
angular.isString(prefix) &&
| javascript | {
"resource": ""
} | |
q50922 | train | function (value, constraint) {
var pattern = asRegExp(constraint.value);
return | javascript | {
"resource": ""
} | |
q50923 | train | function (value, constraint) {
if (valdrUtil.isEmpty(value)) {
return true;
}
if (valdrUtil.isNaN(Number(value))) | javascript | {
"resource": ""
} | |
q50924 | train | function (typeName, fieldName, value) {
var validResult = { valid: true },
typeConstraints = constraintsForType(typeName);
if (valdrUtil.has(typeConstraints, fieldName)) {
var fieldConstraints = typeConstraints[fieldName],
fieldIsValid = tr... | javascript | {
"resource": ""
} | |
q50925 | train | function (value) {
if (valdrUtil.isEmpty(value)) {
return true;
}
// split email at '@' and consider local and domain part separately
var emailParts = value.split('@');
if (emailParts.length !== 2) {
return false;
| javascript | {
"resource": ""
} | |
q50926 | train | function(tech) {
return (this.level.getConfig().bundleBuildLevels || | javascript | {
"resource": ""
} | |
q50927 | train | function(techName, techPath, declPath, bundleNode, magicNode, forked) {
var arch = this.ctx.arch,
buildNode = new BemBuildNode.BemBuildNode({
root: this.root,
bundlesLevel: this.level,
levels: this.getLevels(techName),
declPath: declPa... | javascript | {
"resource": ""
} | |
q50928 | train | function(techName, techPath, bundleNode, magicNode, force, forked) {
var arch = this.ctx.arch,
node = this.useFileOrBuild(new BemCreateNode.BemCreateNode({
root: this.root,
level: this.level,
item: this.item,
techPath: techPath,
... | javascript | {
"resource": ""
} | |
q50929 | train | function(tech, bundleNode, magicNode) {
var arch = this.ctx.arch,
filePath = this.getBundlePath(tech);
if (!PATH.existsSync(PATH.resolve(this.root, filePath))) return;
var node = new fileNodes.FileNode({
root: this.root,
| javascript | {
"resource": ""
} | |
q50930 | train | function(tech, bundleNode, magicNode) {
var ctx = this.ctx,
arch = ctx.arch,
levelNode = arch.getNode(PATH.relative(this.root, this.level.dir)),
depsTech = this.level.getTech('deps.js').getTechName(),
bundles = arch.getChildren(levelNode)
.filter(... | javascript | {
"resource": ""
} | |
q50931 | train | function(nodeName, objectOrBaseName, objectOrStatic, staticObject) {
var explicitBase = typeof objectOrBaseName === 'string',
baseName = explicitBase? objectOrBaseName : nodeName,
staticObj = typeof objectOrBaseName !== 'string'? objectOrStatic: staticObject,
obj = explicitB... | javascript | {
"resource": ""
} | |
q50932 | train | function(nodeName, objectOrBaseName, objectOrStatic, staticObject) {
cache = {};
| javascript | {
"resource": ""
} | |
q50933 | d3_format_group | train | function d3_format_group(value) {
var i = value.lastIndexOf("."),
f = i >= 0 ? value.substring(i) : (i = value.length, ""),
t = [];
while (i | javascript | {
"resource": ""
} |
q50934 | l | train | function l(e) {
var o = d3.event; // Events can be reentrant (e.g., focus).
d3.event = e;
try {
| javascript | {
"resource": ""
} |
q50935 | brush | train | function brush(g) {
g.each(function() {
var g = d3.select(this),
bg = g.selectAll(".background").data([0]),
fg = g.selectAll(".extent").data([0]),
tz = g.selectAll(".resize").data(resizes, String),
e;
// Prepare the brush container for events.
g
.... | javascript | {
"resource": ""
} |
q50936 | recurse | train | function recurse(data, depth, nodes) {
var childs = children.call(hierarchy, data, depth),
node = d3_layout_hierarchyInline ? data : {data: data};
node.depth = depth;
nodes.push(node);
if (childs && (n = childs.length)) {
var i = -1,
n,
c = node.children = [],
... | javascript | {
"resource": ""
} |
q50937 | revalue | train | function revalue(node, depth) {
var children = node.children,
v = 0;
if (children && (n = children.length)) {
var i = -1,
n,
j = depth + 1;
while (++i < n) v += revalue(children[i], j);
} else if (value) {
| javascript | {
"resource": ""
} |
q50938 | d3_layout_hierarchyRebind | train | function d3_layout_hierarchyRebind(object, hierarchy) {
d3.rebind(object, hierarchy, "sort", "children", "value");
// Add an alias for links, for convenience.
object.links = d3_layout_hierarchyLinks;
// If the new API is used, enabling inlining.
| javascript | {
"resource": ""
} |
q50939 | squarify | train | function squarify(node) {
var children = node.children;
if (children && children.length) {
var rect = pad(node),
row = [],
remaining = children.slice(), // copy-on-write
child,
best = Infinity, // the best row score so far
score, // the current row score
... | javascript | {
"resource": ""
} |
q50940 | stickify | train | function stickify(node) {
var children = node.children;
if (children && children.length) {
var rect = pad(node),
remaining = children.slice(), // copy-on-write
child,
row = [];
scale(remaining, rect.dx * rect.dy / node.value);
row.area = 0;
while (child = re... | javascript | {
"resource": ""
} |
q50941 | token | train | function token() {
if (re.lastIndex >= text.length) return EOF; // special case: end of file
if (eol) { eol = false; return EOL; } // special case: end of line
// special case: quotes
var j = re.lastIndex;
if (text.charCodeAt(j) === 34) {
var i = j;
while (i++ < text.length) {
i... | javascript | {
"resource": ""
} |
q50942 | resample | train | function resample(coordinates) {
var i = 0,
n = coordinates.length,
j,
m,
resampled = n ? [coordinates[0]] : coordinates,
resamples,
| javascript | {
"resource": ""
} |
q50943 | d3_geom_hullCCW | train | function d3_geom_hullCCW(i1, i2, i3, v) {
var t, a, b, c, d, e, f;
t = v[i1]; a = t[0]; b = t[1];
t = v[i2]; c = t[0]; d = t[1];
t | javascript | {
"resource": ""
} |
q50944 | d3_geom_polygonIntersect | train | function d3_geom_polygonIntersect(c, d, a, b) {
var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0],
y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1],
x13 = x1 - x3,
x21 = x2 - x1,
x43 = x4 - x3,
y13 | javascript | {
"resource": ""
} |
q50945 | train | function(o) {
this.__base(o);
this.root = o.root;
this.target = o.target;
| javascript | {
"resource": ""
} | |
q50946 | train | function() {
var _this = this;
return QFS.statLink(this.getPath())
.fail(function() {
return false;
})
.then(function(stat) {
if (!stat) return;
/* jshint -W109 */
if (!stat.isSymbolicLink()) {
... | javascript | {
"resource": ""
} | |
q50947 | train | function(o) {
this.__base(o);
this.url = o.url;
this.paths = | javascript | {
"resource": ""
} | |
q50948 | train | function(o) {
this.__base(o);
this.treeish = o.treeish;
this.branch | javascript | {
"resource": ""
} | |
q50949 | train | function(o) {
this.__base(o);
this.paths = Array.isArray(o.paths)? | javascript | {
"resource": ""
} | |
q50950 | train | function() {
var _this = this,
base = this.__base();
if (this.revision === 'HEAD') return base;
return Q.all(this.paths.map(function(path) {
return QFS.exists(PATH.resolve(_this.root, _this.target, path))
.then(function(exists) {
... | javascript | {
"resource": ""
} | |
q50951 | train | function(path, opts) {
opts = opts || {};
this.dir = PATH.resolve(path.path || path);
this.projectRoot = opts.projectRoot || PATH.resolve('');
// NOTE: keep this.path for backwards compatibility
this.path = this.bemDir = PATH.join(this.dir, '.bem');
| javascript | {
"resource": ""
} | |
q50952 | train | function(techIdent, opts) {
if (typeof opts === 'boolean') {
//legacy code used `force` second argument
opts = {force: opts};
}
opts = opts || {};
if(bemUtil.isPath(techIdent)) {
return this.resolveTechPath(techIdent);
}
| javascript | {
"resource": ""
} | |
q50953 | train | function(techName) {
var p = this.getTechs()[techName];
return | javascript | {
"resource": ""
} | |
q50954 | train | function(techPath) {
// Get absolute path if path starts with "."
// NOTE: Can not replace check to !isAbsolute()
if(techPath.substring(0, 1) === '.') {
// Resolve relative path starting at level `.bem/` directory
techPath = PATH.join(this.bemDir, techPath);
... | javascript | {
"resource": ""
} | |
q50955 | train | function(item) {
var getter, args;
if (item.block) {
getter = 'block';
args = [item.block];
if (item.elem) {
getter = 'elem';
args.push(item.elem);
}
if (item.mod) {
getter += '-mod';
... | javascript | {
"resource": ""
} | |
q50956 | train | function(block, mod) {
return PATH.join.apply(null,
[block,
| javascript | {
"resource": ""
} | |
q50957 | train | function(path) {
if (PATH.isAbsolute(path)) path = PATH.relative(this.dir, path);
var matchTechs = this.matchTechsOrder().map(function(t) {
return this.getTech(t);
}, this);
return this.matchOrder().reduce(function(match, matcher) {
// Skip if already m... | javascript | {
"resource": ""
} | |
q50958 | train | function(blockName) {
// TODO: support any custom naming scheme, e.g. flat, when there are
// no directories for blocks
| javascript | {
"resource": ""
} | |
q50959 | train | function(from) {
this._declIntrospector || (this._declIntrospector = this.createIntrospector({
creator: function(res, match) {
if (match && match.tech) {
| javascript | {
"resource": ""
} | |
q50960 | train | function(opts) {
var level = this;
if (!opts) opts = {
opts: false
};
// clone opts
opts = bemUtil.extend({}, opts);
// set default options
opts.from || (opts.from = '.');
// initial value initializer
opts.init || (opts.init = func... | javascript | {
"resource": ""
} | |
q50961 | train | function(path, opts) {
var bemDir = PATH.join(path, '.bem'),
levels = PATH.join(bemDir, 'levels'),
// .bem/levels/create blocks.js level prototype
blocks = this.createLevel({
forceTech: ['examples', 'tech-docs'],
outputDir: levels,
... | javascript | {
"resource": ""
} | |
q50962 | train | function() {
return Q.all(this.tech
.getPaths(PATH.resolve(this.root, this.output), this.tech.getBuildSuffixes())
.map(function(path) {
return QFS.lastModified(path)
| javascript | {
"resource": ""
} | |
q50963 | vimeo_fetcher | train | async function vimeo_fetcher(env) {
tpl.query.url = env.src;
let response;
try {
response = await env.self.request(url.format(tpl));
} catch (err) {
if (err.statusCode) {
throw new EmbedzaError(
`Vimeo fetcher: Bad response code: ${err.statusCode}`,
... | javascript | {
"resource": ""
} |
q50964 | findMeta | train | function findMeta(meta, names) {
if (!meta) return null;
if (!_.isArray(names)) names = [ names ];
let record;
names.some((name) => {
record = _.find(meta, (item) | javascript | {
"resource": ""
} |
q50965 | wlCheck | train | function wlCheck(wl, record, value) {
if (!value) value = 'allow';
let wlItem = _.get(wl, record);
if (_.isArray(wlItem)) return | javascript | {
"resource": ""
} |
q50966 | createUpdateRDF | train | function createUpdateRDF(manifest) {
var header = [{
name: "RDF",
attrs: {
"xmlns": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"xmlns:em": "http://www.mozilla.org/2004/em-rdf#"
},
children: []
}];
var description = {
name: "Description",
attrs: {
"about": "urn:mozilla... | javascript | {
"resource": ""
} |
q50967 | filter | train | function filter(options, includes, root, filepath, stat) {
var paths = path.relative(root, filepath).split(path.sep);
// always include test/tests directory when running jpm test
| javascript | {
"resource": ""
} |
q50968 | ignore | train | function ignore(dir, options) {
var jpmignore = path.join(dir, ".jpmignore");
var defaultRules = ["*.zip", ".*", "test/", ".jpmignore", "*.xpi"];
return utils.getManifest({addonDir: options.addonDir})
.then(function(manifest) {
return fs.exists(jpmignore);
})
.then(function(exists) {
if (... | javascript | {
"resource": ""
} |
q50969 | listdir | train | function listdir(dir, rules, root, included) {
return fs.readdir(dir)
.then(function(files) {
return when.all(files.map(function(f) {
f = path.join(dir, f);
return when(fs.stat(f), function(stat) {
return {
path: f,
isDirectory: stat.isDirectory()
};
});
... | javascript | {
"resource": ""
} |
q50970 | filter | train | function filter(p, rules, root, isDirectory, included) {
p = path.relative(root, p);
for (var i in rules) {
var rule = rules[i];
if (isDirectory) {
if (rule.match(p) || rule.match("/" + p) ||
rule.match(p + "/") || rule.match("/" + p + "/")
) {
| javascript | {
"resource": ""
} |
q50971 | log | train | function log(type) {
var messages = Array.prototype.slice.call(arguments);
messages.shift();
// Concatenate default strings and first message argument into
// one string so we can use `printf`-like replacement
var first = "JPM [" + type + "] | javascript | {
"resource": ""
} |
q50972 | getManifest | train | function getManifest(options) {
options = _.assign({
addonDir: process.cwd(),
xpiPath: null
}, options);
return when.promise(function(resolve, reject) {
if (options.xpiPath) {
return getXpiInfo(options.xpiPath)
.then(function(xpiInfo) {
resolve(xpiInfo.manifest);
})
... | javascript | {
"resource": ""
} |
q50973 | getXpiInfo | train | function getXpiInfo(xpiPath) {
return extractXPI(xpiPath)
.then(function(tmpXPI) {
var getInfo;
var packageFile = path.join(tmpXPI.path, "package.json");
var installRdfFile = path.join(tmpXPI.path, "install.rdf");
if (fileExists(packageFile)) {
getInfo = getXpiInfoFromManifest(req... | javascript | {
"resource": ""
} |
q50974 | addPrefs | train | function addPrefs(profile, options) {
var userPrefs = options.prefs || {};
return when.promise(function(resolve, reject) {
Object.keys(userPrefs).forEach(function(key) {
| javascript | {
"resource": ""
} |
q50975 | Checkit | train | function Checkit(validations, options) {
if (!(this instanceof Checkit)) {
return new Checkit(validations, options);
}
this.conditional = [];
options = _.clone(options || {});
this.labels = options.labels || {};
this.messages = options.messages || {};
this.language | javascript | {
"resource": ""
} |
q50976 | checkSync | train | function checkSync(validations, input, key) {
var arr = new Checkit(validations).runSync(input);
if (arr[0] === null) return arr;
| javascript | {
"resource": ""
} |
q50977 | Runner | train | function Runner(checkit, target, context) {
this.errors = {};
this.checkit = checkit;
this.conditional = checkit.conditional;
this.target = _.clone(target || {}) | javascript | {
"resource": ""
} |
q50978 | addVerifiedConditional | train | function addVerifiedConditional(validations, conditional) {
_.each(conditional[0], function(val, key) {
validations[key] = | javascript | {
"resource": ""
} |
q50979 | checkConditional | train | function checkConditional(runner, conditional) {
try {
return conditional[1].call(runner, | javascript | {
"resource": ""
} |
q50980 | processItemAsync | train | function processItemAsync(runner, currentValidation, key, context) {
return | javascript | {
"resource": ""
} |
q50981 | train | function(val, item) {
if (_.isString(val)) return val.indexOf(item) !== -1;
if (_.isArray(val)) return _.indexOf(val, item) !== -1;
| javascript | {
"resource": ""
} | |
q50982 | train | function(val, param) {
return checkNumber(val) | javascript | {
"resource": ""
} | |
q50983 | train | function(flat) {
return this.transform(function(acc, val, key) {
var json = val.toJSON();
acc[key] = flat | javascript | {
"resource": ""
} | |
q50984 | prepValidations | train | function prepValidations(validations) {
validations = _.cloneDeep(validations);
for (var key in validations) {
var validation = validations[key];
if (!_.isArray(validation)) validations[key] = validation = [validation];
for (var i | javascript | {
"resource": ""
} |
q50985 | mergeQueries | train | function mergeQueries(query, options) {
if (options == null) {
return query;
}
Object.keys(options).forEach(key => {
let label = key;
let value = options[key];
validateProp(key, value);
switch (key) {
case 'orderByKey':
label = orderedBy;
| javascript | {
"resource": ""
} |
q50986 | validateProp | train | function validateProp(key, value) {
const type = typeof value;
switch (key) {
case 'orderByKey':
case 'orderByPriority':
case 'orderByValue':
if (!value) {
throw new Error(`"query.${key}" should not be set to false. Set it off by setting an other order.`);
}
break;
case 'orderByChild':
... | javascript | {
"resource": ""
} |
q50987 | setInflectType | train | function setInflectType (inflect, types) {
// use inflections if set as object else start fresh
const out = typeof inflect === 'boolean' ? {} : inflect
// if inflect is boolean use it for all types,
// else use default for unset types
const setInflect = typeof inflect === 'boolean' ? inflect : inflectTypeDef... | javascript | {
"resource": ""
} |
q50988 | processBsbError | train | function processBsbError(err /*: Error | string */) /*: Error[] */ {
if (typeof err === 'string') {
const errors = errorRegexes
// $FlowIssue: err is definitely a | javascript | {
"resource": ""
} |
q50989 | runBuild | train | function runBuild(cwd /*: string */) /*: Promise<string> */ {
return new Promise((resolve, reject) => {
exec(bsb, {maxBuffer: Infinity, cwd}, | javascript | {
"resource": ""
} |
q50990 | compileFile | train | function compileFile(
buildDir /*: string */,
moduleType /*: BsModuleFormat | 'js' */,
path /*: string */,
id /*: ?string */ = null,
) /*: Promise<Compilation> */ {
if (id && buildRuns[id] !== undefined) {
buildRuns[id] = runBuild(buildDir)
}
const buildProcess = id ? buildRuns[id] : runBuild(buildDi... | javascript | {
"resource": ""
} |
q50991 | compileFileSync | train | function compileFileSync(
buildDir /*: string */,
moduleType /*: BsModuleFormat | 'js' */,
path /*: string */,
) /*: string */ {
try {
runBuildSync(buildDir)
} catch (e) {
| javascript | {
"resource": ""
} |
q50992 | compact | train | function compact(value, keepNewlines) {
var check | javascript | {
"resource": ""
} |
q50993 | Helpers | train | function Helpers(options) {
this.config = {};
for (var key in options || {}) {
| javascript | {
"resource": ""
} |
q50994 | Minimize | train | function Minimize(parser, options) {
if ('object' !== typeof options) {
options = parser || {};
options.dom = options.dom || {};
parser = void 0;
}
this.emits = emits;
this.plugins = Object.create(null);
this.helpers = new Helpers(options);
//
// Prepare the parser. | javascript | {
"resource": ""
} |
q50995 | traverser | train | function traverser(element, content, next) {
return function () { | javascript | {
"resource": ""
} |
q50996 | step | train | function step(element, type, cb) {
return function generate(error, html) {
html | javascript | {
"resource": ""
} |
q50997 | run | train | function run(element, cb) {
return function level(error, content) {
debug('Traversing children of element %s', element.name);
if (sync) {
| javascript | {
"resource": ""
} |
q50998 | createPlug | train | function createPlug(element) {
return function plug(plugin, fn) {
fn = fn || minimize.emits('plugin');
| javascript | {
"resource": ""
} |
q50999 | reduce | train | function reduce(html, element, next) {
//
// Run the registered plugins before the element is processed.
// Note that the plugins are not run in order.
//
if (sync) {
plugins.forEach(createPlug(element));
return open(element, html, run(element, next));
| javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.