id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
18,000 | kriskowal/asap | scripts/gauntlet.js | measure | function measure(test, done) {
var start = now();
test(function (error, results) {
var stop = now();
done(error, results, stop - start);
});
} | javascript | function measure(test, done) {
var start = now();
test(function (error, results) {
var stop = now();
done(error, results, stop - start);
});
} | [
"function",
"measure",
"(",
"test",
",",
"done",
")",
"{",
"var",
"start",
"=",
"now",
"(",
")",
";",
"test",
"(",
"function",
"(",
"error",
",",
"results",
")",
"{",
"var",
"stop",
"=",
"now",
"(",
")",
";",
"done",
"(",
"error",
",",
"results",... | measures the duration of one iteration | [
"measures",
"the",
"duration",
"of",
"one",
"iteration"
] | 3e3d99381444379bb0483cb9216caa39ac67bebb | https://github.com/kriskowal/asap/blob/3e3d99381444379bb0483cb9216caa39ac67bebb/scripts/gauntlet.js#L49-L55 |
18,001 | kriskowal/asap | scripts/gauntlet.js | sample | function sample(test, asap, minDuration, sampleSize, done) {
var count = 0;
var totalDuration = 0;
var sampleDurations = [];
next();
function next() {
measure(function (done) {
test(asap, done);
}, function (error, results, duration) {
if (error) {
... | javascript | function sample(test, asap, minDuration, sampleSize, done) {
var count = 0;
var totalDuration = 0;
var sampleDurations = [];
next();
function next() {
measure(function (done) {
test(asap, done);
}, function (error, results, duration) {
if (error) {
... | [
"function",
"sample",
"(",
"test",
",",
"asap",
",",
"minDuration",
",",
"sampleSize",
",",
"done",
")",
"{",
"var",
"count",
"=",
"0",
";",
"var",
"totalDuration",
"=",
"0",
";",
"var",
"sampleDurations",
"=",
"[",
"]",
";",
"next",
"(",
")",
";",
... | measures iterations of the test for a duration, maintaining a representative sample of the measurements up to a given size | [
"measures",
"iterations",
"of",
"the",
"test",
"for",
"a",
"duration",
"maintaining",
"a",
"representative",
"sample",
"of",
"the",
"measurements",
"up",
"to",
"a",
"given",
"size"
] | 3e3d99381444379bb0483cb9216caa39ac67bebb | https://github.com/kriskowal/asap/blob/3e3d99381444379bb0483cb9216caa39ac67bebb/scripts/gauntlet.js#L59-L95 |
18,002 | vesln/nixt | lib/nixt/expectations.js | assertOut | function assertOut(key, expected, result) {
var actual = result[key];
var statement = expected instanceof RegExp
? expected.test(actual)
: expected === actual;
if (statement !== true) {
var message = 'Expected ' + key +' to match "' + expected + '". Actual: "' + actual + '"';
return error(result,... | javascript | function assertOut(key, expected, result) {
var actual = result[key];
var statement = expected instanceof RegExp
? expected.test(actual)
: expected === actual;
if (statement !== true) {
var message = 'Expected ' + key +' to match "' + expected + '". Actual: "' + actual + '"';
return error(result,... | [
"function",
"assertOut",
"(",
"key",
",",
"expected",
",",
"result",
")",
"{",
"var",
"actual",
"=",
"result",
"[",
"key",
"]",
";",
"var",
"statement",
"=",
"expected",
"instanceof",
"RegExp",
"?",
"expected",
".",
"test",
"(",
"actual",
")",
":",
"ex... | Assert stdout or stderr.
@param {String} stdout/stderr
@param {Mixed} expected
@param {Result} result
@returns {AssertionError|null}
@api private | [
"Assert",
"stdout",
"or",
"stderr",
"."
] | d2075099ecf935c870705fa5d5de437113d4d272 | https://github.com/vesln/nixt/blob/d2075099ecf935c870705fa5d5de437113d4d272/lib/nixt/expectations.js#L138-L148 |
18,003 | vesln/nixt | lib/nixt/expectations.js | error | function error(result, message, expected, actual) {
var err = new AssertionError('`' + result.cmd + '`: ' + message);
err.result = result;
if (expected) err.expected = expected;
if (actual) err.actual = actual;
return err;
} | javascript | function error(result, message, expected, actual) {
var err = new AssertionError('`' + result.cmd + '`: ' + message);
err.result = result;
if (expected) err.expected = expected;
if (actual) err.actual = actual;
return err;
} | [
"function",
"error",
"(",
"result",
",",
"message",
",",
"expected",
",",
"actual",
")",
"{",
"var",
"err",
"=",
"new",
"AssertionError",
"(",
"'`'",
"+",
"result",
".",
"cmd",
"+",
"'`: '",
"+",
"message",
")",
";",
"err",
".",
"result",
"=",
"resul... | Create and return a new `AssertionError`.
It will assign the given `result` to it, it will also prepend the executed command
to the error message.
Assertion error is a constructor for test and validation frameworks that implements
standardized Assertion Error specification.
For more info go visit https://github.com/c... | [
"Create",
"and",
"return",
"a",
"new",
"AssertionError",
".",
"It",
"will",
"assign",
"the",
"given",
"result",
"to",
"it",
"it",
"will",
"also",
"prepend",
"the",
"executed",
"command",
"to",
"the",
"error",
"message",
"."
] | d2075099ecf935c870705fa5d5de437113d4d272 | https://github.com/vesln/nixt/blob/d2075099ecf935c870705fa5d5de437113d4d272/lib/nixt/expectations.js#L166-L172 |
18,004 | vesln/nixt | lib/nixt/result.js | Result | function Result(cmd, code, options) {
options = options || {};
this.options = options;
this.code = code;
this.cmd = cmd;
} | javascript | function Result(cmd, code, options) {
options = options || {};
this.options = options;
this.code = code;
this.cmd = cmd;
} | [
"function",
"Result",
"(",
"cmd",
",",
"code",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"options",
"=",
"options",
";",
"this",
".",
"code",
"=",
"code",
";",
"this",
".",
"cmd",
"=",
"cmd",
";",
"}"
... | Simple object that contains the result
of command executions.
@constructor | [
"Simple",
"object",
"that",
"contains",
"the",
"result",
"of",
"command",
"executions",
"."
] | d2075099ecf935c870705fa5d5de437113d4d272 | https://github.com/vesln/nixt/blob/d2075099ecf935c870705fa5d5de437113d4d272/lib/nixt/result.js#L8-L13 |
18,005 | vesln/nixt | lib/nixt/runner.js | Runner | function Runner(options) {
if (!(this instanceof Runner)) return new Runner(options);
options = options || {};
this.options = options;
this.batch = new Batch;
this.world = new World;
this.expectations = [];
this.prompts = [];
this.responses = [];
this.baseCmd = '';
this.standardInput = null;
} | javascript | function Runner(options) {
if (!(this instanceof Runner)) return new Runner(options);
options = options || {};
this.options = options;
this.batch = new Batch;
this.world = new World;
this.expectations = [];
this.prompts = [];
this.responses = [];
this.baseCmd = '';
this.standardInput = null;
} | [
"function",
"Runner",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Runner",
")",
")",
"return",
"new",
"Runner",
"(",
"options",
")",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"options",
"=",
"options"... | The primary entry point for every Nixt test.
It provides public interface that the users will interact with.
Every `Runner` instance can be cloned and this way one can build
the so called "templates".
Options:
- colors: default - true, Strip colors from stdout and stderr when `false`
- newlines: default - true,... | [
"The",
"primary",
"entry",
"point",
"for",
"every",
"Nixt",
"test",
".",
"It",
"provides",
"public",
"interface",
"that",
"the",
"users",
"will",
"interact",
"with",
".",
"Every",
"Runner",
"instance",
"can",
"be",
"cloned",
"and",
"this",
"way",
"one",
"c... | d2075099ecf935c870705fa5d5de437113d4d272 | https://github.com/vesln/nixt/blob/d2075099ecf935c870705fa5d5de437113d4d272/lib/nixt/runner.js#L70-L81 |
18,006 | vesln/nixt | lib/nixt/world.js | World | function World(env, cwd) {
this.env = env || clone(process.env);
this.cwd = cwd;
this.timeout = null;
} | javascript | function World(env, cwd) {
this.env = env || clone(process.env);
this.cwd = cwd;
this.timeout = null;
} | [
"function",
"World",
"(",
"env",
",",
"cwd",
")",
"{",
"this",
".",
"env",
"=",
"env",
"||",
"clone",
"(",
"process",
".",
"env",
")",
";",
"this",
".",
"cwd",
"=",
"cwd",
";",
"this",
".",
"timeout",
"=",
"null",
";",
"}"
] | Contain the environment variables and the
current working directory for commands.
@param {Object} env
@param {String} cwd
@constructor | [
"Contain",
"the",
"environment",
"variables",
"and",
"the",
"current",
"working",
"directory",
"for",
"commands",
"."
] | d2075099ecf935c870705fa5d5de437113d4d272 | https://github.com/vesln/nixt/blob/d2075099ecf935c870705fa5d5de437113d4d272/lib/nixt/world.js#L16-L20 |
18,007 | vivliostyle/vivliostyle.js | src/vivliostyle/counters.js | cloneCounterValues | function cloneCounterValues(counters) {
const result = {};
Object.keys(counters).forEach(name => {
result[name] = Array.from(counters[name]);
});
return result;
} | javascript | function cloneCounterValues(counters) {
const result = {};
Object.keys(counters).forEach(name => {
result[name] = Array.from(counters[name]);
});
return result;
} | [
"function",
"cloneCounterValues",
"(",
"counters",
")",
"{",
"const",
"result",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"counters",
")",
".",
"forEach",
"(",
"name",
"=>",
"{",
"result",
"[",
"name",
"]",
"=",
"Array",
".",
"from",
"(",
"coun... | Clone counter values.
@param {!adapt.csscasc.CounterValues} counters
@returns {!adapt.csscasc.CounterValues} | [
"Clone",
"counter",
"values",
"."
] | edad7782d3cf368203fc0ed229bc0bb4585ef8ad | https://github.com/vivliostyle/vivliostyle.js/blob/edad7782d3cf368203fc0ed229bc0bb4585ef8ad/src/vivliostyle/counters.js#L35-L41 |
18,008 | btd/rollup-plugin-visualizer | plugin.js | flattenTree | function flattenTree(root) {
let newChildren = [];
root.children.forEach(child => {
const commonParent = getDeepMoreThenOneChild(child);
if (commonParent.children.length === 0) {
newChildren.push(commonParent);
} else {
newChildren = newChildren.concat(commonParent.children);
}
});
r... | javascript | function flattenTree(root) {
let newChildren = [];
root.children.forEach(child => {
const commonParent = getDeepMoreThenOneChild(child);
if (commonParent.children.length === 0) {
newChildren.push(commonParent);
} else {
newChildren = newChildren.concat(commonParent.children);
}
});
r... | [
"function",
"flattenTree",
"(",
"root",
")",
"{",
"let",
"newChildren",
"=",
"[",
"]",
";",
"root",
".",
"children",
".",
"forEach",
"(",
"child",
"=>",
"{",
"const",
"commonParent",
"=",
"getDeepMoreThenOneChild",
"(",
"child",
")",
";",
"if",
"(",
"com... | if root children have only on child we can flatten this | [
"if",
"root",
"children",
"have",
"only",
"on",
"child",
"we",
"can",
"flatten",
"this"
] | a867784a93b191ea4bce174c849b7f89d5c265ae | https://github.com/btd/rollup-plugin-visualizer/blob/a867784a93b191ea4bce174c849b7f89d5c265ae/plugin.js#L129-L140 |
18,009 | alanshaw/david | lib/david.js | normaliseDeps | function normaliseDeps (deps) {
if (Array.isArray(deps)) {
deps = deps.reduce(function (d, depName) {
d[depName] = '*'
return d
}, {})
}
return deps
} | javascript | function normaliseDeps (deps) {
if (Array.isArray(deps)) {
deps = deps.reduce(function (d, depName) {
d[depName] = '*'
return d
}, {})
}
return deps
} | [
"function",
"normaliseDeps",
"(",
"deps",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"deps",
")",
")",
"{",
"deps",
"=",
"deps",
".",
"reduce",
"(",
"function",
"(",
"d",
",",
"depName",
")",
"{",
"d",
"[",
"depName",
"]",
"=",
"'*'",
"re... | Convert dependencies specified as an array to an object | [
"Convert",
"dependencies",
"specified",
"as",
"an",
"array",
"to",
"an",
"object"
] | 008beaf57c661df130d667352147539d0256b46f | https://github.com/alanshaw/david/blob/008beaf57c661df130d667352147539d0256b46f/lib/david.js#L15-L23 |
18,010 | alanshaw/david | bin/david.js | printWarnings | function printWarnings (deps, type) {
if (!Object.keys(deps).length) return
var warnings = {
E404: {title: 'Unregistered', list: []},
ESCM: {title: 'SCM', list: []},
EDEPTYPE: {title: 'Non-string dependency', list: []}
}
for (var name in deps) {
var dep = deps[name]
if (dep.warn) {
... | javascript | function printWarnings (deps, type) {
if (!Object.keys(deps).length) return
var warnings = {
E404: {title: 'Unregistered', list: []},
ESCM: {title: 'SCM', list: []},
EDEPTYPE: {title: 'Non-string dependency', list: []}
}
for (var name in deps) {
var dep = deps[name]
if (dep.warn) {
... | [
"function",
"printWarnings",
"(",
"deps",
",",
"type",
")",
"{",
"if",
"(",
"!",
"Object",
".",
"keys",
"(",
"deps",
")",
".",
"length",
")",
"return",
"var",
"warnings",
"=",
"{",
"E404",
":",
"{",
"title",
":",
"'Unregistered'",
",",
"list",
":",
... | Like printDeps, walk the list, but only print dependencies
with warnings.
@param {Object} deps
@param {String} type | [
"Like",
"printDeps",
"walk",
"the",
"list",
"but",
"only",
"print",
"dependencies",
"with",
"warnings",
"."
] | 008beaf57c661df130d667352147539d0256b46f | https://github.com/alanshaw/david/blob/008beaf57c661df130d667352147539d0256b46f/bin/david.js#L40-L68 |
18,011 | alanshaw/david | bin/david.js | getUpdatedDeps | function getUpdatedDeps (pkg, cb) {
var opts = {
stable: !argv.unstable,
loose: true,
error: {
E404: argv.error404,
ESCM: argv.errorSCM,
EDEPTYPE: argv.errorDepType
},
ignore: argv.ignore || argv.i
}
if (argv.registry) {
opts.npm = {registry: argv.registry}
}
david.... | javascript | function getUpdatedDeps (pkg, cb) {
var opts = {
stable: !argv.unstable,
loose: true,
error: {
E404: argv.error404,
ESCM: argv.errorSCM,
EDEPTYPE: argv.errorDepType
},
ignore: argv.ignore || argv.i
}
if (argv.registry) {
opts.npm = {registry: argv.registry}
}
david.... | [
"function",
"getUpdatedDeps",
"(",
"pkg",
",",
"cb",
")",
"{",
"var",
"opts",
"=",
"{",
"stable",
":",
"!",
"argv",
".",
"unstable",
",",
"loose",
":",
"true",
",",
"error",
":",
"{",
"E404",
":",
"argv",
".",
"error404",
",",
"ESCM",
":",
"argv",
... | Get updated deps, devDeps and optionalDeps | [
"Get",
"updated",
"deps",
"devDeps",
"and",
"optionalDeps"
] | 008beaf57c661df130d667352147539d0256b46f | https://github.com/alanshaw/david/blob/008beaf57c661df130d667352147539d0256b46f/bin/david.js#L132-L159 |
18,012 | alanshaw/david | bin/david.js | installDeps | function installDeps (deps, opts, cb) {
opts = opts || {}
var depNames = Object.keys(deps)
// Nothing to install!
if (!depNames.length) {
return cb(null)
}
depNames = depNames.filter(function (depName) {
return !deps[depName].warn
})
var npmOpts = {global: opts.global}
// Avoid warning me... | javascript | function installDeps (deps, opts, cb) {
opts = opts || {}
var depNames = Object.keys(deps)
// Nothing to install!
if (!depNames.length) {
return cb(null)
}
depNames = depNames.filter(function (depName) {
return !deps[depName].warn
})
var npmOpts = {global: opts.global}
// Avoid warning me... | [
"function",
"installDeps",
"(",
"deps",
",",
"opts",
",",
"cb",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
"var",
"depNames",
"=",
"Object",
".",
"keys",
"(",
"deps",
")",
"// Nothing to install!",
"if",
"(",
"!",
"depNames",
".",
"length",
")",
... | Install the passed dependencies
@param {Object} deps Dependencies to install (result from david)
@param {Object} opts Install options
@param {Boolean} [opts.global] Install globally
@param {Boolean} [opts.save] Save installed dependencies to dependencies/devDependencies/optionalDependencies
@param {Boolean} [opts.dev]... | [
"Install",
"the",
"passed",
"dependencies"
] | 008beaf57c661df130d667352147539d0256b46f | https://github.com/alanshaw/david/blob/008beaf57c661df130d667352147539d0256b46f/bin/david.js#L173-L212 |
18,013 | alanshaw/david | lib/version.js | isScm | function isScm (version) {
var scmPrefixes = ['git:', 'git+ssh:', 'https:', 'git+https:']
var blacklisted = scmPrefixes.filter(function (prefix) {
return version.indexOf(prefix) === 0
})
return !!blacklisted.length
} | javascript | function isScm (version) {
var scmPrefixes = ['git:', 'git+ssh:', 'https:', 'git+https:']
var blacklisted = scmPrefixes.filter(function (prefix) {
return version.indexOf(prefix) === 0
})
return !!blacklisted.length
} | [
"function",
"isScm",
"(",
"version",
")",
"{",
"var",
"scmPrefixes",
"=",
"[",
"'git:'",
",",
"'git+ssh:'",
",",
"'https:'",
",",
"'git+https:'",
"]",
"var",
"blacklisted",
"=",
"scmPrefixes",
".",
"filter",
"(",
"function",
"(",
"prefix",
")",
"{",
"retur... | Determine if a version is a SCM URL or not.
@param {String} version
@return {Boolean} | [
"Determine",
"if",
"a",
"version",
"is",
"a",
"SCM",
"URL",
"or",
"not",
"."
] | 008beaf57c661df130d667352147539d0256b46f | https://github.com/alanshaw/david/blob/008beaf57c661df130d667352147539d0256b46f/lib/version.js#L21-L27 |
18,014 | IceCreamYou/MainLoop.js | src/mainloop.js | function() {
if (!started) {
// Since the application doesn't start running immediately, track
// whether this function was called and use that to keep it from
// starting the main loop multiple times.
started = true;
// In the main loop, draw() is ca... | javascript | function() {
if (!started) {
// Since the application doesn't start running immediately, track
// whether this function was called and use that to keep it from
// starting the main loop multiple times.
started = true;
// In the main loop, draw() is ca... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"started",
")",
"{",
"// Since the application doesn't start running immediately, track",
"// whether this function was called and use that to keep it from",
"// starting the main loop multiple times.",
"started",
"=",
"true",
";",
"// In ... | Starts the main loop.
Note that the application is not considered "running" immediately after
this function returns; rather, it is considered "running" after the
application draws its first frame. The distinction is that event
handlers should remain paused until the application is running, even
after `MainLoop.start()... | [
"Starts",
"the",
"main",
"loop",
"."
] | 8ba83c370dba01e2d38e8daf6a8b285cf475afd5 | https://github.com/IceCreamYou/MainLoop.js/blob/8ba83c370dba01e2d38e8daf6a8b285cf475afd5/src/mainloop.js#L495-L526 | |
18,015 | IceCreamYou/MainLoop.js | src/mainloop.js | animate | function animate(timestamp) {
// Run the loop again the next time the browser is ready to render.
// We set rafHandle immediately so that the next frame can be canceled
// during the current frame.
rafHandle = requestAnimationFrame(animate);
// Throttle the frame rate (if minFrameDelay is set to a ... | javascript | function animate(timestamp) {
// Run the loop again the next time the browser is ready to render.
// We set rafHandle immediately so that the next frame can be canceled
// during the current frame.
rafHandle = requestAnimationFrame(animate);
// Throttle the frame rate (if minFrameDelay is set to a ... | [
"function",
"animate",
"(",
"timestamp",
")",
"{",
"// Run the loop again the next time the browser is ready to render.",
"// We set rafHandle immediately so that the next frame can be canceled",
"// during the current frame.",
"rafHandle",
"=",
"requestAnimationFrame",
"(",
"animate",
"... | The main loop that runs updates and rendering.
@param {DOMHighResTimeStamp} timestamp
The current timestamp. In practice this is supplied by
requestAnimationFrame at the time that it starts to fire callbacks. This
should only be used for comparison to other timestamps because the epoch
(i.e. the "zero" time) depends o... | [
"The",
"main",
"loop",
"that",
"runs",
"updates",
"and",
"rendering",
"."
] | 8ba83c370dba01e2d38e8daf6a8b285cf475afd5 | https://github.com/IceCreamYou/MainLoop.js/blob/8ba83c370dba01e2d38e8daf6a8b285cf475afd5/src/mainloop.js#L576-L745 |
18,016 | TooTallNate/plist.js | lib/build.js | build | function build (obj, opts) {
var XMLHDR = {
version: '1.0',
encoding: 'UTF-8'
};
var XMLDTD = {
pubid: '-//Apple//DTD PLIST 1.0//EN',
sysid: 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'
};
var doc = xmlbuilder.create('plist');
doc.dec(XMLHDR.version, XMLHDR.encoding, XMLHDR.standalone... | javascript | function build (obj, opts) {
var XMLHDR = {
version: '1.0',
encoding: 'UTF-8'
};
var XMLDTD = {
pubid: '-//Apple//DTD PLIST 1.0//EN',
sysid: 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'
};
var doc = xmlbuilder.create('plist');
doc.dec(XMLHDR.version, XMLHDR.encoding, XMLHDR.standalone... | [
"function",
"build",
"(",
"obj",
",",
"opts",
")",
"{",
"var",
"XMLHDR",
"=",
"{",
"version",
":",
"'1.0'",
",",
"encoding",
":",
"'UTF-8'",
"}",
";",
"var",
"XMLDTD",
"=",
"{",
"pubid",
":",
"'-//Apple//DTD PLIST 1.0//EN'",
",",
"sysid",
":",
"'http://w... | Generate an XML plist string from the input object `obj`.
@param {Object} obj - the object to convert
@param {Object} [opts] - optional options object
@returns {String} converted plist XML string
@api public | [
"Generate",
"an",
"XML",
"plist",
"string",
"from",
"the",
"input",
"object",
"obj",
"."
] | 1628c6ecc5462be367ac203225af3b55ed5e564c | https://github.com/TooTallNate/plist.js/blob/1628c6ecc5462be367ac203225af3b55ed5e564c/lib/build.js#L58-L81 |
18,017 | TooTallNate/plist.js | lib/build.js | walk_obj | function walk_obj(next, next_child) {
var tag_type, i, prop;
var name = type(next);
if ('Undefined' == name) {
return;
} else if (Array.isArray(next)) {
next_child = next_child.ele('array');
for (i = 0; i < next.length; i++) {
walk_obj(next[i], next_child);
}
} else if (Buffer.isBuffer... | javascript | function walk_obj(next, next_child) {
var tag_type, i, prop;
var name = type(next);
if ('Undefined' == name) {
return;
} else if (Array.isArray(next)) {
next_child = next_child.ele('array');
for (i = 0; i < next.length; i++) {
walk_obj(next[i], next_child);
}
} else if (Buffer.isBuffer... | [
"function",
"walk_obj",
"(",
"next",
",",
"next_child",
")",
"{",
"var",
"tag_type",
",",
"i",
",",
"prop",
";",
"var",
"name",
"=",
"type",
"(",
"next",
")",
";",
"if",
"(",
"'Undefined'",
"==",
"name",
")",
"{",
"return",
";",
"}",
"else",
"if",
... | depth first, recursive traversal of a javascript object. when complete,
next_child contains a reference to the build XML object.
@api private | [
"depth",
"first",
"recursive",
"traversal",
"of",
"a",
"javascript",
"object",
".",
"when",
"complete",
"next_child",
"contains",
"a",
"reference",
"to",
"the",
"build",
"XML",
"object",
"."
] | 1628c6ecc5462be367ac203225af3b55ed5e564c | https://github.com/TooTallNate/plist.js/blob/1628c6ecc5462be367ac203225af3b55ed5e564c/lib/build.js#L90-L137 |
18,018 | parro-it/electron-localshortcut | index.js | disableAll | function disableAll(win) {
debug(`Disabling all shortcuts on window ${title(win)}`);
const wc = win.webContents;
const shortcutsOfWindow = windowsWithShortcuts.get(wc);
for (const shortcut of shortcutsOfWindow) {
shortcut.enabled = false;
}
} | javascript | function disableAll(win) {
debug(`Disabling all shortcuts on window ${title(win)}`);
const wc = win.webContents;
const shortcutsOfWindow = windowsWithShortcuts.get(wc);
for (const shortcut of shortcutsOfWindow) {
shortcut.enabled = false;
}
} | [
"function",
"disableAll",
"(",
"win",
")",
"{",
"debug",
"(",
"`",
"${",
"title",
"(",
"win",
")",
"}",
"`",
")",
";",
"const",
"wc",
"=",
"win",
".",
"webContents",
";",
"const",
"shortcutsOfWindow",
"=",
"windowsWithShortcuts",
".",
"get",
"(",
"wc",... | Disable all of the shortcuts registered on the BrowserWindow instance.
Registered shortcuts no more works on the `window` instance, but the module
keep a reference on them. You can reactivate them later by calling `enableAll`
method on the same window instance.
@param {BrowserWindow} win BrowserWindow instance
@return... | [
"Disable",
"all",
"of",
"the",
"shortcuts",
"registered",
"on",
"the",
"BrowserWindow",
"instance",
".",
"Registered",
"shortcuts",
"no",
"more",
"works",
"on",
"the",
"window",
"instance",
"but",
"the",
"module",
"keep",
"a",
"reference",
"on",
"them",
".",
... | 3fbd63a6b3ca22368b218ecd39081c0d77d51ddc | https://github.com/parro-it/electron-localshortcut/blob/3fbd63a6b3ca22368b218ecd39081c0d77d51ddc/index.js#L50-L58 |
18,019 | parro-it/electron-localshortcut | index.js | enableAll | function enableAll(win) {
debug(`Enabling all shortcuts on window ${title(win)}`);
const wc = win.webContents;
const shortcutsOfWindow = windowsWithShortcuts.get(wc);
for (const shortcut of shortcutsOfWindow) {
shortcut.enabled = true;
}
} | javascript | function enableAll(win) {
debug(`Enabling all shortcuts on window ${title(win)}`);
const wc = win.webContents;
const shortcutsOfWindow = windowsWithShortcuts.get(wc);
for (const shortcut of shortcutsOfWindow) {
shortcut.enabled = true;
}
} | [
"function",
"enableAll",
"(",
"win",
")",
"{",
"debug",
"(",
"`",
"${",
"title",
"(",
"win",
")",
"}",
"`",
")",
";",
"const",
"wc",
"=",
"win",
".",
"webContents",
";",
"const",
"shortcutsOfWindow",
"=",
"windowsWithShortcuts",
".",
"get",
"(",
"wc",
... | Enable all of the shortcuts registered on the BrowserWindow instance that
you had previously disabled calling `disableAll` method.
@param {BrowserWindow} win BrowserWindow instance
@return {Undefined} | [
"Enable",
"all",
"of",
"the",
"shortcuts",
"registered",
"on",
"the",
"BrowserWindow",
"instance",
"that",
"you",
"had",
"previously",
"disabled",
"calling",
"disableAll",
"method",
"."
] | 3fbd63a6b3ca22368b218ecd39081c0d77d51ddc | https://github.com/parro-it/electron-localshortcut/blob/3fbd63a6b3ca22368b218ecd39081c0d77d51ddc/index.js#L66-L74 |
18,020 | parro-it/electron-localshortcut | index.js | unregisterAll | function unregisterAll(win) {
debug(`Unregistering all shortcuts on window ${title(win)}`);
const wc = win.webContents;
const shortcutsOfWindow = windowsWithShortcuts.get(wc);
// Remove listener from window
shortcutsOfWindow.removeListener();
windowsWithShortcuts.delete(wc);
} | javascript | function unregisterAll(win) {
debug(`Unregistering all shortcuts on window ${title(win)}`);
const wc = win.webContents;
const shortcutsOfWindow = windowsWithShortcuts.get(wc);
// Remove listener from window
shortcutsOfWindow.removeListener();
windowsWithShortcuts.delete(wc);
} | [
"function",
"unregisterAll",
"(",
"win",
")",
"{",
"debug",
"(",
"`",
"${",
"title",
"(",
"win",
")",
"}",
"`",
")",
";",
"const",
"wc",
"=",
"win",
".",
"webContents",
";",
"const",
"shortcutsOfWindow",
"=",
"windowsWithShortcuts",
".",
"get",
"(",
"w... | Unregisters all of the shortcuts registered on any focused BrowserWindow
instance. This method does not unregister any shortcut you registered on
a particular window instance.
@param {BrowserWindow} win BrowserWindow instance
@return {Undefined} | [
"Unregisters",
"all",
"of",
"the",
"shortcuts",
"registered",
"on",
"any",
"focused",
"BrowserWindow",
"instance",
".",
"This",
"method",
"does",
"not",
"unregister",
"any",
"shortcut",
"you",
"registered",
"on",
"a",
"particular",
"window",
"instance",
"."
] | 3fbd63a6b3ca22368b218ecd39081c0d77d51ddc | https://github.com/parro-it/electron-localshortcut/blob/3fbd63a6b3ca22368b218ecd39081c0d77d51ddc/index.js#L83-L92 |
18,021 | parro-it/electron-localshortcut | index.js | register | function register(win, accelerator, callback) {
let wc;
if (typeof callback === 'undefined') {
wc = ANY_WINDOW;
callback = accelerator;
accelerator = win;
} else {
wc = win.webContents;
}
if (Array.isArray(accelerator) === true) {
accelerator.forEach(accelerator => {
if (typeof accelerator === 'string... | javascript | function register(win, accelerator, callback) {
let wc;
if (typeof callback === 'undefined') {
wc = ANY_WINDOW;
callback = accelerator;
accelerator = win;
} else {
wc = win.webContents;
}
if (Array.isArray(accelerator) === true) {
accelerator.forEach(accelerator => {
if (typeof accelerator === 'string... | [
"function",
"register",
"(",
"win",
",",
"accelerator",
",",
"callback",
")",
"{",
"let",
"wc",
";",
"if",
"(",
"typeof",
"callback",
"===",
"'undefined'",
")",
"{",
"wc",
"=",
"ANY_WINDOW",
";",
"callback",
"=",
"accelerator",
";",
"accelerator",
"=",
"... | Registers the shortcut `accelerator`on the BrowserWindow instance.
@param {BrowserWindow} win - BrowserWindow instance to register.
This argument could be omitted, in this case the function register
the shortcut on all app windows.
@param {String|Array<String>} accelerator - the shortcut to register
@param {Function... | [
"Registers",
"the",
"shortcut",
"accelerator",
"on",
"the",
"BrowserWindow",
"instance",
"."
] | 3fbd63a6b3ca22368b218ecd39081c0d77d51ddc | https://github.com/parro-it/electron-localshortcut/blob/3fbd63a6b3ca22368b218ecd39081c0d77d51ddc/index.js#L152-L231 |
18,022 | parro-it/electron-localshortcut | index.js | unregister | function unregister(win, accelerator) {
let wc;
if (typeof accelerator === 'undefined') {
wc = ANY_WINDOW;
accelerator = win;
} else {
if (win.isDestroyed()) {
debug(`Early return because window is destroyed.`);
return;
}
wc = win.webContents;
}
if (Array.isArray(accelerator) === true) {
accelera... | javascript | function unregister(win, accelerator) {
let wc;
if (typeof accelerator === 'undefined') {
wc = ANY_WINDOW;
accelerator = win;
} else {
if (win.isDestroyed()) {
debug(`Early return because window is destroyed.`);
return;
}
wc = win.webContents;
}
if (Array.isArray(accelerator) === true) {
accelera... | [
"function",
"unregister",
"(",
"win",
",",
"accelerator",
")",
"{",
"let",
"wc",
";",
"if",
"(",
"typeof",
"accelerator",
"===",
"'undefined'",
")",
"{",
"wc",
"=",
"ANY_WINDOW",
";",
"accelerator",
"=",
"win",
";",
"}",
"else",
"{",
"if",
"(",
"win",
... | Unregisters the shortcut of `accelerator` registered on the BrowserWindow instance.
@param {BrowserWindow} win - BrowserWindow instance to unregister.
This argument could be omitted, in this case the function unregister the shortcut
on all app windows. If you registered the shortcut on a particular window instance, it... | [
"Unregisters",
"the",
"shortcut",
"of",
"accelerator",
"registered",
"on",
"the",
"BrowserWindow",
"instance",
"."
] | 3fbd63a6b3ca22368b218ecd39081c0d77d51ddc | https://github.com/parro-it/electron-localshortcut/blob/3fbd63a6b3ca22368b218ecd39081c0d77d51ddc/index.js#L241-L293 |
18,023 | weexteam/weex-vue-render | src/mixins/base.js | watchAppearForScrollables | function watchAppearForScrollables (tagName, context) {
// when this is a scroller/list/waterfall
if (scrollableTypes.indexOf(tagName) > -1) {
const sd = context.scrollDirection
if (!sd || sd !== 'horizontal') {
appearWatched = context
watchAppear(context, true)
}
}
} | javascript | function watchAppearForScrollables (tagName, context) {
// when this is a scroller/list/waterfall
if (scrollableTypes.indexOf(tagName) > -1) {
const sd = context.scrollDirection
if (!sd || sd !== 'horizontal') {
appearWatched = context
watchAppear(context, true)
}
}
} | [
"function",
"watchAppearForScrollables",
"(",
"tagName",
",",
"context",
")",
"{",
"// when this is a scroller/list/waterfall",
"if",
"(",
"scrollableTypes",
".",
"indexOf",
"(",
"tagName",
")",
">",
"-",
"1",
")",
"{",
"const",
"sd",
"=",
"context",
".",
"scrol... | if it's a scrollable tag, then watch appear events for it. | [
"if",
"it",
"s",
"a",
"scrollable",
"tag",
"then",
"watch",
"appear",
"events",
"for",
"it",
"."
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/src/mixins/base.js#L64-L73 |
18,024 | weexteam/weex-vue-render | src/core/node.js | bindEvents | function bindEvents (ctx, evts, attrs, tag, appearAttached) {
for (const key in evts) {
const appearEvtName = appearEventsMap[key]
if (appearEvtName) {
attrs[`data-evt-${appearEvtName}`] = ''
if (!appearAttached.value) {
appearAttached.value = true
attrs['weex-appear'] = ''
}... | javascript | function bindEvents (ctx, evts, attrs, tag, appearAttached) {
for (const key in evts) {
const appearEvtName = appearEventsMap[key]
if (appearEvtName) {
attrs[`data-evt-${appearEvtName}`] = ''
if (!appearAttached.value) {
appearAttached.value = true
attrs['weex-appear'] = ''
}... | [
"function",
"bindEvents",
"(",
"ctx",
",",
"evts",
",",
"attrs",
",",
"tag",
",",
"appearAttached",
")",
"{",
"for",
"(",
"const",
"key",
"in",
"evts",
")",
"{",
"const",
"appearEvtName",
"=",
"appearEventsMap",
"[",
"key",
"]",
"if",
"(",
"appearEvtName... | Tell whether a element is contained in a element who has
a attribute 'bubble'=true.
@param {HTMLElement} el
function inBubble (el) { if (typeof el._inBubble === 'boolean') { return el._inBubble } const parents = [] let parent = el.parentElement let inBubble while (parent && parent !== document.body) { if (typeof paren... | [
"Tell",
"whether",
"a",
"element",
"is",
"contained",
"in",
"a",
"element",
"who",
"has",
"a",
"attribute",
"bubble",
"=",
"true",
"."
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/src/core/node.js#L186-L219 |
18,025 | weexteam/weex-vue-render | src/weex/viewport.js | setRootFont | function setRootFont (width, viewportWidth, force) {
const doc = window.document
const rem = width * 750 / viewportWidth / 10
if (!doc.documentElement) { return }
const rootFontSize = doc.documentElement.style.fontSize
if (!rootFontSize || force) {
doc.documentElement.style.fontSize = rem + 'px'
}
inf... | javascript | function setRootFont (width, viewportWidth, force) {
const doc = window.document
const rem = width * 750 / viewportWidth / 10
if (!doc.documentElement) { return }
const rootFontSize = doc.documentElement.style.fontSize
if (!rootFontSize || force) {
doc.documentElement.style.fontSize = rem + 'px'
}
inf... | [
"function",
"setRootFont",
"(",
"width",
",",
"viewportWidth",
",",
"force",
")",
"{",
"const",
"doc",
"=",
"window",
".",
"document",
"const",
"rem",
"=",
"width",
"*",
"750",
"/",
"viewportWidth",
"/",
"10",
"if",
"(",
"!",
"doc",
".",
"documentElement... | set root font-size for rem units. If already been set, just skip this. | [
"set",
"root",
"font",
"-",
"size",
"for",
"rem",
"units",
".",
"If",
"already",
"been",
"set",
"just",
"skip",
"this",
"."
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/src/weex/viewport.js#L63-L73 |
18,026 | weexteam/weex-vue-render | src/lib/gesture.js | getCommonAncestor | function getCommonAncestor(el1, el2) {
var el = el1
while (el) {
if (el.contains(el2) || el == el2) {
return el
}
el = el.parentNode
}
return null
} | javascript | function getCommonAncestor(el1, el2) {
var el = el1
while (el) {
if (el.contains(el2) || el == el2) {
return el
}
el = el.parentNode
}
return null
} | [
"function",
"getCommonAncestor",
"(",
"el1",
",",
"el2",
")",
"{",
"var",
"el",
"=",
"el1",
"while",
"(",
"el",
")",
"{",
"if",
"(",
"el",
".",
"contains",
"(",
"el2",
")",
"||",
"el",
"==",
"el2",
")",
"{",
"return",
"el",
"}",
"el",
"=",
"el"... | find the closest common ancestor
if there's no one, return null
@param {Element} el1 first element
@param {Element} el2 second element
@return {Element} common ancestor | [
"find",
"the",
"closest",
"common",
"ancestor",
"if",
"there",
"s",
"no",
"one",
"return",
"null"
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/src/lib/gesture.js#L53-L62 |
18,027 | weexteam/weex-vue-render | src/lib/gesture.js | fireEvent | function fireEvent(element, type, extra) {
var event = doc.createEvent('HTMLEvents')
event.initEvent(type, true, true)
if (typeof extra === 'object') {
for (var p in extra) {
event[p] = extra[p]
}
}
/**
* A flag to distinguish with other events with the same name generated
* by another l... | javascript | function fireEvent(element, type, extra) {
var event = doc.createEvent('HTMLEvents')
event.initEvent(type, true, true)
if (typeof extra === 'object') {
for (var p in extra) {
event[p] = extra[p]
}
}
/**
* A flag to distinguish with other events with the same name generated
* by another l... | [
"function",
"fireEvent",
"(",
"element",
",",
"type",
",",
"extra",
")",
"{",
"var",
"event",
"=",
"doc",
".",
"createEvent",
"(",
"'HTMLEvents'",
")",
"event",
".",
"initEvent",
"(",
"type",
",",
"true",
",",
"true",
")",
"if",
"(",
"typeof",
"extra",... | fire a HTMLEvent
@param {Element} element which element to fire a event on
@param {string} type type of event
@param {object} extra extra data for the event object | [
"fire",
"a",
"HTMLEvent"
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/src/lib/gesture.js#L71-L88 |
18,028 | weexteam/weex-vue-render | src/modules/storage.js | function (key, value, callbackId) {
const sender = this.sender
if (!supportLocalStorage) {
return callNotSupportFail(sender, callbackId)
}
if (!key || (!value && value !== 0)) {
sender.performCallback(callbackId, {
result: 'failed',
data: INVALID_PARAM
})
return
... | javascript | function (key, value, callbackId) {
const sender = this.sender
if (!supportLocalStorage) {
return callNotSupportFail(sender, callbackId)
}
if (!key || (!value && value !== 0)) {
sender.performCallback(callbackId, {
result: 'failed',
data: INVALID_PARAM
})
return
... | [
"function",
"(",
"key",
",",
"value",
",",
"callbackId",
")",
"{",
"const",
"sender",
"=",
"this",
".",
"sender",
"if",
"(",
"!",
"supportLocalStorage",
")",
"{",
"return",
"callNotSupportFail",
"(",
"sender",
",",
"callbackId",
")",
"}",
"if",
"(",
"!",... | When passed a key name and value, will add that key to the storage,
or update that key's value if it already exists.
@param {string} key
@param {string} value not null nor undifined,but 0 works.
@param {function} callbackId | [
"When",
"passed",
"a",
"key",
"name",
"and",
"value",
"will",
"add",
"that",
"key",
"to",
"the",
"storage",
"or",
"update",
"that",
"key",
"s",
"value",
"if",
"it",
"already",
"exists",
"."
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/src/modules/storage.js#L59-L82 | |
18,029 | weexteam/weex-vue-render | src/modules/storage.js | function (key, callbackId) {
const sender = this.sender
if (!supportLocalStorage) {
return callNotSupportFail(sender, callbackId)
}
if (!key) {
sender.performCallback(callbackId, {
result: FAILED,
data: INVALID_PARAM
})
return
}
try {
const val = loc... | javascript | function (key, callbackId) {
const sender = this.sender
if (!supportLocalStorage) {
return callNotSupportFail(sender, callbackId)
}
if (!key) {
sender.performCallback(callbackId, {
result: FAILED,
data: INVALID_PARAM
})
return
}
try {
const val = loc... | [
"function",
"(",
"key",
",",
"callbackId",
")",
"{",
"const",
"sender",
"=",
"this",
".",
"sender",
"if",
"(",
"!",
"supportLocalStorage",
")",
"{",
"return",
"callNotSupportFail",
"(",
"sender",
",",
"callbackId",
")",
"}",
"if",
"(",
"!",
"key",
")",
... | When passed a key name, will return that key's value.
@param {string} key
@param {function} callbackId | [
"When",
"passed",
"a",
"key",
"name",
"will",
"return",
"that",
"key",
"s",
"value",
"."
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/src/modules/storage.js#L89-L112 | |
18,030 | weexteam/weex-vue-render | src/modules/storage.js | function (callbackId) {
const sender = this.sender
if (!supportLocalStorage) {
return callNotSupportFail(sender, callbackId)
}
try {
const len = localStorage.length
sender.performCallback(callbackId, {
result: SUCCESS,
data: len
})
}
catch (e) {
// a... | javascript | function (callbackId) {
const sender = this.sender
if (!supportLocalStorage) {
return callNotSupportFail(sender, callbackId)
}
try {
const len = localStorage.length
sender.performCallback(callbackId, {
result: SUCCESS,
data: len
})
}
catch (e) {
// a... | [
"function",
"(",
"callbackId",
")",
"{",
"const",
"sender",
"=",
"this",
".",
"sender",
"if",
"(",
"!",
"supportLocalStorage",
")",
"{",
"return",
"callNotSupportFail",
"(",
"sender",
",",
"callbackId",
")",
"}",
"try",
"{",
"const",
"len",
"=",
"localStor... | Returns an integer representing the number of data items stored in the Storage object.
@param {function} callbackId | [
"Returns",
"an",
"integer",
"representing",
"the",
"number",
"of",
"data",
"items",
"stored",
"in",
"the",
"Storage",
"object",
"."
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/src/modules/storage.js#L148-L164 | |
18,031 | weexteam/weex-vue-render | src/modules/storage.js | function (callbackId) {
const sender = this.sender
if (!supportLocalStorage) {
return callNotSupportFail(sender, callbackId)
}
try {
const _arr = []
for (let i = 0; i < localStorage.length; i++) {
_arr.push(localStorage.key(i))
}
sender.performCallback(callbackId, {... | javascript | function (callbackId) {
const sender = this.sender
if (!supportLocalStorage) {
return callNotSupportFail(sender, callbackId)
}
try {
const _arr = []
for (let i = 0; i < localStorage.length; i++) {
_arr.push(localStorage.key(i))
}
sender.performCallback(callbackId, {... | [
"function",
"(",
"callbackId",
")",
"{",
"const",
"sender",
"=",
"this",
".",
"sender",
"if",
"(",
"!",
"supportLocalStorage",
")",
"{",
"return",
"callNotSupportFail",
"(",
"sender",
",",
"callbackId",
")",
"}",
"try",
"{",
"const",
"_arr",
"=",
"[",
"]... | Returns an array that contains all keys stored in Storage object.
@param {function} callbackId | [
"Returns",
"an",
"array",
"that",
"contains",
"all",
"keys",
"stored",
"in",
"Storage",
"object",
"."
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/src/modules/storage.js#L170-L189 | |
18,032 | weexteam/weex-vue-render | public/assets/phantom-limb.js | createMouseEvent | function createMouseEvent(eventName, originalEvent, finger) {
var e = document.createEvent('MouseEvent');
e.initMouseEvent(eventName, true, true,
originalEvent.view, originalEvent.detail,
finger.x || originalEvent.screenX, finger.y || originalEvent.screenY,
finger.x || originalEvent.clientX, ... | javascript | function createMouseEvent(eventName, originalEvent, finger) {
var e = document.createEvent('MouseEvent');
e.initMouseEvent(eventName, true, true,
originalEvent.view, originalEvent.detail,
finger.x || originalEvent.screenX, finger.y || originalEvent.screenY,
finger.x || originalEvent.clientX, ... | [
"function",
"createMouseEvent",
"(",
"eventName",
",",
"originalEvent",
",",
"finger",
")",
"{",
"var",
"e",
"=",
"document",
".",
"createEvent",
"(",
"'MouseEvent'",
")",
";",
"e",
".",
"initMouseEvent",
"(",
"eventName",
",",
"true",
",",
"true",
",",
"o... | Create a synthetic event from a real event and a finger. | [
"Create",
"a",
"synthetic",
"event",
"from",
"a",
"real",
"event",
"and",
"a",
"finger",
"."
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/public/assets/phantom-limb.js#L74-L92 |
18,033 | weexteam/weex-vue-render | public/assets/phantom-limb.js | phantomTouchStart | function phantomTouchStart(e) {
if (e.synthetic) return;
mouseIsDown = true;
e.preventDefault();
e.stopPropagation();
fireTouchEvents('touchstart', e);
} | javascript | function phantomTouchStart(e) {
if (e.synthetic) return;
mouseIsDown = true;
e.preventDefault();
e.stopPropagation();
fireTouchEvents('touchstart', e);
} | [
"function",
"phantomTouchStart",
"(",
"e",
")",
"{",
"if",
"(",
"e",
".",
"synthetic",
")",
"return",
";",
"mouseIsDown",
"=",
"true",
";",
"e",
".",
"preventDefault",
"(",
")",
";",
"e",
".",
"stopPropagation",
"(",
")",
";",
"fireTouchEvents",
"(",
"... | Prevent all mousedown event from doing anything. We'll fire one manually at touchend. | [
"Prevent",
"all",
"mousedown",
"event",
"from",
"doing",
"anything",
".",
"We",
"ll",
"fire",
"one",
"manually",
"at",
"touchend",
"."
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/public/assets/phantom-limb.js#L183-L192 |
18,034 | weexteam/weex-vue-render | public/assets/phantom-limb.js | moveFingers | function moveFingers(e) {
// We'll use this if the second is locked with the first.
var changeX = e.clientX - fingers[0].x || 0;
var changeY = e.clientY - fingers[0].y || 0;
// The first finger just follows the mouse.
fingers[0].move(e.clientX, e.clientY);
// TODO: Determine modifier keys inde... | javascript | function moveFingers(e) {
// We'll use this if the second is locked with the first.
var changeX = e.clientX - fingers[0].x || 0;
var changeY = e.clientY - fingers[0].y || 0;
// The first finger just follows the mouse.
fingers[0].move(e.clientX, e.clientY);
// TODO: Determine modifier keys inde... | [
"function",
"moveFingers",
"(",
"e",
")",
"{",
"// We'll use this if the second is locked with the first.",
"var",
"changeX",
"=",
"e",
".",
"clientX",
"-",
"fingers",
"[",
"0",
"]",
".",
"x",
"||",
"0",
";",
"var",
"changeY",
"=",
"e",
".",
"clientY",
"-",
... | Set each finger's position target. Pressing alt engages the second finger. Pressing shift locks the second finger's position relative to the first's. | [
"Set",
"each",
"finger",
"s",
"position",
"target",
".",
"Pressing",
"alt",
"engages",
"the",
"second",
"finger",
".",
"Pressing",
"shift",
"locks",
"the",
"second",
"finger",
"s",
"position",
"relative",
"to",
"the",
"first",
"s",
"."
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/public/assets/phantom-limb.js#L201-L236 |
18,035 | weexteam/weex-vue-render | public/assets/phantom-limb.js | phantomTouchEnd | function phantomTouchEnd(e) {
if (e.synthetic) return;
mouseIsDown = false;
e.preventDefault();
e.stopPropagation();
fireTouchEvents('touchend', e);
fingers.forEach(function(finger) {
if (!finger.target) return;
// Mobile Safari moves all the mouse event to fire after the touche... | javascript | function phantomTouchEnd(e) {
if (e.synthetic) return;
mouseIsDown = false;
e.preventDefault();
e.stopPropagation();
fireTouchEvents('touchend', e);
fingers.forEach(function(finger) {
if (!finger.target) return;
// Mobile Safari moves all the mouse event to fire after the touche... | [
"function",
"phantomTouchEnd",
"(",
"e",
")",
"{",
"if",
"(",
"e",
".",
"synthetic",
")",
"return",
";",
"mouseIsDown",
"=",
"false",
";",
"e",
".",
"preventDefault",
"(",
")",
";",
"e",
".",
"stopPropagation",
"(",
")",
";",
"fireTouchEvents",
"(",
"'... | Prevent all mouseup events from firing. We'll fire one manually at touchend. | [
"Prevent",
"all",
"mouseup",
"events",
"from",
"firing",
".",
"We",
"ll",
"fire",
"one",
"manually",
"at",
"touchend",
"."
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/public/assets/phantom-limb.js#L255-L277 |
18,036 | weexteam/weex-vue-render | public/assets/phantom-limb.js | phantomKeyUp | function phantomKeyUp(e) {
if (e.keyCode === 27) {
if (document.documentElement.classList.contains('_phantom-limb')) {
stop();
} else {
start();
}
}
} | javascript | function phantomKeyUp(e) {
if (e.keyCode === 27) {
if (document.documentElement.classList.contains('_phantom-limb')) {
stop();
} else {
start();
}
}
} | [
"function",
"phantomKeyUp",
"(",
"e",
")",
"{",
"if",
"(",
"e",
".",
"keyCode",
"===",
"27",
")",
"{",
"if",
"(",
"document",
".",
"documentElement",
".",
"classList",
".",
"contains",
"(",
"'_phantom-limb'",
")",
")",
"{",
"stop",
"(",
")",
";",
"}"... | Detect keyup, exit when esc. | [
"Detect",
"keyup",
"exit",
"when",
"esc",
"."
] | 8464b64d54538f7b274c488e5fdc83a64e9dc74c | https://github.com/weexteam/weex-vue-render/blob/8464b64d54538f7b274c488e5fdc83a64e9dc74c/public/assets/phantom-limb.js#L340-L348 |
18,037 | Netflix/ember-nf-graph | addon/utils/nf/svg-dom.js | inlineAllStyles | function inlineAllStyles(element) {
let styles = getComputedStyle(element);
for(let key in styles) {
if(styles.hasOwnProperty(key)) {
element.style[key] = styles[key];
}
}
for(let i = 0; i < element.childNodes.length; i++) {
let node = element.childNodes[i];
if(node.nodeType === 1) {
... | javascript | function inlineAllStyles(element) {
let styles = getComputedStyle(element);
for(let key in styles) {
if(styles.hasOwnProperty(key)) {
element.style[key] = styles[key];
}
}
for(let i = 0; i < element.childNodes.length; i++) {
let node = element.childNodes[i];
if(node.nodeType === 1) {
... | [
"function",
"inlineAllStyles",
"(",
"element",
")",
"{",
"let",
"styles",
"=",
"getComputedStyle",
"(",
"element",
")",
";",
"for",
"(",
"let",
"key",
"in",
"styles",
")",
"{",
"if",
"(",
"styles",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"ele... | Traverses an element and all of its descendants, setting their
inline style property to whatever the computed style is.
@method inlineAllStyles
@param element {Element} the dom element to traverse.
@private | [
"Traverses",
"an",
"element",
"and",
"all",
"of",
"its",
"descendants",
"setting",
"their",
"inline",
"style",
"property",
"to",
"whatever",
"the",
"computed",
"style",
"is",
"."
] | 851b63edc9690501d01b8fb87c3346bc5dac9959 | https://github.com/Netflix/ember-nf-graph/blob/851b63edc9690501d01b8fb87c3346bc5dac9959/addon/utils/nf/svg-dom.js#L11-L25 |
18,038 | molnarg/node-http2 | lib/protocol/compressor.js | cut | function cut(buffer, size) {
var chunks = [];
var cursor = 0;
do {
var chunkSize = Math.min(size, buffer.length - cursor);
chunks.push(buffer.slice(cursor, cursor + chunkSize));
cursor += chunkSize;
} while(cursor < buffer.length);
return chunks;
} | javascript | function cut(buffer, size) {
var chunks = [];
var cursor = 0;
do {
var chunkSize = Math.min(size, buffer.length - cursor);
chunks.push(buffer.slice(cursor, cursor + chunkSize));
cursor += chunkSize;
} while(cursor < buffer.length);
return chunks;
} | [
"function",
"cut",
"(",
"buffer",
",",
"size",
")",
"{",
"var",
"chunks",
"=",
"[",
"]",
";",
"var",
"cursor",
"=",
"0",
";",
"do",
"{",
"var",
"chunkSize",
"=",
"Math",
".",
"min",
"(",
"size",
",",
"buffer",
".",
"length",
"-",
"cursor",
")",
... | Cut `buffer` into chunks not larger than `size` | [
"Cut",
"buffer",
"into",
"chunks",
"not",
"larger",
"than",
"size"
] | c0fde1842f12604228c2b40895521397b015ae71 | https://github.com/molnarg/node-http2/blob/c0fde1842f12604228c2b40895521397b015ae71/lib/protocol/compressor.js#L1353-L1362 |
18,039 | molnarg/node-http2 | example/server.js | onRequest | function onRequest(request, response) {
var filename = path.join(__dirname, request.url);
// Serving server.js from cache. Useful for microbenchmarks.
if (request.url === cachedUrl) {
if (response.push) {
// Also push down the client js, since it's possible if the requester wants
// one, they wan... | javascript | function onRequest(request, response) {
var filename = path.join(__dirname, request.url);
// Serving server.js from cache. Useful for microbenchmarks.
if (request.url === cachedUrl) {
if (response.push) {
// Also push down the client js, since it's possible if the requester wants
// one, they wan... | [
"function",
"onRequest",
"(",
"request",
",",
"response",
")",
"{",
"var",
"filename",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"request",
".",
"url",
")",
";",
"// Serving server.js from cache. Useful for microbenchmarks.",
"if",
"(",
"request",
".",
"u... | The callback to handle requests | [
"The",
"callback",
"to",
"handle",
"requests"
] | c0fde1842f12604228c2b40895521397b015ae71 | https://github.com/molnarg/node-http2/blob/c0fde1842f12604228c2b40895521397b015ae71/example/server.js#L10-L49 |
18,040 | expressjs/serve-favicon | index.js | favicon | function favicon (path, options) {
var opts = options || {}
var icon // favicon cache
var maxAge = calcMaxAge(opts.maxAge)
if (!path) {
throw new TypeError('path to favicon.ico is required')
}
if (Buffer.isBuffer(path)) {
icon = createIcon(Buffer.from(path), maxAge)
} else if (typeof path === '... | javascript | function favicon (path, options) {
var opts = options || {}
var icon // favicon cache
var maxAge = calcMaxAge(opts.maxAge)
if (!path) {
throw new TypeError('path to favicon.ico is required')
}
if (Buffer.isBuffer(path)) {
icon = createIcon(Buffer.from(path), maxAge)
} else if (typeof path === '... | [
"function",
"favicon",
"(",
"path",
",",
"options",
")",
"{",
"var",
"opts",
"=",
"options",
"||",
"{",
"}",
"var",
"icon",
"// favicon cache",
"var",
"maxAge",
"=",
"calcMaxAge",
"(",
"opts",
".",
"maxAge",
")",
"if",
"(",
"!",
"path",
")",
"{",
"th... | Serves the favicon located by the given `path`.
@public
@param {String|Buffer} path
@param {Object} [options]
@return {Function} middleware | [
"Serves",
"the",
"favicon",
"located",
"by",
"the",
"given",
"path",
"."
] | 15fe5e3837cef1e88cb4d1112bc2a23674b4834b | https://github.com/expressjs/serve-favicon/blob/15fe5e3837cef1e88cb4d1112bc2a23674b4834b/index.js#L48-L91 |
18,041 | expressjs/serve-favicon | index.js | calcMaxAge | function calcMaxAge (val) {
var num = typeof val === 'string'
? ms(val)
: val
return num != null
? Math.min(Math.max(0, num), ONE_YEAR_MS)
: ONE_YEAR_MS
} | javascript | function calcMaxAge (val) {
var num = typeof val === 'string'
? ms(val)
: val
return num != null
? Math.min(Math.max(0, num), ONE_YEAR_MS)
: ONE_YEAR_MS
} | [
"function",
"calcMaxAge",
"(",
"val",
")",
"{",
"var",
"num",
"=",
"typeof",
"val",
"===",
"'string'",
"?",
"ms",
"(",
"val",
")",
":",
"val",
"return",
"num",
"!=",
"null",
"?",
"Math",
".",
"min",
"(",
"Math",
".",
"max",
"(",
"0",
",",
"num",
... | Calculate the max-age from a configured value.
@private
@param {string|number} val
@return {number} | [
"Calculate",
"the",
"max",
"-",
"age",
"from",
"a",
"configured",
"value",
"."
] | 15fe5e3837cef1e88cb4d1112bc2a23674b4834b | https://github.com/expressjs/serve-favicon/blob/15fe5e3837cef1e88cb4d1112bc2a23674b4834b/index.js#L101-L109 |
18,042 | expressjs/serve-favicon | index.js | createIcon | function createIcon (buf, maxAge) {
return {
body: buf,
headers: {
'Cache-Control': 'public, max-age=' + Math.floor(maxAge / 1000),
'ETag': etag(buf)
}
}
} | javascript | function createIcon (buf, maxAge) {
return {
body: buf,
headers: {
'Cache-Control': 'public, max-age=' + Math.floor(maxAge / 1000),
'ETag': etag(buf)
}
}
} | [
"function",
"createIcon",
"(",
"buf",
",",
"maxAge",
")",
"{",
"return",
"{",
"body",
":",
"buf",
",",
"headers",
":",
"{",
"'Cache-Control'",
":",
"'public, max-age='",
"+",
"Math",
".",
"floor",
"(",
"maxAge",
"/",
"1000",
")",
",",
"'ETag'",
":",
"e... | Create icon data from Buffer and max-age.
@private
@param {Buffer} buf
@param {number} maxAge
@return {object} | [
"Create",
"icon",
"data",
"from",
"Buffer",
"and",
"max",
"-",
"age",
"."
] | 15fe5e3837cef1e88cb4d1112bc2a23674b4834b | https://github.com/expressjs/serve-favicon/blob/15fe5e3837cef1e88cb4d1112bc2a23674b4834b/index.js#L120-L128 |
18,043 | expressjs/serve-favicon | index.js | createIsDirError | function createIsDirError (path) {
var error = new Error('EISDIR, illegal operation on directory \'' + path + '\'')
error.code = 'EISDIR'
error.errno = 28
error.path = path
error.syscall = 'open'
return error
} | javascript | function createIsDirError (path) {
var error = new Error('EISDIR, illegal operation on directory \'' + path + '\'')
error.code = 'EISDIR'
error.errno = 28
error.path = path
error.syscall = 'open'
return error
} | [
"function",
"createIsDirError",
"(",
"path",
")",
"{",
"var",
"error",
"=",
"new",
"Error",
"(",
"'EISDIR, illegal operation on directory \\''",
"+",
"path",
"+",
"'\\''",
")",
"error",
".",
"code",
"=",
"'EISDIR'",
"error",
".",
"errno",
"=",
"28",
"error",
... | Create EISDIR error.
@private
@param {string} path
@return {Error} | [
"Create",
"EISDIR",
"error",
"."
] | 15fe5e3837cef1e88cb4d1112bc2a23674b4834b | https://github.com/expressjs/serve-favicon/blob/15fe5e3837cef1e88cb4d1112bc2a23674b4834b/index.js#L138-L145 |
18,044 | expressjs/serve-favicon | index.js | isFresh | function isFresh (req, res) {
return fresh(req.headers, {
'etag': res.getHeader('ETag'),
'last-modified': res.getHeader('Last-Modified')
})
} | javascript | function isFresh (req, res) {
return fresh(req.headers, {
'etag': res.getHeader('ETag'),
'last-modified': res.getHeader('Last-Modified')
})
} | [
"function",
"isFresh",
"(",
"req",
",",
"res",
")",
"{",
"return",
"fresh",
"(",
"req",
".",
"headers",
",",
"{",
"'etag'",
":",
"res",
".",
"getHeader",
"(",
"'ETag'",
")",
",",
"'last-modified'",
":",
"res",
".",
"getHeader",
"(",
"'Last-Modified'",
... | Determine if the cached representation is fresh.
@param {object} req
@param {object} res
@return {boolean}
@private | [
"Determine",
"if",
"the",
"cached",
"representation",
"is",
"fresh",
"."
] | 15fe5e3837cef1e88cb4d1112bc2a23674b4834b | https://github.com/expressjs/serve-favicon/blob/15fe5e3837cef1e88cb4d1112bc2a23674b4834b/index.js#L171-L176 |
18,045 | expressjs/serve-favicon | index.js | resolveSync | function resolveSync (iconPath) {
var path = resolve(iconPath)
var stat = fs.statSync(path)
if (stat.isDirectory()) {
throw createIsDirError(path)
}
return path
} | javascript | function resolveSync (iconPath) {
var path = resolve(iconPath)
var stat = fs.statSync(path)
if (stat.isDirectory()) {
throw createIsDirError(path)
}
return path
} | [
"function",
"resolveSync",
"(",
"iconPath",
")",
"{",
"var",
"path",
"=",
"resolve",
"(",
"iconPath",
")",
"var",
"stat",
"=",
"fs",
".",
"statSync",
"(",
"path",
")",
"if",
"(",
"stat",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"createIsDirErro... | Resolve the path to icon.
@param {string} iconPath
@private | [
"Resolve",
"the",
"path",
"to",
"icon",
"."
] | 15fe5e3837cef1e88cb4d1112bc2a23674b4834b | https://github.com/expressjs/serve-favicon/blob/15fe5e3837cef1e88cb4d1112bc2a23674b4834b/index.js#L185-L194 |
18,046 | auth0/node-wsfed | lib/metadata.js | metadataMiddleware | function metadataMiddleware (options) {
//claimTypes, issuer, pem, endpointPath
options = options || {};
if(!options.issuer) {
throw new Error('options.issuer is required');
}
if(!options.cert) {
throw new Error('options.cert is required');
}
var claimTypes = (options.profileMapper || PassportP... | javascript | function metadataMiddleware (options) {
//claimTypes, issuer, pem, endpointPath
options = options || {};
if(!options.issuer) {
throw new Error('options.issuer is required');
}
if(!options.cert) {
throw new Error('options.cert is required');
}
var claimTypes = (options.profileMapper || PassportP... | [
"function",
"metadataMiddleware",
"(",
"options",
")",
"{",
"//claimTypes, issuer, pem, endpointPath",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"options",
".",
"issuer",
")",
"{",
"throw",
"new",
"Error",
"(",
"'options.issuer is required'",... | WSFederation metadata endpoint
This endpoint returns a wsfederation metadata document.
You should expose this endpoint in an address like:
'https://your-wsfederation-server.com/FederationMetadata/2007-06/FederationMetadata.xml
options:
- issuer string
- cert the public certificate
- profileMapper a function that gi... | [
"WSFederation",
"metadata",
"endpoint"
] | 31fae4e6df6e13d31b2c86f754ececf7c7089bd3 | https://github.com/auth0/node-wsfed/blob/31fae4e6df6e13d31b2c86f754ececf7c7089bd3/lib/metadata.js#L33-L63 |
18,047 | fingerpich/jalali-moment | jalali-moment.js | leftZeroFill | function leftZeroFill(number, targetLength) {
var output = number + "";
while (output.length < targetLength){
output = "0" + output;
}
return output;
} | javascript | function leftZeroFill(number, targetLength) {
var output = number + "";
while (output.length < targetLength){
output = "0" + output;
}
return output;
} | [
"function",
"leftZeroFill",
"(",
"number",
",",
"targetLength",
")",
"{",
"var",
"output",
"=",
"number",
"+",
"\"\"",
";",
"while",
"(",
"output",
".",
"length",
"<",
"targetLength",
")",
"{",
"output",
"=",
"\"0\"",
"+",
"output",
";",
"}",
"return",
... | return a string which length is as much as you need
@param {number} number input
@param {number} targetLength expected length
@example leftZeroFill(5,2) => 05 | [
"return",
"a",
"string",
"which",
"length",
"is",
"as",
"much",
"as",
"you",
"need"
] | 2f0442745b0b7b79b6ca1153b73f35de4e0b93d5 | https://github.com/fingerpich/jalali-moment/blob/2f0442745b0b7b79b6ca1153b73f35de4e0b93d5/jalali-moment.js#L117-L123 |
18,048 | fingerpich/jalali-moment | jalali-moment.js | toJalaliFormat | function toJalaliFormat(format) {
for (var i = 0; i < format.length; i++) {
if(!i || (format[i-1] !== "j" && format[i-1] !== format[i])) {
if (format[i] === "Y" || format[i] === "M" || format[i] === "D" || format[i] === "g") {
format = format.slice(0, i) + "j" + format.slice(i);
... | javascript | function toJalaliFormat(format) {
for (var i = 0; i < format.length; i++) {
if(!i || (format[i-1] !== "j" && format[i-1] !== format[i])) {
if (format[i] === "Y" || format[i] === "M" || format[i] === "D" || format[i] === "g") {
format = format.slice(0, i) + "j" + format.slice(i);
... | [
"function",
"toJalaliFormat",
"(",
"format",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"format",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"i",
"||",
"(",
"format",
"[",
"i",
"-",
"1",
"]",
"!==",
"\"j\"",
"&&"... | Changes any moment Gregorian format to Jalali system format
@param {string} format
@example toJalaliFormat("YYYY/MMM/DD") => "jYYYY/jMMM/jDD" | [
"Changes",
"any",
"moment",
"Gregorian",
"format",
"to",
"Jalali",
"system",
"format"
] | 2f0442745b0b7b79b6ca1153b73f35de4e0b93d5 | https://github.com/fingerpich/jalali-moment/blob/2f0442745b0b7b79b6ca1153b73f35de4e0b93d5/jalali-moment.js#L138-L147 |
18,049 | fingerpich/jalali-moment | jalali-moment.js | normalizeUnits | function normalizeUnits(units, momentObj) {
if (isJalali(momentObj)) {
units = toJalaliUnit(units);
}
if (units) {
var lowered = units.toLowerCase();
units = unitAliases[lowered] || lowered;
}
// TODO : add unit test
if (units === "jday") units = "day";
else if (units... | javascript | function normalizeUnits(units, momentObj) {
if (isJalali(momentObj)) {
units = toJalaliUnit(units);
}
if (units) {
var lowered = units.toLowerCase();
units = unitAliases[lowered] || lowered;
}
// TODO : add unit test
if (units === "jday") units = "day";
else if (units... | [
"function",
"normalizeUnits",
"(",
"units",
",",
"momentObj",
")",
"{",
"if",
"(",
"isJalali",
"(",
"momentObj",
")",
")",
"{",
"units",
"=",
"toJalaliUnit",
"(",
"units",
")",
";",
"}",
"if",
"(",
"units",
")",
"{",
"var",
"lowered",
"=",
"units",
"... | normalize units to be comparable
@param {string} units | [
"normalize",
"units",
"to",
"be",
"comparable"
] | 2f0442745b0b7b79b6ca1153b73f35de4e0b93d5 | https://github.com/fingerpich/jalali-moment/blob/2f0442745b0b7b79b6ca1153b73f35de4e0b93d5/jalali-moment.js#L170-L182 |
18,050 | fingerpich/jalali-moment | jalali-moment.js | setDate | function setDate(momentInstance, year, month, day) {
var d = momentInstance._d;
if (momentInstance._isUTC) {
/*eslint-disable new-cap*/
momentInstance._d = new Date(Date.UTC(year, month, day,
d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds()));
/*e... | javascript | function setDate(momentInstance, year, month, day) {
var d = momentInstance._d;
if (momentInstance._isUTC) {
/*eslint-disable new-cap*/
momentInstance._d = new Date(Date.UTC(year, month, day,
d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds()));
/*e... | [
"function",
"setDate",
"(",
"momentInstance",
",",
"year",
",",
"month",
",",
"day",
")",
"{",
"var",
"d",
"=",
"momentInstance",
".",
"_d",
";",
"if",
"(",
"momentInstance",
".",
"_isUTC",
")",
"{",
"/*eslint-disable new-cap*/",
"momentInstance",
".",
"_d",... | set a gregorian date to moment object
@param {string} momentInstance
@param {string} year in gregorian system
@param {string} month in gregorian system
@param {string} day in gregorian system | [
"set",
"a",
"gregorian",
"date",
"to",
"moment",
"object"
] | 2f0442745b0b7b79b6ca1153b73f35de4e0b93d5 | https://github.com/fingerpich/jalali-moment/blob/2f0442745b0b7b79b6ca1153b73f35de4e0b93d5/jalali-moment.js#L191-L202 |
18,051 | jgranstrom/sass-extract | src/importer.js | findImportedPath | function findImportedPath(url, prev, includedFilesMap, includedPaths) {
let candidateFromPaths;
if(prev !== 'stdin') {
const prevPath = path.posix.dirname(prev);
candidateFromPaths = [prevPath, ...includedPaths];
} else {
candidateFromPaths = [...includedPaths];
}
for(let i = 0; i < candidateFro... | javascript | function findImportedPath(url, prev, includedFilesMap, includedPaths) {
let candidateFromPaths;
if(prev !== 'stdin') {
const prevPath = path.posix.dirname(prev);
candidateFromPaths = [prevPath, ...includedPaths];
} else {
candidateFromPaths = [...includedPaths];
}
for(let i = 0; i < candidateFro... | [
"function",
"findImportedPath",
"(",
"url",
",",
"prev",
",",
"includedFilesMap",
",",
"includedPaths",
")",
"{",
"let",
"candidateFromPaths",
";",
"if",
"(",
"prev",
"!==",
"'stdin'",
")",
"{",
"const",
"prevPath",
"=",
"path",
".",
"posix",
".",
"dirname",... | Search for the imported file in order of included paths | [
"Search",
"for",
"the",
"imported",
"file",
"in",
"order",
"of",
"included",
"paths"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/importer.js#L8-L48 |
18,052 | jgranstrom/sass-extract | src/importer.js | getImportAbsolutePath | function getImportAbsolutePath(url, prev, includedFilesMap, includedPaths = []) {
// Ensure that both @import 'file' and @import 'file.scss' is mapped correctly
let extension = path.posix.extname(prev);
if(path.posix.extname(url) !== extension) {
url += extension;
}
const absolutePath = findImportedPath(... | javascript | function getImportAbsolutePath(url, prev, includedFilesMap, includedPaths = []) {
// Ensure that both @import 'file' and @import 'file.scss' is mapped correctly
let extension = path.posix.extname(prev);
if(path.posix.extname(url) !== extension) {
url += extension;
}
const absolutePath = findImportedPath(... | [
"function",
"getImportAbsolutePath",
"(",
"url",
",",
"prev",
",",
"includedFilesMap",
",",
"includedPaths",
"=",
"[",
"]",
")",
"{",
"// Ensure that both @import 'file' and @import 'file.scss' is mapped correctly",
"let",
"extension",
"=",
"path",
".",
"posix",
".",
"e... | Get the absolute file path for a relative @import like './sub/file.scsss'
If the @import is made from a raw data section a best guess path is returned | [
"Get",
"the",
"absolute",
"file",
"path",
"for",
"a",
"relative"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/importer.js#L54-L68 |
18,053 | jgranstrom/sass-extract | src/importer.js | getImportResult | function getImportResult(extractions, url, prev, includedFilesMap, includedPaths) {
const absolutePath = getImportAbsolutePath(url, prev, includedFilesMap, includedPaths);
const contents = extractions[absolutePath].injectedData;
return { file: absolutePath, contents };
} | javascript | function getImportResult(extractions, url, prev, includedFilesMap, includedPaths) {
const absolutePath = getImportAbsolutePath(url, prev, includedFilesMap, includedPaths);
const contents = extractions[absolutePath].injectedData;
return { file: absolutePath, contents };
} | [
"function",
"getImportResult",
"(",
"extractions",
",",
"url",
",",
"prev",
",",
"includedFilesMap",
",",
"includedPaths",
")",
"{",
"const",
"absolutePath",
"=",
"getImportAbsolutePath",
"(",
"url",
",",
"prev",
",",
"includedFilesMap",
",",
"includedPaths",
")",... | Get the resulting source and path for a given @import request | [
"Get",
"the",
"resulting",
"source",
"and",
"path",
"for",
"a",
"given"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/importer.js#L73-L78 |
18,054 | jgranstrom/sass-extract | src/parse.js | getDeclarationDeps | function getDeclarationDeps($ast, declaration, scope) {
if(scope !== SCOPE_EXPLICIT) {
return {};
}
const depParentNodes = $ast(declaration).parents(node => {
if(node.node.type === 'mixin') {
return true;
} else if(node.node.type === 'atrule') {
const atruleIdentNode = $ast(node).children... | javascript | function getDeclarationDeps($ast, declaration, scope) {
if(scope !== SCOPE_EXPLICIT) {
return {};
}
const depParentNodes = $ast(declaration).parents(node => {
if(node.node.type === 'mixin') {
return true;
} else if(node.node.type === 'atrule') {
const atruleIdentNode = $ast(node).children... | [
"function",
"getDeclarationDeps",
"(",
"$ast",
",",
"declaration",
",",
"scope",
")",
"{",
"if",
"(",
"scope",
"!==",
"SCOPE_EXPLICIT",
")",
"{",
"return",
"{",
"}",
";",
"}",
"const",
"depParentNodes",
"=",
"$ast",
"(",
"declaration",
")",
".",
"parents",... | Get dependencies required to extract variables such as mixins or function invocations | [
"Get",
"dependencies",
"required",
"to",
"extract",
"variables",
"such",
"as",
"mixins",
"or",
"function",
"invocations"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/parse.js#L54-L116 |
18,055 | jgranstrom/sass-extract | src/parse.js | parseDeclaration | function parseDeclaration($ast, declaration, scope) {
const variable = {};
const propertyNode = $ast(declaration)
.children('property');
variable.declarationClean = propertyNode.value();
variable.position = propertyNode.get(0).start;
variable.declaration = `$${variable.declarationClean}`;
variable.exp... | javascript | function parseDeclaration($ast, declaration, scope) {
const variable = {};
const propertyNode = $ast(declaration)
.children('property');
variable.declarationClean = propertyNode.value();
variable.position = propertyNode.get(0).start;
variable.declaration = `$${variable.declarationClean}`;
variable.exp... | [
"function",
"parseDeclaration",
"(",
"$ast",
",",
"declaration",
",",
"scope",
")",
"{",
"const",
"variable",
"=",
"{",
"}",
";",
"const",
"propertyNode",
"=",
"$ast",
"(",
"declaration",
")",
".",
"children",
"(",
"'property'",
")",
";",
"variable",
".",
... | Parse declaration node into declaration object | [
"Parse",
"declaration",
"node",
"into",
"declaration",
"object"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/parse.js#L121-L141 |
18,056 | jgranstrom/sass-extract | src/process.js | processFile | function processFile(idx, count, filename, data, parsedDeclarations, pluggable) {
const declarations = parsedDeclarations.files[filename];
// Inject dependent declaration extraction to last file
const dependentDeclarations = idx === count - 1 ? parsedDeclarations.dependentDeclarations : [];
const variables = { ... | javascript | function processFile(idx, count, filename, data, parsedDeclarations, pluggable) {
const declarations = parsedDeclarations.files[filename];
// Inject dependent declaration extraction to last file
const dependentDeclarations = idx === count - 1 ? parsedDeclarations.dependentDeclarations : [];
const variables = { ... | [
"function",
"processFile",
"(",
"idx",
",",
"count",
",",
"filename",
",",
"data",
",",
"parsedDeclarations",
",",
"pluggable",
")",
"{",
"const",
"declarations",
"=",
"parsedDeclarations",
".",
"files",
"[",
"filename",
"]",
";",
"// Inject dependent declaration ... | Process a single sass files to get declarations, injected source and functions | [
"Process",
"a",
"single",
"sass",
"files",
"to",
"get",
"declarations",
"injected",
"source",
"and",
"functions"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/process.js#L32-L58 |
18,057 | jgranstrom/sass-extract | src/extract.js | getRenderedStats | function getRenderedStats(rendered, compileOptions) {
return {
entryFilename: normalizePath(rendered.stats.entry),
includedFiles: rendered.stats.includedFiles.map(f => normalizePath(makeAbsolute(f))),
includedPaths: (compileOptions.includePaths || []).map(normalizePath),
};
} | javascript | function getRenderedStats(rendered, compileOptions) {
return {
entryFilename: normalizePath(rendered.stats.entry),
includedFiles: rendered.stats.includedFiles.map(f => normalizePath(makeAbsolute(f))),
includedPaths: (compileOptions.includePaths || []).map(normalizePath),
};
} | [
"function",
"getRenderedStats",
"(",
"rendered",
",",
"compileOptions",
")",
"{",
"return",
"{",
"entryFilename",
":",
"normalizePath",
"(",
"rendered",
".",
"stats",
".",
"entry",
")",
",",
"includedFiles",
":",
"rendered",
".",
"stats",
".",
"includedFiles",
... | Get rendered stats required for extraction | [
"Get",
"rendered",
"stats",
"required",
"for",
"extraction"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/extract.js#L14-L20 |
18,058 | jgranstrom/sass-extract | src/extract.js | makeExtractionCompileOptions | function makeExtractionCompileOptions(compileOptions, entryFilename, extractions, importer) {
const extractionCompileOptions = Object.assign({}, compileOptions);
const extractionFunctions = {};
// Copy all extraction function for each file into one object for compilation
Object.keys(extractions).forEach(extrac... | javascript | function makeExtractionCompileOptions(compileOptions, entryFilename, extractions, importer) {
const extractionCompileOptions = Object.assign({}, compileOptions);
const extractionFunctions = {};
// Copy all extraction function for each file into one object for compilation
Object.keys(extractions).forEach(extrac... | [
"function",
"makeExtractionCompileOptions",
"(",
"compileOptions",
",",
"entryFilename",
",",
"extractions",
",",
"importer",
")",
"{",
"const",
"extractionCompileOptions",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"compileOptions",
")",
";",
"const",
"ext... | Make the compilation option for the extraction rendering
Set the data to be rendered to the injected source
Add compilation functions and custom importer for injected sources | [
"Make",
"the",
"compilation",
"option",
"for",
"the",
"extraction",
"rendering",
"Set",
"the",
"data",
"to",
"be",
"rendered",
"to",
"the",
"injected",
"source",
"Add",
"compilation",
"functions",
"and",
"custom",
"importer",
"for",
"injected",
"sources"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/extract.js#L27-L43 |
18,059 | jgranstrom/sass-extract | src/extract.js | compileExtractionResult | function compileExtractionResult(orderedFiles, extractions) {
const extractedVariables = { global: {} };
orderedFiles.map(filename => {
const globalFileVariables = extractions[filename].variables.global;
Object.keys(globalFileVariables).map(variableKey => {
globalFileVariables[variableKey].forEach(e... | javascript | function compileExtractionResult(orderedFiles, extractions) {
const extractedVariables = { global: {} };
orderedFiles.map(filename => {
const globalFileVariables = extractions[filename].variables.global;
Object.keys(globalFileVariables).map(variableKey => {
globalFileVariables[variableKey].forEach(e... | [
"function",
"compileExtractionResult",
"(",
"orderedFiles",
",",
"extractions",
")",
"{",
"const",
"extractedVariables",
"=",
"{",
"global",
":",
"{",
"}",
"}",
";",
"orderedFiles",
".",
"map",
"(",
"filename",
"=>",
"{",
"const",
"globalFileVariables",
"=",
"... | Compile extracted variables per file into a complete result object | [
"Compile",
"extracted",
"variables",
"per",
"file",
"into",
"a",
"complete",
"result",
"object"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/extract.js#L48-L83 |
18,060 | jgranstrom/sass-extract | src/plugins/compact.js | isColor | function isColor(value) {
return value.r != null
&& value.g != null
&& value.b != null
&& value.a != null
&& value.hex != null;
} | javascript | function isColor(value) {
return value.r != null
&& value.g != null
&& value.b != null
&& value.a != null
&& value.hex != null;
} | [
"function",
"isColor",
"(",
"value",
")",
"{",
"return",
"value",
".",
"r",
"!=",
"null",
"&&",
"value",
".",
"g",
"!=",
"null",
"&&",
"value",
".",
"b",
"!=",
"null",
"&&",
"value",
".",
"a",
"!=",
"null",
"&&",
"value",
".",
"hex",
"!=",
"null"... | Use duck typing to distinguish between map and color objects | [
"Use",
"duck",
"typing",
"to",
"distinguish",
"between",
"map",
"and",
"color",
"objects"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/plugins/compact.js#L8-L14 |
18,061 | jgranstrom/sass-extract | src/serialize.js | serializeValue | function serializeValue(sassValue, isInList) {
switch(sassValue.constructor) {
case sass.types.String:
case sass.types.Boolean:
return `${sassValue.getValue()}`;
case sass.types.Number:
return `${sassValue.getValue()}${sassValue.getUnit()}`;
case sass.types.Color:
return serializeC... | javascript | function serializeValue(sassValue, isInList) {
switch(sassValue.constructor) {
case sass.types.String:
case sass.types.Boolean:
return `${sassValue.getValue()}`;
case sass.types.Number:
return `${sassValue.getValue()}${sassValue.getUnit()}`;
case sass.types.Color:
return serializeC... | [
"function",
"serializeValue",
"(",
"sassValue",
",",
"isInList",
")",
"{",
"switch",
"(",
"sassValue",
".",
"constructor",
")",
"{",
"case",
"sass",
".",
"types",
".",
"String",
":",
"case",
"sass",
".",
"types",
".",
"Boolean",
":",
"return",
"`",
"${",... | Transform a SassValue into a serialized string | [
"Transform",
"a",
"SassValue",
"into",
"a",
"serialized",
"string"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/serialize.js#L31-L74 |
18,062 | jgranstrom/sass-extract | src/inject.js | createInjection | function createInjection(fileId, categoryPrefix, declaration, idx, declarationResultHandler) {
const fnName = `${FN_PREFIX}_${fileId}_${categoryPrefix}_${declaration.declarationClean}_${idx}`;
const injectedFunction = function(sassValue) {
const value = createStructuredValue(sassValue);
declarationResultHa... | javascript | function createInjection(fileId, categoryPrefix, declaration, idx, declarationResultHandler) {
const fnName = `${FN_PREFIX}_${fileId}_${categoryPrefix}_${declaration.declarationClean}_${idx}`;
const injectedFunction = function(sassValue) {
const value = createStructuredValue(sassValue);
declarationResultHa... | [
"function",
"createInjection",
"(",
"fileId",
",",
"categoryPrefix",
",",
"declaration",
",",
"idx",
",",
"declarationResultHandler",
")",
"{",
"const",
"fnName",
"=",
"`",
"${",
"FN_PREFIX",
"}",
"${",
"fileId",
"}",
"${",
"categoryPrefix",
"}",
"${",
"declar... | Create injection function and source for a file, category, declaration and result handler | [
"Create",
"injection",
"function",
"and",
"source",
"for",
"a",
"file",
"category",
"declaration",
"and",
"result",
"handler"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/inject.js#L12-L26 |
18,063 | jgranstrom/sass-extract | src/load.js | includeRawDataFile | function includeRawDataFile(includedFiles, files, entryFilename, data) {
let orderedFiles = includedFiles;
if(entryFilename === RAW_DATA_FILE && data) {
files[RAW_DATA_FILE] = data;
orderedFiles = [...orderedFiles, RAW_DATA_FILE];
} else if(orderedFiles.length > 0) {
orderedFiles = [...orderedFiles.s... | javascript | function includeRawDataFile(includedFiles, files, entryFilename, data) {
let orderedFiles = includedFiles;
if(entryFilename === RAW_DATA_FILE && data) {
files[RAW_DATA_FILE] = data;
orderedFiles = [...orderedFiles, RAW_DATA_FILE];
} else if(orderedFiles.length > 0) {
orderedFiles = [...orderedFiles.s... | [
"function",
"includeRawDataFile",
"(",
"includedFiles",
",",
"files",
",",
"entryFilename",
",",
"data",
")",
"{",
"let",
"orderedFiles",
"=",
"includedFiles",
";",
"if",
"(",
"entryFilename",
"===",
"RAW_DATA_FILE",
"&&",
"data",
")",
"{",
"files",
"[",
"RAW_... | Include any raw compilation data as a 'data' file | [
"Include",
"any",
"raw",
"compilation",
"data",
"as",
"a",
"data",
"file"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/load.js#L11-L25 |
18,064 | jgranstrom/sass-extract | src/struct.js | makeValue | function makeValue(sassValue) {
switch(sassValue.constructor) {
case sass.types.String:
case sass.types.Boolean:
return { value: sassValue.getValue() };
case sass.types.Number:
return { value: sassValue.getValue(), unit: sassValue.getUnit() };
case sass.types.Color:
const r = Math.... | javascript | function makeValue(sassValue) {
switch(sassValue.constructor) {
case sass.types.String:
case sass.types.Boolean:
return { value: sassValue.getValue() };
case sass.types.Number:
return { value: sassValue.getValue(), unit: sassValue.getUnit() };
case sass.types.Color:
const r = Math.... | [
"function",
"makeValue",
"(",
"sassValue",
")",
"{",
"switch",
"(",
"sassValue",
".",
"constructor",
")",
"{",
"case",
"sass",
".",
"types",
".",
"String",
":",
"case",
"sass",
".",
"types",
".",
"Boolean",
":",
"return",
"{",
"value",
":",
"sassValue",
... | Transform a sassValue into a structured value based on the value type | [
"Transform",
"a",
"sassValue",
"into",
"a",
"structured",
"value",
"based",
"on",
"the",
"value",
"type"
] | a2b0b3d513bf88c3adb9b6b444ff81c18738b0be | https://github.com/jgranstrom/sass-extract/blob/a2b0b3d513bf88c3adb9b6b444ff81c18738b0be/src/struct.js#L8-L54 |
18,065 | adobe-photoshop/generator-assets | lib/assetmanager.js | AssetManager | function AssetManager(generator, config, logger, document, renderManager) {
events.EventEmitter.call(this);
this._generator = generator;
this._config = config;
this._logger = logger;
this._document = document;
this._metaDataRoot = config["meta-data-root"] || META_PLUGIN_... | javascript | function AssetManager(generator, config, logger, document, renderManager) {
events.EventEmitter.call(this);
this._generator = generator;
this._config = config;
this._logger = logger;
this._document = document;
this._metaDataRoot = config["meta-data-root"] || META_PLUGIN_... | [
"function",
"AssetManager",
"(",
"generator",
",",
"config",
",",
"logger",
",",
"document",
",",
"renderManager",
")",
"{",
"events",
".",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_generator",
"=",
"generator",
";",
"this",
".",
... | The asset manager maintains a set of assets for a given document. On
initialization, it parses the layers' names into a set of components,
requests renderings of each of those components from the render manager,
and organizes the rendered assets into the appropriate files and folders.
When the document changes, it requ... | [
"The",
"asset",
"manager",
"maintains",
"a",
"set",
"of",
"assets",
"for",
"a",
"given",
"document",
".",
"On",
"initialization",
"it",
"parses",
"the",
"layers",
"names",
"into",
"a",
"set",
"of",
"components",
"requests",
"renderings",
"of",
"each",
"of",
... | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/assetmanager.js#L68-L83 |
18,066 | adobe-photoshop/generator-assets | lib/rendermanager.js | RenderManager | function RenderManager(generator, config, logger) {
events.EventEmitter.call(this);
this._generator = generator;
this._config = config;
this._logger = logger;
this._svgRenderers = {};
this._pixmapRenderers = {};
this._componentsByDocument = {};
this._pe... | javascript | function RenderManager(generator, config, logger) {
events.EventEmitter.call(this);
this._generator = generator;
this._config = config;
this._logger = logger;
this._svgRenderers = {};
this._pixmapRenderers = {};
this._componentsByDocument = {};
this._pe... | [
"function",
"RenderManager",
"(",
"generator",
",",
"config",
",",
"logger",
")",
"{",
"events",
".",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_generator",
"=",
"generator",
";",
"this",
".",
"_config",
"=",
"config",
";",
"this"... | Manages asynchonous rendering jobs across all active documents.
@constructor
@param {Generator} generator
@param {object} config
@param {Logger} logger | [
"Manages",
"asynchonous",
"rendering",
"jobs",
"across",
"all",
"active",
"documents",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/rendermanager.js#L49-L64 |
18,067 | adobe-photoshop/generator-assets | main.js | _pauseAssetGeneration | function _pauseAssetGeneration(id) {
if (_waitingDocuments.hasOwnProperty(id)) {
_canceledDocuments[id] = true;
} else if (_assetManagers.hasOwnProperty(id)) {
_assetManagers[id].stop();
}
} | javascript | function _pauseAssetGeneration(id) {
if (_waitingDocuments.hasOwnProperty(id)) {
_canceledDocuments[id] = true;
} else if (_assetManagers.hasOwnProperty(id)) {
_assetManagers[id].stop();
}
} | [
"function",
"_pauseAssetGeneration",
"(",
"id",
")",
"{",
"if",
"(",
"_waitingDocuments",
".",
"hasOwnProperty",
"(",
"id",
")",
")",
"{",
"_canceledDocuments",
"[",
"id",
"]",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"_assetManagers",
".",
"hasOwnProperty"... | Disable asset generation for the given Document ID, halting any asset
rending in progress.
@private
@param {!number} id The document ID for which asset generation should be disabled. | [
"Disable",
"asset",
"generation",
"for",
"the",
"given",
"Document",
"ID",
"halting",
"any",
"asset",
"rending",
"in",
"progress",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/main.js#L57-L63 |
18,068 | adobe-photoshop/generator-assets | main.js | _handleFileChange | function _handleFileChange(id, change) {
// If the filename changed but the saved state didn't change, then the file must have been renamed
if (change.previous && !change.hasOwnProperty("previousSaved")) {
_stopAssetGeneration(id);
_stateManager.deactivate(id);
}
} | javascript | function _handleFileChange(id, change) {
// If the filename changed but the saved state didn't change, then the file must have been renamed
if (change.previous && !change.hasOwnProperty("previousSaved")) {
_stopAssetGeneration(id);
_stateManager.deactivate(id);
}
} | [
"function",
"_handleFileChange",
"(",
"id",
",",
"change",
")",
"{",
"// If the filename changed but the saved state didn't change, then the file must have been renamed",
"if",
"(",
"change",
".",
"previous",
"&&",
"!",
"change",
".",
"hasOwnProperty",
"(",
"\"previousSaved\"... | Handler for a the "file" change event fired by Document objects. Disables
asset generation after Save As is performed on an an already-saved file.
@private
@param {number} id The ID of the Document that changed
@param {{previous: string=, previousSaved: boolean=}} change The file
change event emitted by the Document | [
"Handler",
"for",
"a",
"the",
"file",
"change",
"event",
"fired",
"by",
"Document",
"objects",
".",
"Disables",
"asset",
"generation",
"after",
"Save",
"As",
"is",
"performed",
"on",
"an",
"an",
"already",
"-",
"saved",
"file",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/main.js#L89-L95 |
18,069 | adobe-photoshop/generator-assets | main.js | _getChangedSettings | function _getChangedSettings(settings) {
if (settings && typeof(settings) === "object") {
return _generator.extractDocumentSettings({generatorSettings: settings}, PLUGIN_ID);
}
return null;
} | javascript | function _getChangedSettings(settings) {
if (settings && typeof(settings) === "object") {
return _generator.extractDocumentSettings({generatorSettings: settings}, PLUGIN_ID);
}
return null;
} | [
"function",
"_getChangedSettings",
"(",
"settings",
")",
"{",
"if",
"(",
"settings",
"&&",
"typeof",
"(",
"settings",
")",
"===",
"\"object\"",
")",
"{",
"return",
"_generator",
".",
"extractDocumentSettings",
"(",
"{",
"generatorSettings",
":",
"settings",
"}",... | Extract generator settings from the "current" or "previous" property of a generatorSettings
change event. If the supplied value is not actually a settings object, returns null.
@private
@param {object} settings Settings json object.
@return {object} Settings object from generator or null. | [
"Extract",
"generator",
"settings",
"from",
"the",
"current",
"or",
"previous",
"property",
"of",
"a",
"generatorSettings",
"change",
"event",
".",
"If",
"the",
"supplied",
"value",
"is",
"not",
"actually",
"a",
"settings",
"object",
"returns",
"null",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/main.js#L105-L110 |
18,070 | adobe-photoshop/generator-assets | main.js | _handleDocGeneratorSettingsChange | function _handleDocGeneratorSettingsChange(id, change) {
var curSettings = _getChangedSettings(change.current),
prevSettings = _getChangedSettings(change.previous),
curEnabled = !!(curSettings && curSettings.enabled),
prevEnabled = !!(prevSettings && prevSettings.enabled);
... | javascript | function _handleDocGeneratorSettingsChange(id, change) {
var curSettings = _getChangedSettings(change.current),
prevSettings = _getChangedSettings(change.previous),
curEnabled = !!(curSettings && curSettings.enabled),
prevEnabled = !!(prevSettings && prevSettings.enabled);
... | [
"function",
"_handleDocGeneratorSettingsChange",
"(",
"id",
",",
"change",
")",
"{",
"var",
"curSettings",
"=",
"_getChangedSettings",
"(",
"change",
".",
"current",
")",
",",
"prevSettings",
"=",
"_getChangedSettings",
"(",
"change",
".",
"previous",
")",
",",
... | Handler for a the "generatorSettings" change event fired by Document objects. Updates
the state manger based on the current doc setting if the enable settings actually
changed
@private
@param {number} id The ID of the Document that changed
@param {{previous: settings=, current: settings=}} change The previous and curr... | [
"Handler",
"for",
"a",
"the",
"generatorSettings",
"change",
"event",
"fired",
"by",
"Document",
"objects",
".",
"Updates",
"the",
"state",
"manger",
"based",
"on",
"the",
"current",
"doc",
"setting",
"if",
"the",
"enable",
"settings",
"actually",
"changed"
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/main.js#L122-L135 |
18,071 | adobe-photoshop/generator-assets | main.js | _handleOpenDocumentsChanged | function _handleOpenDocumentsChanged(all, opened) {
var open = opened || all;
open.forEach(function (id) {
_documentManager.getDocument(id).done(function (document) {
document.on("generatorSettings", _handleDocGeneratorSettingsChange.bind(undefined, id));
}, func... | javascript | function _handleOpenDocumentsChanged(all, opened) {
var open = opened || all;
open.forEach(function (id) {
_documentManager.getDocument(id).done(function (document) {
document.on("generatorSettings", _handleDocGeneratorSettingsChange.bind(undefined, id));
}, func... | [
"function",
"_handleOpenDocumentsChanged",
"(",
"all",
",",
"opened",
")",
"{",
"var",
"open",
"=",
"opened",
"||",
"all",
";",
"open",
".",
"forEach",
"(",
"function",
"(",
"id",
")",
"{",
"_documentManager",
".",
"getDocument",
"(",
"id",
")",
".",
"do... | Handler for a the "openDocumentsChanged" event emitted by the DocumentManager.
Registers a generatorSettings change to update the StateManager appropiately
@private
@param {Array.<number>} all The complete set of open document IDs
@param {Array.<number>=} opened The set of newly opened document IDs | [
"Handler",
"for",
"a",
"the",
"openDocumentsChanged",
"event",
"emitted",
"by",
"the",
"DocumentManager",
".",
"Registers",
"a",
"generatorSettings",
"change",
"to",
"update",
"the",
"StateManager",
"appropiately"
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/main.js#L145-L156 |
18,072 | adobe-photoshop/generator-assets | main.js | _startAssetGeneration | function _startAssetGeneration(id) {
if (_waitingDocuments.hasOwnProperty(id)) {
return;
}
var documentPromise = _documentManager.getDocument(id);
_waitingDocuments[id] = documentPromise;
documentPromise.done(function (document) {
delete _waitin... | javascript | function _startAssetGeneration(id) {
if (_waitingDocuments.hasOwnProperty(id)) {
return;
}
var documentPromise = _documentManager.getDocument(id);
_waitingDocuments[id] = documentPromise;
documentPromise.done(function (document) {
delete _waitin... | [
"function",
"_startAssetGeneration",
"(",
"id",
")",
"{",
"if",
"(",
"_waitingDocuments",
".",
"hasOwnProperty",
"(",
"id",
")",
")",
"{",
"return",
";",
"}",
"var",
"documentPromise",
"=",
"_documentManager",
".",
"getDocument",
"(",
"id",
")",
";",
"_waiti... | Enable asset generation for the given Document ID, causing all annotated
assets in the given document to be regenerated.
@private
@param {!number} id The document ID for which asset generation should be enabled. | [
"Enable",
"asset",
"generation",
"for",
"the",
"given",
"Document",
"ID",
"causing",
"all",
"annotated",
"assets",
"in",
"the",
"given",
"document",
"to",
"be",
"regenerated",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/main.js#L165-L190 |
18,073 | adobe-photoshop/generator-assets | main.js | _getConfig | function _getConfig() {
var copy = {},
property;
for (property in _config) {
if (_config.hasOwnProperty(property)) {
copy[property] = _config[property];
}
}
return copy;
} | javascript | function _getConfig() {
var copy = {},
property;
for (property in _config) {
if (_config.hasOwnProperty(property)) {
copy[property] = _config[property];
}
}
return copy;
} | [
"function",
"_getConfig",
"(",
")",
"{",
"var",
"copy",
"=",
"{",
"}",
",",
"property",
";",
"for",
"(",
"property",
"in",
"_config",
")",
"{",
"if",
"(",
"_config",
".",
"hasOwnProperty",
"(",
"property",
")",
")",
"{",
"copy",
"[",
"property",
"]",... | Get a copy of the plugin's config object. For automated testing only.
@private
@return {object} | [
"Get",
"a",
"copy",
"of",
"the",
"plugin",
"s",
"config",
"object",
".",
"For",
"automated",
"testing",
"only",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/main.js#L211-L222 |
18,074 | adobe-photoshop/generator-assets | main.js | _setConfig | function _setConfig(config, keepExisting) {
var property;
// optionally clean out the existing properties first
if (!keepExisting) {
for (property in _config) {
if (_config.hasOwnProperty(property)) {
delete _config[property];
}
... | javascript | function _setConfig(config, keepExisting) {
var property;
// optionally clean out the existing properties first
if (!keepExisting) {
for (property in _config) {
if (_config.hasOwnProperty(property)) {
delete _config[property];
}
... | [
"function",
"_setConfig",
"(",
"config",
",",
"keepExisting",
")",
"{",
"var",
"property",
";",
"// optionally clean out the existing properties first",
"if",
"(",
"!",
"keepExisting",
")",
"{",
"for",
"(",
"property",
"in",
"_config",
")",
"{",
"if",
"(",
"_con... | Set the plugin's config object. This mutates the referenced object, not the
reference. For automated testing only.
@private
@param {object} config
@param {boolean=} keepExisting if true then don't delete previous configs first. default: false | [
"Set",
"the",
"plugin",
"s",
"config",
"object",
".",
"This",
"mutates",
"the",
"referenced",
"object",
"not",
"the",
"reference",
".",
"For",
"automated",
"testing",
"only",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/main.js#L232-L250 |
18,075 | adobe-photoshop/generator-assets | main.js | init | function init(generator, config, logger) {
_generator = generator;
_config = config;
_logger = logger;
_documentManager = new DocumentManager(generator, config, logger);
_stateManager = new StateManager(generator, config, logger, _documentManager);
_renderManager = new R... | javascript | function init(generator, config, logger) {
_generator = generator;
_config = config;
_logger = logger;
_documentManager = new DocumentManager(generator, config, logger);
_stateManager = new StateManager(generator, config, logger, _documentManager);
_renderManager = new R... | [
"function",
"init",
"(",
"generator",
",",
"config",
",",
"logger",
")",
"{",
"_generator",
"=",
"generator",
";",
"_config",
"=",
"config",
";",
"_logger",
"=",
"logger",
";",
"_documentManager",
"=",
"new",
"DocumentManager",
"(",
"generator",
",",
"config... | Initialize the Assets plugin.
@param {Generator} generator The Generator instance for this plugin.
@param {object} config Configuration options for this plugin.
@param {Logger} logger The Logger instance for this plugin. | [
"Initialize",
"the",
"Assets",
"plugin",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/main.js#L260-L285 |
18,076 | adobe-photoshop/generator-assets | lib/renderer.js | BaseRenderer | function BaseRenderer(generator, config, logger, document) {
this._generator = generator;
this._document = document;
this._logger = logger;
if (config.hasOwnProperty("use-jpg-encoding")) {
this._useJPGEncoding = config["use-jpg-encoding"];
}
if (config.hasOw... | javascript | function BaseRenderer(generator, config, logger, document) {
this._generator = generator;
this._document = document;
this._logger = logger;
if (config.hasOwnProperty("use-jpg-encoding")) {
this._useJPGEncoding = config["use-jpg-encoding"];
}
if (config.hasOw... | [
"function",
"BaseRenderer",
"(",
"generator",
",",
"config",
",",
"logger",
",",
"document",
")",
"{",
"this",
".",
"_generator",
"=",
"generator",
";",
"this",
".",
"_document",
"=",
"document",
";",
"this",
".",
"_logger",
"=",
"logger",
";",
"if",
"("... | Abstract renderer class for a given document. Converts components to assets on disk.
@constructor
@param {Generator} generator
@param {object} config
@param {Logger} logger
@param {Document} document | [
"Abstract",
"renderer",
"class",
"for",
"a",
"given",
"document",
".",
"Converts",
"components",
"to",
"assets",
"on",
"disk",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/renderer.js#L57-L121 |
18,077 | adobe-photoshop/generator-assets | lib/renderer.js | SVGRenderer | function SVGRenderer(generator, config, logger, document) {
BaseRenderer.call(this, generator, config, logger, document);
if (config.hasOwnProperty("svgomg-enabled")) {
this._useSVGOMG = !!config["svgomg-enabled"];
}
} | javascript | function SVGRenderer(generator, config, logger, document) {
BaseRenderer.call(this, generator, config, logger, document);
if (config.hasOwnProperty("svgomg-enabled")) {
this._useSVGOMG = !!config["svgomg-enabled"];
}
} | [
"function",
"SVGRenderer",
"(",
"generator",
",",
"config",
",",
"logger",
",",
"document",
")",
"{",
"BaseRenderer",
".",
"call",
"(",
"this",
",",
"generator",
",",
"config",
",",
"logger",
",",
"document",
")",
";",
"if",
"(",
"config",
".",
"hasOwnPr... | SVG asset renderer.
@constructor
@extends BaseRenderer | [
"SVG",
"asset",
"renderer",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/renderer.js#L436-L442 |
18,078 | adobe-photoshop/generator-assets | lib/renderer.js | createSVGRenderer | function createSVGRenderer(generator, config, logger, document) {
return new SVGRenderer(generator, config, logger, document);
} | javascript | function createSVGRenderer(generator, config, logger, document) {
return new SVGRenderer(generator, config, logger, document);
} | [
"function",
"createSVGRenderer",
"(",
"generator",
",",
"config",
",",
"logger",
",",
"document",
")",
"{",
"return",
"new",
"SVGRenderer",
"(",
"generator",
",",
"config",
",",
"logger",
",",
"document",
")",
";",
"}"
] | Return a new SVGRenderer object. | [
"Return",
"a",
"new",
"SVGRenderer",
"object",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/renderer.js#L641-L643 |
18,079 | adobe-photoshop/generator-assets | lib/renderer.js | PixmapRenderer | function PixmapRenderer(generator, config, logger, document) {
BaseRenderer.call(this, generator, config, logger, document);
if (config.hasOwnProperty("interpolation-type")) {
this._interpolationType = config["interpolation-type"];
}
} | javascript | function PixmapRenderer(generator, config, logger, document) {
BaseRenderer.call(this, generator, config, logger, document);
if (config.hasOwnProperty("interpolation-type")) {
this._interpolationType = config["interpolation-type"];
}
} | [
"function",
"PixmapRenderer",
"(",
"generator",
",",
"config",
",",
"logger",
",",
"document",
")",
"{",
"BaseRenderer",
".",
"call",
"(",
"this",
",",
"generator",
",",
"config",
",",
"logger",
",",
"document",
")",
";",
"if",
"(",
"config",
".",
"hasOw... | Pixmap asset renderer.
@constructor
@extends BaseRenderer | [
"Pixmap",
"asset",
"renderer",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/renderer.js#L651-L657 |
18,080 | adobe-photoshop/generator-assets | lib/renderer.js | createPixmapRenderer | function createPixmapRenderer(generator, config, logger, document) {
return new PixmapRenderer(generator, config, logger, document);
} | javascript | function createPixmapRenderer(generator, config, logger, document) {
return new PixmapRenderer(generator, config, logger, document);
} | [
"function",
"createPixmapRenderer",
"(",
"generator",
",",
"config",
",",
"logger",
",",
"document",
")",
"{",
"return",
"new",
"PixmapRenderer",
"(",
"generator",
",",
"config",
",",
"logger",
",",
"document",
")",
";",
"}"
] | Return a new PixmapRenderer object. | [
"Return",
"a",
"new",
"PixmapRenderer",
"object",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/renderer.js#L1486-L1488 |
18,081 | adobe-photoshop/generator-assets | lib/componentmanager.js | _shallowCopy | function _shallowCopy(component) {
var clone = {},
property;
for (property in component) {
if (component.hasOwnProperty(property)) {
clone[property] = component[property];
}
}
return clone;
} | javascript | function _shallowCopy(component) {
var clone = {},
property;
for (property in component) {
if (component.hasOwnProperty(property)) {
clone[property] = component[property];
}
}
return clone;
} | [
"function",
"_shallowCopy",
"(",
"component",
")",
"{",
"var",
"clone",
"=",
"{",
"}",
",",
"property",
";",
"for",
"(",
"property",
"in",
"component",
")",
"{",
"if",
"(",
"component",
".",
"hasOwnProperty",
"(",
"property",
")",
")",
"{",
"clone",
"[... | Create a shallow copy of a component.
@param {Component} component
@return {Component} | [
"Create",
"a",
"shallow",
"copy",
"of",
"a",
"component",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/componentmanager.js#L57-L68 |
18,082 | adobe-photoshop/generator-assets | lib/componentmanager.js | _deriveComponent | function _deriveComponent(def, basic) {
var derived = _shallowCopy(basic);
if (def.hasOwnProperty("folder")) {
if (derived.hasOwnProperty("folder")) {
var folder = def.folder.concat(basic.folder);
derived.folder = folder;
} else {
... | javascript | function _deriveComponent(def, basic) {
var derived = _shallowCopy(basic);
if (def.hasOwnProperty("folder")) {
if (derived.hasOwnProperty("folder")) {
var folder = def.folder.concat(basic.folder);
derived.folder = folder;
} else {
... | [
"function",
"_deriveComponent",
"(",
"def",
",",
"basic",
")",
"{",
"var",
"derived",
"=",
"_shallowCopy",
"(",
"basic",
")",
";",
"if",
"(",
"def",
".",
"hasOwnProperty",
"(",
"\"folder\"",
")",
")",
"{",
"if",
"(",
"derived",
".",
"hasOwnProperty",
"("... | Create a single derived component from a given default component and basic
component.
@private
@param {Component} def A default component
@param {Component} basic A basic component
@return {Component} The derived component | [
"Create",
"a",
"single",
"derived",
"component",
"from",
"a",
"given",
"default",
"component",
"and",
"basic",
"component",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/componentmanager.js#L79-L159 |
18,083 | adobe-photoshop/generator-assets | lib/componentmanager.js | ComponentManager | function ComponentManager(generator, config) {
this._parserManager = new ParserManager(config);
this._config = config || {};
this._allComponents = {};
this._componentsForLayer = {};
this._componentsForComp = {};
this._componentsForDocument = {};
this._paths = {};
... | javascript | function ComponentManager(generator, config) {
this._parserManager = new ParserManager(config);
this._config = config || {};
this._allComponents = {};
this._componentsForLayer = {};
this._componentsForComp = {};
this._componentsForDocument = {};
this._paths = {};
... | [
"function",
"ComponentManager",
"(",
"generator",
",",
"config",
")",
"{",
"this",
".",
"_parserManager",
"=",
"new",
"ParserManager",
"(",
"config",
")",
";",
"this",
".",
"_config",
"=",
"config",
"||",
"{",
"}",
";",
"this",
".",
"_allComponents",
"=",
... | ComponentManagers manage a set of Component objects.
@constructor | [
"ComponentManagers",
"manage",
"a",
"set",
"of",
"Component",
"objects",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/componentmanager.js#L166-L177 |
18,084 | adobe-photoshop/generator-assets | lib/parsermanager.js | ParserManager | function ParserManager(config) {
this._config = config || {};
this._supportedUnits = {
"in": true,
"cm": true,
"px": true,
"mm": true
};
this._supportedExtensions = {
"jpg": true,
"png": true,
"gif": tr... | javascript | function ParserManager(config) {
this._config = config || {};
this._supportedUnits = {
"in": true,
"cm": true,
"px": true,
"mm": true
};
this._supportedExtensions = {
"jpg": true,
"png": true,
"gif": tr... | [
"function",
"ParserManager",
"(",
"config",
")",
"{",
"this",
".",
"_config",
"=",
"config",
"||",
"{",
"}",
";",
"this",
".",
"_supportedUnits",
"=",
"{",
"\"in\"",
":",
"true",
",",
"\"cm\"",
":",
"true",
",",
"\"px\"",
":",
"true",
",",
"\"mm\"",
... | The ParserManager manages parsing, normalization and analysis of layer
names into asset specifications. The config parameter can be used to enable
svg and webp parsing if the "svg-enabled" and "webp-enabled" parameters are
set, resp.
@constructor
@param {object} config | [
"The",
"ParserManager",
"manages",
"parsing",
"normalization",
"and",
"analysis",
"of",
"layer",
"names",
"into",
"asset",
"specifications",
".",
"The",
"config",
"parameter",
"can",
"be",
"used",
"to",
"enable",
"svg",
"and",
"webp",
"parsing",
"if",
"the",
"... | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/parsermanager.js#L38-L55 |
18,085 | adobe-photoshop/generator-assets | lib/filemanager.js | FileManager | function FileManager(generator, config, logger) {
this._generator = generator;
this._config = config;
this._logger = logger;
this._queue = new AsyncQueue();
this._queue.pause();
this._queue.on("error", function (err) {
this._logger.error(err);
}.bind(... | javascript | function FileManager(generator, config, logger) {
this._generator = generator;
this._config = config;
this._logger = logger;
this._queue = new AsyncQueue();
this._queue.pause();
this._queue.on("error", function (err) {
this._logger.error(err);
}.bind(... | [
"function",
"FileManager",
"(",
"generator",
",",
"config",
",",
"logger",
")",
"{",
"this",
".",
"_generator",
"=",
"generator",
";",
"this",
".",
"_config",
"=",
"config",
";",
"this",
".",
"_logger",
"=",
"logger",
";",
"this",
".",
"_queue",
"=",
"... | Manage a collection of files, specified with relative paths, under a
given base path, specified absolutely.
@constructor
@param {Generator} generator
@param {object} config
@param {Logger} logger | [
"Manage",
"a",
"collection",
"of",
"files",
"specified",
"with",
"relative",
"paths",
"under",
"a",
"given",
"base",
"path",
"specified",
"absolutely",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/filemanager.js#L50-L60 |
18,086 | adobe-photoshop/generator-assets | lib/documentmanager.js | DocumentManager | function DocumentManager(generator, config, logger, options) {
EventEmitter.call(this);
this._generator = generator;
this._config = config;
this._logger = logger;
options = options || {};
this._getDocumentInfoFlags = options.getDocumentInfoFlags;
... | javascript | function DocumentManager(generator, config, logger, options) {
EventEmitter.call(this);
this._generator = generator;
this._config = config;
this._logger = logger;
options = options || {};
this._getDocumentInfoFlags = options.getDocumentInfoFlags;
... | [
"function",
"DocumentManager",
"(",
"generator",
",",
"config",
",",
"logger",
",",
"options",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_generator",
"=",
"generator",
";",
"this",
".",
"_config",
"=",
"config",
";",
"th... | The DocumentManager provides a simple interface for requesting and maintaining
up-to-date Document objects from Photoshop.
Emits "openDocumentsChanged" event when the set of open documents changes with
the following parameters:
1. @param {Array.<number>} IDs for the set of currently open documents
2. @param {Array.<nu... | [
"The",
"DocumentManager",
"provides",
"a",
"simple",
"interface",
"for",
"requesting",
"and",
"maintaining",
"up",
"-",
"to",
"-",
"date",
"Document",
"objects",
"from",
"Photoshop",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/documentmanager.js#L73-L103 |
18,087 | adobe-photoshop/generator-assets | lib/dom/document.js | Document | function Document(generator, config, logger, raw) {
if (DEBUG_TO_RAW_CONVERSION) {
debugLogObject("raw", raw);
}
events.EventEmitter.call(this);
this._generator = generator;
this._config = config;
this._logger = logger;
var property;
... | javascript | function Document(generator, config, logger, raw) {
if (DEBUG_TO_RAW_CONVERSION) {
debugLogObject("raw", raw);
}
events.EventEmitter.call(this);
this._generator = generator;
this._config = config;
this._logger = logger;
var property;
... | [
"function",
"Document",
"(",
"generator",
",",
"config",
",",
"logger",
",",
"raw",
")",
"{",
"if",
"(",
"DEBUG_TO_RAW_CONVERSION",
")",
"{",
"debugLogObject",
"(",
"\"raw\"",
",",
"raw",
")",
";",
"}",
"events",
".",
"EventEmitter",
".",
"call",
"(",
"t... | Model of a Photoshop document.
@constructor
@param {Generator} generator
@param {object} config
@param {Logger} logger
@param {object} raw Raw description of the document | [
"Model",
"of",
"a",
"Photoshop",
"document",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/dom/document.js#L58-L134 |
18,088 | adobe-photoshop/generator-assets | lib/dom/layer.js | BaseLayer | function BaseLayer(document, group, raw) {
this._document = document;
this._logger = document._logger;
if (group) {
this._setGroup(group);
}
var handledProperties = this._handledProperties || {},
property;
for (property in raw) {
if ... | javascript | function BaseLayer(document, group, raw) {
this._document = document;
this._logger = document._logger;
if (group) {
this._setGroup(group);
}
var handledProperties = this._handledProperties || {},
property;
for (property in raw) {
if ... | [
"function",
"BaseLayer",
"(",
"document",
",",
"group",
",",
"raw",
")",
"{",
"this",
".",
"_document",
"=",
"document",
";",
"this",
".",
"_logger",
"=",
"document",
".",
"_logger",
";",
"if",
"(",
"group",
")",
"{",
"this",
".",
"_setGroup",
"(",
"... | Abstract base class for representing layers in a document. This should not
be instantiated directly.
@constructor
@private
@param {Document} document
@param {?LayerGroup} group The parent layer group of this layer. Null if the layer
is directly contained by the Document.
@param {object} raw Raw description of the laye... | [
"Abstract",
"base",
"class",
"for",
"representing",
"layers",
"in",
"a",
"document",
".",
"This",
"should",
"not",
"be",
"instantiated",
"directly",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/dom/layer.js#L77-L142 |
18,089 | adobe-photoshop/generator-assets | lib/dom/layer.js | createLayer | function createLayer(document, parent, rawLayer) {
if (!parent && !rawLayer.hasOwnProperty("type")) {
return new LayerGroup(document, null, rawLayer);
}
switch (rawLayer.type) {
case "layerSection":
case "artboardSection":
case "framedGroupSection":
... | javascript | function createLayer(document, parent, rawLayer) {
if (!parent && !rawLayer.hasOwnProperty("type")) {
return new LayerGroup(document, null, rawLayer);
}
switch (rawLayer.type) {
case "layerSection":
case "artboardSection":
case "framedGroupSection":
... | [
"function",
"createLayer",
"(",
"document",
",",
"parent",
",",
"rawLayer",
")",
"{",
"if",
"(",
"!",
"parent",
"&&",
"!",
"rawLayer",
".",
"hasOwnProperty",
"(",
"\"type\"",
")",
")",
"{",
"return",
"new",
"LayerGroup",
"(",
"document",
",",
"null",
","... | Create a new layer object of the appropriate type for the given raw
description. The new layer is not attached to its parent layer.
@param {Document} document The parent document for the new layer
@param {?BaseLayer} parent The parent layer for the new layer
@param {object} rawLayer The raw description of the new laye... | [
"Create",
"a",
"new",
"layer",
"object",
"of",
"the",
"appropriate",
"type",
"for",
"the",
"given",
"raw",
"description",
".",
"The",
"new",
"layer",
"is",
"not",
"attached",
"to",
"its",
"parent",
"layer",
"."
] | 87878b2d3cb979578d471f1ecc3eba906c6d17d4 | https://github.com/adobe-photoshop/generator-assets/blob/87878b2d3cb979578d471f1ecc3eba906c6d17d4/lib/dom/layer.js#L1114-L1139 |
18,090 | archilogic-com/3dio-js | src/scene/structure/to-aframe-elements.js | getAframeElementsFromSceneStructure | function getAframeElementsFromSceneStructure(sceneStructure, parent) {
var collection = parent ? null : [] // use collection or parent
sceneStructure.forEach(function(element3d) {
// check if type is supported in aframe
if (validTypes.indexOf(element3d.type) > -1) {
// get html attributes from element... | javascript | function getAframeElementsFromSceneStructure(sceneStructure, parent) {
var collection = parent ? null : [] // use collection or parent
sceneStructure.forEach(function(element3d) {
// check if type is supported in aframe
if (validTypes.indexOf(element3d.type) > -1) {
// get html attributes from element... | [
"function",
"getAframeElementsFromSceneStructure",
"(",
"sceneStructure",
",",
"parent",
")",
"{",
"var",
"collection",
"=",
"parent",
"?",
"null",
":",
"[",
"]",
"// use collection or parent",
"sceneStructure",
".",
"forEach",
"(",
"function",
"(",
"element3d",
")"... | recursive parsing through sceneStructre | [
"recursive",
"parsing",
"through",
"sceneStructre"
] | 23b777b0466095fe53bfb64de6ff1588da51f483 | https://github.com/archilogic-com/3dio-js/blob/23b777b0466095fe53bfb64de6ff1588da51f483/src/scene/structure/to-aframe-elements.js#L54-L75 |
18,091 | archilogic-com/3dio-js | src/scene/structure/to-aframe-elements.js | createBakedElement | function createBakedElement(parentElem, element3d) {
// we might have a scene that has no baked level
if (!element3d.bakedModelUrl && !element3d.bakePreviewStatusFileKey) {
console.warn('Level without bakedModelUrl: ', element3d)
return
}
// set data3d.buffer file key
var attributes = {
'io3d-data... | javascript | function createBakedElement(parentElem, element3d) {
// we might have a scene that has no baked level
if (!element3d.bakedModelUrl && !element3d.bakePreviewStatusFileKey) {
console.warn('Level without bakedModelUrl: ', element3d)
return
}
// set data3d.buffer file key
var attributes = {
'io3d-data... | [
"function",
"createBakedElement",
"(",
"parentElem",
",",
"element3d",
")",
"{",
"// we might have a scene that has no baked level",
"if",
"(",
"!",
"element3d",
".",
"bakedModelUrl",
"&&",
"!",
"element3d",
".",
"bakePreviewStatusFileKey",
")",
"{",
"console",
".",
"... | creates a child for a baked model in the current element | [
"creates",
"a",
"child",
"for",
"a",
"baked",
"model",
"in",
"the",
"current",
"element"
] | 23b777b0466095fe53bfb64de6ff1588da51f483 | https://github.com/archilogic-com/3dio-js/blob/23b777b0466095fe53bfb64de6ff1588da51f483/src/scene/structure/to-aframe-elements.js#L183-L208 |
18,092 | archilogic-com/3dio-js | src/aframe/component/gblock.js | GBlockLoader | function GBlockLoader () {
this.manager = THREE.DefaultLoadingManager
this.path = THREE.Loader.prototype.extractUrlBase( url )
} | javascript | function GBlockLoader () {
this.manager = THREE.DefaultLoadingManager
this.path = THREE.Loader.prototype.extractUrlBase( url )
} | [
"function",
"GBlockLoader",
"(",
")",
"{",
"this",
".",
"manager",
"=",
"THREE",
".",
"DefaultLoadingManager",
"this",
".",
"path",
"=",
"THREE",
".",
"Loader",
".",
"prototype",
".",
"extractUrlBase",
"(",
"url",
")",
"}"
] | create unviresal GLTF loader for google blocks this one will inherit methods from GLTF V1 or V2 based on file version | [
"create",
"unviresal",
"GLTF",
"loader",
"for",
"google",
"blocks",
"this",
"one",
"will",
"inherit",
"methods",
"from",
"GLTF",
"V1",
"or",
"V2",
"based",
"on",
"file",
"version"
] | 23b777b0466095fe53bfb64de6ff1588da51f483 | https://github.com/archilogic-com/3dio-js/blob/23b777b0466095fe53bfb64de6ff1588da51f483/src/aframe/component/gblock.js#L116-L119 |
18,093 | archilogic-com/3dio-js | src/scene/structure/parametric-objects/kitchen.js | getElementPos | function getElementPos(pos) {
var l = 0
for (var i = 0; i < pos - 1; i++) { l += elements[i] }
return l
} | javascript | function getElementPos(pos) {
var l = 0
for (var i = 0; i < pos - 1; i++) { l += elements[i] }
return l
} | [
"function",
"getElementPos",
"(",
"pos",
")",
"{",
"var",
"l",
"=",
"0",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"pos",
"-",
"1",
";",
"i",
"++",
")",
"{",
"l",
"+=",
"elements",
"[",
"i",
"]",
"}",
"return",
"l",
"}"
] | get x coordinate for element index | [
"get",
"x",
"coordinate",
"for",
"element",
"index"
] | 23b777b0466095fe53bfb64de6ff1588da51f483 | https://github.com/archilogic-com/3dio-js/blob/23b777b0466095fe53bfb64de6ff1588da51f483/src/scene/structure/parametric-objects/kitchen.js#L193-L197 |
18,094 | archilogic-com/3dio-js | src/utils/image/scale-down-image.js | normaliseScale | function normaliseScale(s) {
if (s>1) throw('s must be <1');
s = 0 | (1/s);
var l = log2(s);
var mask = 1 << l;
var accuracy = 4;
while(accuracy && l) { l--; mask |= 1<<l; accuracy--; }
return 1 / ( s & mask );
} | javascript | function normaliseScale(s) {
if (s>1) throw('s must be <1');
s = 0 | (1/s);
var l = log2(s);
var mask = 1 << l;
var accuracy = 4;
while(accuracy && l) { l--; mask |= 1<<l; accuracy--; }
return 1 / ( s & mask );
} | [
"function",
"normaliseScale",
"(",
"s",
")",
"{",
"if",
"(",
"s",
">",
"1",
")",
"throw",
"(",
"'s must be <1'",
")",
";",
"s",
"=",
"0",
"|",
"(",
"1",
"/",
"s",
")",
";",
"var",
"l",
"=",
"log2",
"(",
"s",
")",
";",
"var",
"mask",
"=",
"1... | normalize a scale <1 to avoid some rounding issue with js numbers | [
"normalize",
"a",
"scale",
"<1",
"to",
"avoid",
"some",
"rounding",
"issue",
"with",
"js",
"numbers"
] | 23b777b0466095fe53bfb64de6ff1588da51f483 | https://github.com/archilogic-com/3dio-js/blob/23b777b0466095fe53bfb64de6ff1588da51f483/src/utils/image/scale-down-image.js#L230-L238 |
18,095 | archilogic-com/3dio-js | examples-browser/offline-data/sw.js | fromCache | function fromCache(request) {
return caches.open(CACHE).then(function (cache) {
return cache.match(request).then(function (matching) {
return matching || Promise.reject('no-match');
});
});
} | javascript | function fromCache(request) {
return caches.open(CACHE).then(function (cache) {
return cache.match(request).then(function (matching) {
return matching || Promise.reject('no-match');
});
});
} | [
"function",
"fromCache",
"(",
"request",
")",
"{",
"return",
"caches",
".",
"open",
"(",
"CACHE",
")",
".",
"then",
"(",
"function",
"(",
"cache",
")",
"{",
"return",
"cache",
".",
"match",
"(",
"request",
")",
".",
"then",
"(",
"function",
"(",
"mat... | Open the cache where the assets were stored and search for the requested resource. Notice that in case of no matching, the promise still resolves but it does with `undefined` as value. | [
"Open",
"the",
"cache",
"where",
"the",
"assets",
"were",
"stored",
"and",
"search",
"for",
"the",
"requested",
"resource",
".",
"Notice",
"that",
"in",
"case",
"of",
"no",
"matching",
"the",
"promise",
"still",
"resolves",
"but",
"it",
"does",
"with",
"un... | 23b777b0466095fe53bfb64de6ff1588da51f483 | https://github.com/archilogic-com/3dio-js/blob/23b777b0466095fe53bfb64de6ff1588da51f483/examples-browser/offline-data/sw.js#L46-L52 |
18,096 | archilogic-com/3dio-js | examples-browser/offline-data/sw.js | update | function update(request) {
// don't automatically put 3D models in the cache
if(request.url.match(/https:\/\/storage.3d.io/)) return fetch(request);
return caches.open(CACHE).then(function (cache) {
return fetch(request).then(function (response) {
return cache.put(request, response);
});
});
} | javascript | function update(request) {
// don't automatically put 3D models in the cache
if(request.url.match(/https:\/\/storage.3d.io/)) return fetch(request);
return caches.open(CACHE).then(function (cache) {
return fetch(request).then(function (response) {
return cache.put(request, response);
});
});
} | [
"function",
"update",
"(",
"request",
")",
"{",
"// don't automatically put 3D models in the cache",
"if",
"(",
"request",
".",
"url",
".",
"match",
"(",
"/",
"https:\\/\\/storage.3d.io",
"/",
")",
")",
"return",
"fetch",
"(",
"request",
")",
";",
"return",
"cac... | Update consists in opening the cache, performing a network request and storing the new response data. | [
"Update",
"consists",
"in",
"opening",
"the",
"cache",
"performing",
"a",
"network",
"request",
"and",
"storing",
"the",
"new",
"response",
"data",
"."
] | 23b777b0466095fe53bfb64de6ff1588da51f483 | https://github.com/archilogic-com/3dio-js/blob/23b777b0466095fe53bfb64de6ff1588da51f483/examples-browser/offline-data/sw.js#L56-L65 |
18,097 | archilogic-com/3dio-js | src/aframe/component/tour.js | getNormalizeRotations | function getNormalizeRotations(start, end) {
// normalize both rotations
var normStart = normalizeRotation(start)
var normEnd = normalizeRotation(end)
// find the shortest arc for each rotation
Object.keys(start).forEach(function(axis) {
if (normEnd[axis] - normStart[axis] > 180) normEnd[axis] -= 360
})... | javascript | function getNormalizeRotations(start, end) {
// normalize both rotations
var normStart = normalizeRotation(start)
var normEnd = normalizeRotation(end)
// find the shortest arc for each rotation
Object.keys(start).forEach(function(axis) {
if (normEnd[axis] - normStart[axis] > 180) normEnd[axis] -= 360
})... | [
"function",
"getNormalizeRotations",
"(",
"start",
",",
"end",
")",
"{",
"// normalize both rotations",
"var",
"normStart",
"=",
"normalizeRotation",
"(",
"start",
")",
"var",
"normEnd",
"=",
"normalizeRotation",
"(",
"end",
")",
"// find the shortest arc for each rotat... | we want to prevent excessive spinning in rotations | [
"we",
"want",
"to",
"prevent",
"excessive",
"spinning",
"in",
"rotations"
] | 23b777b0466095fe53bfb64de6ff1588da51f483 | https://github.com/archilogic-com/3dio-js/blob/23b777b0466095fe53bfb64de6ff1588da51f483/src/aframe/component/tour.js#L235-L244 |
18,098 | archilogic-com/3dio-js | src/utils/data3d/buffer/triangulate-2d.js | eliminateHoles | function eliminateHoles (data, holeIndices, outerNode, dim) {
var queue = [],
i, len, start, end, list
for (i = 0, len = holeIndices.length; i < len; i++) {
start = holeIndices[i] * dim
end = i < len - 1 ? holeIndices[i + 1] * dim : data.length
list = linkedList(data, start, end, dim, false)
if... | javascript | function eliminateHoles (data, holeIndices, outerNode, dim) {
var queue = [],
i, len, start, end, list
for (i = 0, len = holeIndices.length; i < len; i++) {
start = holeIndices[i] * dim
end = i < len - 1 ? holeIndices[i + 1] * dim : data.length
list = linkedList(data, start, end, dim, false)
if... | [
"function",
"eliminateHoles",
"(",
"data",
",",
"holeIndices",
",",
"outerNode",
",",
"dim",
")",
"{",
"var",
"queue",
"=",
"[",
"]",
",",
"i",
",",
"len",
",",
"start",
",",
"end",
",",
"list",
"for",
"(",
"i",
"=",
"0",
",",
"len",
"=",
"holeIn... | link every hole into the outer loop, producing a single-ring polygon without holes | [
"link",
"every",
"hole",
"into",
"the",
"outer",
"loop",
"producing",
"a",
"single",
"-",
"ring",
"polygon",
"without",
"holes"
] | 23b777b0466095fe53bfb64de6ff1588da51f483 | https://github.com/archilogic-com/3dio-js/blob/23b777b0466095fe53bfb64de6ff1588da51f483/src/utils/data3d/buffer/triangulate-2d.js#L379-L407 |
18,099 | archilogic-com/3dio-js | src/utils/data3d/buffer/triangulate-2d.js | orient | function orient (data, p, q, r) {
var o = (data[q + 1] - data[p + 1]) * (data[r] - data[q]) - (data[q] - data[p]) * (data[r + 1] - data[q + 1])
return o > 0 ? 1 : o < 0 ? -1 : 0
} | javascript | function orient (data, p, q, r) {
var o = (data[q + 1] - data[p + 1]) * (data[r] - data[q]) - (data[q] - data[p]) * (data[r + 1] - data[q + 1])
return o > 0 ? 1 : o < 0 ? -1 : 0
} | [
"function",
"orient",
"(",
"data",
",",
"p",
",",
"q",
",",
"r",
")",
"{",
"var",
"o",
"=",
"(",
"data",
"[",
"q",
"+",
"1",
"]",
"-",
"data",
"[",
"p",
"+",
"1",
"]",
")",
"*",
"(",
"data",
"[",
"r",
"]",
"-",
"data",
"[",
"q",
"]",
... | winding order of triangle formed by 3 given points | [
"winding",
"order",
"of",
"triangle",
"formed",
"by",
"3",
"given",
"points"
] | 23b777b0466095fe53bfb64de6ff1588da51f483 | https://github.com/archilogic-com/3dio-js/blob/23b777b0466095fe53bfb64de6ff1588da51f483/src/utils/data3d/buffer/triangulate-2d.js#L620-L623 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.