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
50,100
Encapsule-Annex/onm-server-rest-routes
routes.js
function(req, res) { if (!req._body || (req.body == null) || !req.body) { res.send(400, "Invalid POST missing required request body."); return; } if ((req.body.store == null) || !req.body.store) { res.send(400, "Invalid POST mising 'sto...
javascript
function(req, res) { if (!req._body || (req.body == null) || !req.body) { res.send(400, "Invalid POST missing required request body."); return; } if ((req.body.store == null) || !req.body.store) { res.send(400, "Invalid POST mising 'sto...
[ "function", "(", "req", ",", "res", ")", "{", "if", "(", "!", "req", ".", "_body", "||", "(", "req", ".", "body", "==", "null", ")", "||", "!", "req", ".", "body", ")", "{", "res", ".", "send", "(", "400", ",", "\"Invalid POST missing required requ...
Overwrite a specific data component in a specific store.
[ "Overwrite", "a", "specific", "data", "component", "in", "a", "specific", "store", "." ]
2d831d46e13be0191c3562df20b61378bed49ee6
https://github.com/Encapsule-Annex/onm-server-rest-routes/blob/2d831d46e13be0191c3562df20b61378bed49ee6/routes.js#L182-L228
50,101
Encapsule-Annex/onm-server-rest-routes
routes.js
function(req, res) { if (!req._body || (req.body == null) || !req.body) { res.send(400, "Invalid POST missing required request body."); return; } if ((req.body.store == null) || !req.body.store) { res.send(400, "Invalid POST missing 'st...
javascript
function(req, res) { if (!req._body || (req.body == null) || !req.body) { res.send(400, "Invalid POST missing required request body."); return; } if ((req.body.store == null) || !req.body.store) { res.send(400, "Invalid POST missing 'st...
[ "function", "(", "req", ",", "res", ")", "{", "if", "(", "!", "req", ".", "_body", "||", "(", "req", ".", "body", "==", "null", ")", "||", "!", "req", ".", "body", ")", "{", "res", ".", "send", "(", "400", ",", "\"Invalid POST missing required requ...
Delete the named onm data store. Or, if an address is specified delete the addressed data component in the given store instead.
[ "Delete", "the", "named", "onm", "data", "store", ".", "Or", "if", "an", "address", "is", "specified", "delete", "the", "addressed", "data", "component", "in", "the", "given", "store", "instead", "." ]
2d831d46e13be0191c3562df20b61378bed49ee6
https://github.com/Encapsule-Annex/onm-server-rest-routes/blob/2d831d46e13be0191c3562df20b61378bed49ee6/routes.js#L243-L281
50,102
vamship/wysknd-test
lib/object.js
function(target, expectedInterface, ignoreExtra) { if (typeof target !== 'object' || target instanceof Array) { throw new Error('target object not specified, or is not valid (arg #1)'); } if (typeof expectedInterface !== 'object' || expectedInterface instanceof Array) { ...
javascript
function(target, expectedInterface, ignoreExtra) { if (typeof target !== 'object' || target instanceof Array) { throw new Error('target object not specified, or is not valid (arg #1)'); } if (typeof expectedInterface !== 'object' || expectedInterface instanceof Array) { ...
[ "function", "(", "target", ",", "expectedInterface", ",", "ignoreExtra", ")", "{", "if", "(", "typeof", "target", "!==", "'object'", "||", "target", "instanceof", "Array", ")", "{", "throw", "new", "Error", "(", "'target object not specified, or is not valid (arg #1...
Tests that the given object matches the specified interface. NOTE: This functionality is also available via a few mocha assertions, and those can be used instead. This method is being retained for backwards compatibility purposes. @param {Object} target The target object whose interface is being verified. @param {Obj...
[ "Tests", "that", "the", "given", "object", "matches", "the", "specified", "interface", "." ]
b7791c42f1c1b36be7738e2c6d24748360634003
https://github.com/vamship/wysknd-test/blob/b7791c42f1c1b36be7738e2c6d24748360634003/lib/object.js#L21-L58
50,103
lyfeyaj/ovt
lib/types/any.js
function(ref, condition) { condition = condition || {}; utils.assert( condition.then || condition.otherwise , 'one of condition.then or condition.otherwise must be existed' ); utils.assert( !condition.then || (condition.then && condition.then.isOvt), 'condition.then must be a va...
javascript
function(ref, condition) { condition = condition || {}; utils.assert( condition.then || condition.otherwise , 'one of condition.then or condition.otherwise must be existed' ); utils.assert( !condition.then || (condition.then && condition.then.isOvt), 'condition.then must be a va...
[ "function", "(", "ref", ",", "condition", ")", "{", "condition", "=", "condition", "||", "{", "}", ";", "utils", ".", "assert", "(", "condition", ".", "then", "||", "condition", ".", "otherwise", ",", "'one of condition.then or condition.otherwise must be existed'...
Check and parse ref and condition
[ "Check", "and", "parse", "ref", "and", "condition" ]
ebd50a3531f1504cd356c869dda91200ad2f6539
https://github.com/lyfeyaj/ovt/blob/ebd50a3531f1504cd356c869dda91200ad2f6539/lib/types/any.js#L92-L119
50,104
unijs/bundle
build/web/c0.js
getHref
function getHref() { return this.context.router.makeHref(this.props.to, this.props.params, this.props.query); }
javascript
function getHref() { return this.context.router.makeHref(this.props.to, this.props.params, this.props.query); }
[ "function", "getHref", "(", ")", "{", "return", "this", ".", "context", ".", "router", ".", "makeHref", "(", "this", ".", "props", ".", "to", ",", "this", ".", "props", ".", "params", ",", "this", ".", "props", ".", "query", ")", ";", "}" ]
Returns the value of the "href" attribute to use on the DOM element.
[ "Returns", "the", "value", "of", "the", "href", "attribute", "to", "use", "on", "the", "DOM", "element", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L217-L219
50,105
unijs/bundle
build/web/c0.js
makePath
function makePath(to, params, query) { return this.context.router.makePath(to, params, query); }
javascript
function makePath(to, params, query) { return this.context.router.makePath(to, params, query); }
[ "function", "makePath", "(", "to", ",", "params", ",", "query", ")", "{", "return", "this", ".", "context", ".", "router", ".", "makePath", "(", "to", ",", "params", ",", "query", ")", ";", "}" ]
Returns an absolute URL path created from the given route name, URL parameters, and query values.
[ "Returns", "an", "absolute", "URL", "path", "created", "from", "the", "given", "route", "name", "URL", "parameters", "and", "query", "values", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1073-L1075
50,106
unijs/bundle
build/web/c0.js
makeHref
function makeHref(to, params, query) { return this.context.router.makeHref(to, params, query); }
javascript
function makeHref(to, params, query) { return this.context.router.makeHref(to, params, query); }
[ "function", "makeHref", "(", "to", ",", "params", ",", "query", ")", "{", "return", "this", ".", "context", ".", "router", ".", "makeHref", "(", "to", ",", "params", ",", "query", ")", ";", "}" ]
Returns a string that may safely be used as the href of a link to the route with the given name.
[ "Returns", "a", "string", "that", "may", "safely", "be", "used", "as", "the", "href", "of", "a", "link", "to", "the", "route", "with", "the", "given", "name", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1081-L1083
50,107
unijs/bundle
build/web/c0.js
isActive
function isActive(to, params, query) { return this.context.router.isActive(to, params, query); }
javascript
function isActive(to, params, query) { return this.context.router.isActive(to, params, query); }
[ "function", "isActive", "(", "to", ",", "params", ",", "query", ")", "{", "return", "this", ".", "context", ".", "router", ".", "isActive", "(", "to", ",", "params", ",", "query", ")", ";", "}" ]
A helper method to determine if a given route, params, and query are active.
[ "A", "helper", "method", "to", "determine", "if", "a", "given", "route", "params", "and", "query", "are", "active", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1180-L1182
50,108
unijs/bundle
build/web/c0.js
appendChild
function appendChild(route) { invariant(route instanceof Route, 'route.appendChild must use a valid Route'); if (!this.childRoutes) this.childRoutes = []; this.childRoutes.push(route); }
javascript
function appendChild(route) { invariant(route instanceof Route, 'route.appendChild must use a valid Route'); if (!this.childRoutes) this.childRoutes = []; this.childRoutes.push(route); }
[ "function", "appendChild", "(", "route", ")", "{", "invariant", "(", "route", "instanceof", "Route", ",", "'route.appendChild must use a valid Route'", ")", ";", "if", "(", "!", "this", ".", "childRoutes", ")", "this", ".", "childRoutes", "=", "[", "]", ";", ...
Appends the given route to this route's child routes.
[ "Appends", "the", "given", "route", "to", "this", "route", "s", "child", "routes", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1223-L1229
50,109
unijs/bundle
build/web/c0.js
makePath
function makePath(to, params, query) { var path; if (PathUtils.isAbsolute(to)) { path = to; } else { var route = to instanceof Route ? to : Router.namedRoutes[to]; invariant(route instanceof Route, 'Cannot find a route named "%s"', to); path = route.path...
javascript
function makePath(to, params, query) { var path; if (PathUtils.isAbsolute(to)) { path = to; } else { var route = to instanceof Route ? to : Router.namedRoutes[to]; invariant(route instanceof Route, 'Cannot find a route named "%s"', to); path = route.path...
[ "function", "makePath", "(", "to", ",", "params", ",", "query", ")", "{", "var", "path", ";", "if", "(", "PathUtils", ".", "isAbsolute", "(", "to", ")", ")", "{", "path", "=", "to", ";", "}", "else", "{", "var", "route", "=", "to", "instanceof", ...
Returns an absolute URL path created from the given route name, URL parameters, and query.
[ "Returns", "an", "absolute", "URL", "path", "created", "from", "the", "given", "route", "name", "URL", "parameters", "and", "query", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1665-L1678
50,110
unijs/bundle
build/web/c0.js
makeHref
function makeHref(to, params, query) { var path = Router.makePath(to, params, query); return location === HashLocation ? '#' + path : path; }
javascript
function makeHref(to, params, query) { var path = Router.makePath(to, params, query); return location === HashLocation ? '#' + path : path; }
[ "function", "makeHref", "(", "to", ",", "params", ",", "query", ")", "{", "var", "path", "=", "Router", ".", "makePath", "(", "to", ",", "params", ",", "query", ")", ";", "return", "location", "===", "HashLocation", "?", "'#'", "+", "path", ":", "pat...
Returns a string that may safely be used as the href of a link to the route with the given name, URL parameters, and query.
[ "Returns", "a", "string", "that", "may", "safely", "be", "used", "as", "the", "href", "of", "a", "link", "to", "the", "route", "with", "the", "given", "name", "URL", "parameters", "and", "query", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1684-L1687
50,111
unijs/bundle
build/web/c0.js
goBack
function goBack() { if (History.length > 1 || location === RefreshLocation) { location.pop(); return true; } warning(false, 'goBack() was ignored because there is no router history'); return false; }
javascript
function goBack() { if (History.length > 1 || location === RefreshLocation) { location.pop(); return true; } warning(false, 'goBack() was ignored because there is no router history'); return false; }
[ "function", "goBack", "(", ")", "{", "if", "(", "History", ".", "length", ">", "1", "||", "location", "===", "RefreshLocation", ")", "{", "location", ".", "pop", "(", ")", ";", "return", "true", ";", "}", "warning", "(", "false", ",", "'goBack() was ig...
Transitions to the previous URL if one is available. Returns true if the router was able to go back, false otherwise. Note: The router only tracks history entries in your application, not the current browser session, so you can safely call this function without guarding against sending the user back to some other site...
[ "Transitions", "to", "the", "previous", "URL", "if", "one", "is", "available", ".", "Returns", "true", "if", "the", "router", "was", "able", "to", "go", "back", "false", "otherwise", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1723-L1732
50,112
unijs/bundle
build/web/c0.js
isActive
function isActive(to, params, query) { if (PathUtils.isAbsolute(to)) { return to === state.path; }return routeIsActive(state.routes, to) && paramsAreActive(state.params, params) && (query == null || queryIsActive(state.query, query)); }
javascript
function isActive(to, params, query) { if (PathUtils.isAbsolute(to)) { return to === state.path; }return routeIsActive(state.routes, to) && paramsAreActive(state.params, params) && (query == null || queryIsActive(state.query, query)); }
[ "function", "isActive", "(", "to", ",", "params", ",", "query", ")", "{", "if", "(", "PathUtils", ".", "isAbsolute", "(", "to", ")", ")", "{", "return", "to", "===", "state", ".", "path", ";", "}", "return", "routeIsActive", "(", "state", ".", "route...
Returns true if the given route, params, and query are active.
[ "Returns", "true", "if", "the", "given", "route", "params", "and", "query", "are", "active", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1935-L1939
50,113
unijs/bundle
build/web/c0.js
extractParams
function extractParams(pattern, path) { var _compilePattern = compilePattern(pattern); var matcher = _compilePattern.matcher; var paramNames = _compilePattern.paramNames; var match = path.match(matcher); if (!match) { return null; }var params = {}; paramNames.forEach(function (para...
javascript
function extractParams(pattern, path) { var _compilePattern = compilePattern(pattern); var matcher = _compilePattern.matcher; var paramNames = _compilePattern.paramNames; var match = path.match(matcher); if (!match) { return null; }var params = {}; paramNames.forEach(function (para...
[ "function", "extractParams", "(", "pattern", ",", "path", ")", "{", "var", "_compilePattern", "=", "compilePattern", "(", "pattern", ")", ";", "var", "matcher", "=", "_compilePattern", ".", "matcher", ";", "var", "paramNames", "=", "_compilePattern", ".", "par...
Extracts the portions of the given URL path that match the given pattern and returns an object of param name => value pairs. Returns null if the pattern does not match the given path.
[ "Extracts", "the", "portions", "of", "the", "given", "URL", "path", "that", "match", "the", "given", "pattern", "and", "returns", "an", "object", "of", "param", "name", "=", ">", "value", "pairs", ".", "Returns", "null", "if", "the", "pattern", "does", "...
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L2727-L2744
50,114
unijs/bundle
build/web/c0.js
injectParams
function injectParams(pattern, params) { params = params || {}; var splatIndex = 0; return pattern.replace(paramInjectMatcher, function (match, paramName) { paramName = paramName || 'splat'; // If param is optional don't check for existence if (paramName.slice(-1) === '?') { par...
javascript
function injectParams(pattern, params) { params = params || {}; var splatIndex = 0; return pattern.replace(paramInjectMatcher, function (match, paramName) { paramName = paramName || 'splat'; // If param is optional don't check for existence if (paramName.slice(-1) === '?') { par...
[ "function", "injectParams", "(", "pattern", ",", "params", ")", "{", "params", "=", "params", "||", "{", "}", ";", "var", "splatIndex", "=", "0", ";", "return", "pattern", ".", "replace", "(", "paramInjectMatcher", ",", "function", "(", "match", ",", "pa...
Returns a version of the given route path with params interpolated. Throws if there is a dynamic segment of the route path for which there is no param.
[ "Returns", "a", "version", "of", "the", "given", "route", "path", "with", "params", "interpolated", ".", "Throws", "if", "there", "is", "a", "dynamic", "segment", "of", "the", "route", "path", "for", "which", "there", "is", "no", "param", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L2750-L2778
50,115
unijs/bundle
build/web/c0.js
extractQuery
function extractQuery(path) { var match = path.match(queryMatcher); return match && qs.parse(match[1]); }
javascript
function extractQuery(path) { var match = path.match(queryMatcher); return match && qs.parse(match[1]); }
[ "function", "extractQuery", "(", "path", ")", "{", "var", "match", "=", "path", ".", "match", "(", "queryMatcher", ")", ";", "return", "match", "&&", "qs", ".", "parse", "(", "match", "[", "1", "]", ")", ";", "}" ]
Returns an object that is the result of parsing any query string contained in the given path, null if the path contains no query string.
[ "Returns", "an", "object", "that", "is", "the", "result", "of", "parsing", "any", "query", "string", "contained", "in", "the", "given", "path", "null", "if", "the", "path", "contains", "no", "query", "string", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L2784-L2787
50,116
unijs/bundle
build/web/c0.js
withQuery
function withQuery(path, query) { var existingQuery = PathUtils.extractQuery(path); if (existingQuery) query = query ? assign(existingQuery, query) : existingQuery; var queryString = qs.stringify(query, { arrayFormat: 'brackets' }); if (queryString) { return PathUtils.withoutQuery(path) + '?' +...
javascript
function withQuery(path, query) { var existingQuery = PathUtils.extractQuery(path); if (existingQuery) query = query ? assign(existingQuery, query) : existingQuery; var queryString = qs.stringify(query, { arrayFormat: 'brackets' }); if (queryString) { return PathUtils.withoutQuery(path) + '?' +...
[ "function", "withQuery", "(", "path", ",", "query", ")", "{", "var", "existingQuery", "=", "PathUtils", ".", "extractQuery", "(", "path", ")", ";", "if", "(", "existingQuery", ")", "query", "=", "query", "?", "assign", "(", "existingQuery", ",", "query", ...
Returns a version of the given path with the parameters in the given query merged into the query string.
[ "Returns", "a", "version", "of", "the", "given", "path", "with", "the", "parameters", "in", "the", "given", "query", "merged", "into", "the", "query", "string", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L2800-L2810
50,117
unijs/bundle
build/web/c0.js
Transition
function Transition(path, retry) { this.path = path; this.abortReason = null; // TODO: Change this to router.retryTransition(transition) this.retry = retry.bind(this); }
javascript
function Transition(path, retry) { this.path = path; this.abortReason = null; // TODO: Change this to router.retryTransition(transition) this.retry = retry.bind(this); }
[ "function", "Transition", "(", "path", ",", "retry", ")", "{", "this", ".", "path", "=", "path", ";", "this", ".", "abortReason", "=", "null", ";", "// TODO: Change this to router.retryTransition(transition)", "this", ".", "retry", "=", "retry", ".", "bind", "...
Encapsulates a transition to a given path. The willTransitionTo and willTransitionFrom handlers receive an instance of this class as their first argument.
[ "Encapsulates", "a", "transition", "to", "a", "given", "path", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L2922-L2927
50,118
unijs/bundle
build/web/c0.js
findMatch
function findMatch(routes, path) { var pathname = PathUtils.withoutQuery(path); var query = PathUtils.extractQuery(path); var match = null; for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query); return match; }
javascript
function findMatch(routes, path) { var pathname = PathUtils.withoutQuery(path); var query = PathUtils.extractQuery(path); var match = null; for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query); return match; }
[ "function", "findMatch", "(", "routes", ",", "path", ")", "{", "var", "pathname", "=", "PathUtils", ".", "withoutQuery", "(", "path", ")", ";", "var", "query", "=", "PathUtils", ".", "extractQuery", "(", "path", ")", ";", "var", "match", "=", "null", "...
Attempts to match depth-first a route in the given route's subtree against the given path and returns the match if it succeeds, null if no match can be made.
[ "Attempts", "to", "match", "depth", "-", "first", "a", "route", "in", "the", "given", "route", "s", "subtree", "against", "the", "given", "path", "and", "returns", "the", "match", "if", "it", "succeeds", "null", "if", "no", "match", "can", "be", "made", ...
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L3071-L3079
50,119
unijs/bundle
build/web/c0.js
bindAutoBindMethod
function bindAutoBindMethod(component, method) { var boundMethod = method.bind(component); if ("production" !== process.env.NODE_ENV) { boundMethod.__reactBoundContext = component; boundMethod.__reactBoundMethod = method; boundMethod.__reactBoundArguments = null; var componentName = component.constr...
javascript
function bindAutoBindMethod(component, method) { var boundMethod = method.bind(component); if ("production" !== process.env.NODE_ENV) { boundMethod.__reactBoundContext = component; boundMethod.__reactBoundMethod = method; boundMethod.__reactBoundArguments = null; var componentName = component.constr...
[ "function", "bindAutoBindMethod", "(", "component", ",", "method", ")", "{", "var", "boundMethod", "=", "method", ".", "bind", "(", "component", ")", ";", "if", "(", "\"production\"", "!==", "process", ".", "env", ".", "NODE_ENV", ")", "{", "boundMethod", ...
Binds a method to the component. @param {object} component Component whose method is going to be bound. @param {function} method Method to be bound. @return {function} The bound method.
[ "Binds", "a", "method", "to", "the", "component", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L4280-L4319
50,120
unijs/bundle
build/web/c0.js
function(type, key, ref, owner, context, props) { // Built-in properties that belong on the element this.type = type; this.key = key; this.ref = ref; // Record the component responsible for creating this element. this._owner = owner; // TODO: Deprecate withContext, and then the context becomes accessibl...
javascript
function(type, key, ref, owner, context, props) { // Built-in properties that belong on the element this.type = type; this.key = key; this.ref = ref; // Record the component responsible for creating this element. this._owner = owner; // TODO: Deprecate withContext, and then the context becomes accessibl...
[ "function", "(", "type", ",", "key", ",", "ref", ",", "owner", ",", "context", ",", "props", ")", "{", "// Built-in properties that belong on the element", "this", ".", "type", "=", "type", ";", "this", ".", "key", "=", "key", ";", "this", ".", "ref", "=...
Base constructor for all React elements. This is only used to make this work with a dynamic instanceof check. Nothing should live on this prototype. @param {*} type @param {string|object} ref @param {*} key @param {*} props @internal
[ "Base", "constructor", "for", "all", "React", "elements", ".", "This", "is", "only", "used", "to", "make", "this", "work", "with", "a", "dynamic", "instanceof", "check", ".", "Nothing", "should", "live", "on", "this", "prototype", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L4780-L4824
50,121
unijs/bundle
build/web/c0.js
getName
function getName(instance) { var publicInstance = instance && instance.getPublicInstance(); if (!publicInstance) { return undefined; } var constructor = publicInstance.constructor; if (!constructor) { return undefined; } return constructor.displayName || constructor.name || undefined; }
javascript
function getName(instance) { var publicInstance = instance && instance.getPublicInstance(); if (!publicInstance) { return undefined; } var constructor = publicInstance.constructor; if (!constructor) { return undefined; } return constructor.displayName || constructor.name || undefined; }
[ "function", "getName", "(", "instance", ")", "{", "var", "publicInstance", "=", "instance", "&&", "instance", ".", "getPublicInstance", "(", ")", ";", "if", "(", "!", "publicInstance", ")", "{", "return", "undefined", ";", "}", "var", "constructor", "=", "...
Gets the instance's name for use in warnings. @internal @return {?string} Display name or undefined
[ "Gets", "the", "instance", "s", "name", "for", "use", "in", "warnings", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5053-L5063
50,122
unijs/bundle
build/web/c0.js
validateExplicitKey
function validateExplicitKey(element, parentType) { if (element._store.validated || element.key != null) { return; } element._store.validated = true; warnAndMonitorForKeyUse( 'Each child in an array or iterator should have a unique "key" prop.', element, parentType ); }
javascript
function validateExplicitKey(element, parentType) { if (element._store.validated || element.key != null) { return; } element._store.validated = true; warnAndMonitorForKeyUse( 'Each child in an array or iterator should have a unique "key" prop.', element, parentType ); }
[ "function", "validateExplicitKey", "(", "element", ",", "parentType", ")", "{", "if", "(", "element", ".", "_store", ".", "validated", "||", "element", ".", "key", "!=", "null", ")", "{", "return", ";", "}", "element", ".", "_store", ".", "validated", "=...
Warn if the element doesn't have an explicit key assigned to it. This element is in an array. The array could grow and shrink or be reordered. All children that haven't already been validated are required to have a "key" property assigned to it. @internal @param {ReactElement} element Element that requires a key. @par...
[ "Warn", "if", "the", "element", "doesn", "t", "have", "an", "explicit", "key", "assigned", "to", "it", ".", "This", "element", "is", "in", "an", "array", ".", "The", "array", "could", "grow", "and", "shrink", "or", "be", "reordered", ".", "All", "child...
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5088-L5099
50,123
unijs/bundle
build/web/c0.js
validatePropertyKey
function validatePropertyKey(name, element, parentType) { if (!NUMERIC_PROPERTY_REGEX.test(name)) { return; } warnAndMonitorForKeyUse( 'Child objects should have non-numeric keys so ordering is preserved.', element, parentType ); }
javascript
function validatePropertyKey(name, element, parentType) { if (!NUMERIC_PROPERTY_REGEX.test(name)) { return; } warnAndMonitorForKeyUse( 'Child objects should have non-numeric keys so ordering is preserved.', element, parentType ); }
[ "function", "validatePropertyKey", "(", "name", ",", "element", ",", "parentType", ")", "{", "if", "(", "!", "NUMERIC_PROPERTY_REGEX", ".", "test", "(", "name", ")", ")", "{", "return", ";", "}", "warnAndMonitorForKeyUse", "(", "'Child objects should have non-nume...
Warn if the key is being defined as an object property but has an incorrect value. @internal @param {string} name Property name of the key. @param {ReactElement} element Component that requires a key. @param {*} parentType element's parent's type.
[ "Warn", "if", "the", "key", "is", "being", "defined", "as", "an", "object", "property", "but", "has", "an", "incorrect", "value", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5110-L5119
50,124
unijs/bundle
build/web/c0.js
warnAndMonitorForKeyUse
function warnAndMonitorForKeyUse(message, element, parentType) { var ownerName = getCurrentOwnerDisplayName(); var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; var useName = ownerName || parentName; var memoizer = ownerHasKeyUseWarning[message] || ( ...
javascript
function warnAndMonitorForKeyUse(message, element, parentType) { var ownerName = getCurrentOwnerDisplayName(); var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; var useName = ownerName || parentName; var memoizer = ownerHasKeyUseWarning[message] || ( ...
[ "function", "warnAndMonitorForKeyUse", "(", "message", ",", "element", ",", "parentType", ")", "{", "var", "ownerName", "=", "getCurrentOwnerDisplayName", "(", ")", ";", "var", "parentName", "=", "typeof", "parentType", "===", "'string'", "?", "parentType", ":", ...
Shared warning and monitoring code for the key warnings. @internal @param {string} message The base warning that gets output. @param {ReactElement} element Component that requires a key. @param {*} parentType element's parent's type.
[ "Shared", "warning", "and", "monitoring", "code", "for", "the", "key", "warnings", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5129-L5167
50,125
unijs/bundle
build/web/c0.js
validateChildKeys
function validateChildKeys(node, parentType) { if (Array.isArray(node)) { for (var i = 0; i < node.length; i++) { var child = node[i]; if (ReactElement.isValidElement(child)) { validateExplicitKey(child, parentType); } } } else if (ReactElement.isValidElement(node)) { // This e...
javascript
function validateChildKeys(node, parentType) { if (Array.isArray(node)) { for (var i = 0; i < node.length; i++) { var child = node[i]; if (ReactElement.isValidElement(child)) { validateExplicitKey(child, parentType); } } } else if (ReactElement.isValidElement(node)) { // This e...
[ "function", "validateChildKeys", "(", "node", ",", "parentType", ")", "{", "if", "(", "Array", ".", "isArray", "(", "node", ")", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "node", ".", "length", ";", "i", "++", ")", "{", "var", ...
Ensure that every element either is passed in a static location, in an array with an explicit keys property defined, or in an object literal with valid key property. @internal @param {ReactNode} node Statically passed child of any type. @param {*} parentType node's parent's type.
[ "Ensure", "that", "every", "element", "either", "is", "passed", "in", "a", "static", "location", "in", "an", "array", "with", "an", "explicit", "keys", "property", "defined", "or", "in", "an", "object", "literal", "with", "valid", "key", "property", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5178-L5211
50,126
unijs/bundle
build/web/c0.js
is
function is(a, b) { if (a !== a) { // NaN return b !== b; } if (a === 0 && b === 0) { // +-0 return 1 / a === 1 / b; } return a === b; }
javascript
function is(a, b) { if (a !== a) { // NaN return b !== b; } if (a === 0 && b === 0) { // +-0 return 1 / a === 1 / b; } return a === b; }
[ "function", "is", "(", "a", ",", "b", ")", "{", "if", "(", "a", "!==", "a", ")", "{", "// NaN", "return", "b", "!==", "b", ";", "}", "if", "(", "a", "===", "0", "&&", "b", "===", "0", ")", "{", "// +-0", "return", "1", "/", "a", "===", "1...
Inline Object.is polyfill
[ "Inline", "Object", ".", "is", "polyfill" ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5297-L5307
50,127
unijs/bundle
build/web/c0.js
isValidID
function isValidID(id) { return id === '' || ( id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR ); }
javascript
function isValidID(id) { return id === '' || ( id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR ); }
[ "function", "isValidID", "(", "id", ")", "{", "return", "id", "===", "''", "||", "(", "id", ".", "charAt", "(", "0", ")", "===", "SEPARATOR", "&&", "id", ".", "charAt", "(", "id", ".", "length", "-", "1", ")", "!==", "SEPARATOR", ")", ";", "}" ]
Checks if the supplied string is a valid React DOM ID. @param {string} id A React DOM ID, maybe. @return {boolean} True if the string is a valid React DOM ID. @private
[ "Checks", "if", "the", "supplied", "string", "is", "a", "valid", "React", "DOM", "ID", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5969-L5973
50,128
unijs/bundle
build/web/c0.js
isAncestorIDOf
function isAncestorIDOf(ancestorID, descendantID) { return ( descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length) ); }
javascript
function isAncestorIDOf(ancestorID, descendantID) { return ( descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length) ); }
[ "function", "isAncestorIDOf", "(", "ancestorID", ",", "descendantID", ")", "{", "return", "(", "descendantID", ".", "indexOf", "(", "ancestorID", ")", "===", "0", "&&", "isBoundary", "(", "descendantID", ",", "ancestorID", ".", "length", ")", ")", ";", "}" ]
Checks if the first ID is an ancestor of or equal to the second ID. @param {string} ancestorID @param {string} descendantID @return {boolean} True if `ancestorID` is an ancestor of `descendantID`. @internal
[ "Checks", "if", "the", "first", "ID", "is", "an", "ancestor", "of", "or", "equal", "to", "the", "second", "ID", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5983-L5988
50,129
unijs/bundle
build/web/c0.js
function(nextComponent, container) { ("production" !== process.env.NODE_ENV ? invariant( container && ( (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE) ), '_registerComponent(...): Target container is not a DOM element.' ) : invariant(container && ( ...
javascript
function(nextComponent, container) { ("production" !== process.env.NODE_ENV ? invariant( container && ( (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE) ), '_registerComponent(...): Target container is not a DOM element.' ) : invariant(container && ( ...
[ "function", "(", "nextComponent", ",", "container", ")", "{", "(", "\"production\"", "!==", "process", ".", "env", ".", "NODE_ENV", "?", "invariant", "(", "container", "&&", "(", "(", "container", ".", "nodeType", "===", "ELEMENT_NODE_TYPE", "||", "container",...
Register a component into the instance map and starts scroll value monitoring @param {ReactComponent} nextComponent component instance to render @param {DOMElement} container container to render into @return {string} reactRoot ID prefix
[ "Register", "a", "component", "into", "the", "instance", "map", "and", "starts", "scroll", "value", "monitoring" ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L6601-L6616
50,130
unijs/bundle
build/web/c0.js
function( nextElement, container, shouldReuseMarkup ) { // Various parts of our code (such as ReactCompositeComponent's // _renderValidatedComponent) assume that calls to render aren't nested; // verify that that's the case. ("production" !== process.env.NODE_ENV ? warning( ReactCurr...
javascript
function( nextElement, container, shouldReuseMarkup ) { // Various parts of our code (such as ReactCompositeComponent's // _renderValidatedComponent) assume that calls to render aren't nested; // verify that that's the case. ("production" !== process.env.NODE_ENV ? warning( ReactCurr...
[ "function", "(", "nextElement", ",", "container", ",", "shouldReuseMarkup", ")", "{", "// Various parts of our code (such as ReactCompositeComponent's", "// _renderValidatedComponent) assume that calls to render aren't nested;", "// verify that that's the case.", "(", "\"production\"", "...
Render a new component into the DOM. @param {ReactElement} nextElement element to render @param {DOMElement} container container to render into @param {boolean} shouldReuseMarkup if we should skip the markup insertion @return {ReactComponent} nextComponent
[ "Render", "a", "new", "component", "into", "the", "DOM", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L6625-L6666
50,131
unijs/bundle
build/web/c0.js
function(constructor, props, container) { var element = ReactElement.createElement(constructor, props); return ReactMount.render(element, container); }
javascript
function(constructor, props, container) { var element = ReactElement.createElement(constructor, props); return ReactMount.render(element, container); }
[ "function", "(", "constructor", ",", "props", ",", "container", ")", "{", "var", "element", "=", "ReactElement", ".", "createElement", "(", "constructor", ",", "props", ")", ";", "return", "ReactMount", ".", "render", "(", "element", ",", "container", ")", ...
Constructs a component instance of `constructor` with `initialProps` and renders it into the supplied `container`. @param {function} constructor React component constructor. @param {?object} props Initial props of the component instance. @param {DOMElement} container DOM element to render into. @return {ReactComponent...
[ "Constructs", "a", "component", "instance", "of", "constructor", "with", "initialProps", "and", "renders", "it", "into", "the", "supplied", "container", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L6760-L6763
50,132
unijs/bundle
build/web/c0.js
function(id) { var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id); var container = containersByReactRootID[reactRootID]; if ("production" !== process.env.NODE_ENV) { var rootElement = rootElementsByReactRootID[reactRootID]; if (rootElement && rootElement.parentNode !== containe...
javascript
function(id) { var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id); var container = containersByReactRootID[reactRootID]; if ("production" !== process.env.NODE_ENV) { var rootElement = rootElementsByReactRootID[reactRootID]; if (rootElement && rootElement.parentNode !== containe...
[ "function", "(", "id", ")", "{", "var", "reactRootID", "=", "ReactInstanceHandles", ".", "getReactRootIDFromNodeID", "(", "id", ")", ";", "var", "container", "=", "containersByReactRootID", "[", "reactRootID", "]", ";", "if", "(", "\"production\"", "!==", "proce...
Finds the container DOM element that contains React component to which the supplied DOM `id` belongs. @param {string} id The ID of an element rendered by a React component. @return {?DOMElement} DOM element that contains the `id`.
[ "Finds", "the", "container", "DOM", "element", "that", "contains", "React", "component", "to", "which", "the", "supplied", "DOM", "id", "belongs", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L6878-L6913
50,133
unijs/bundle
build/web/c0.js
function(node) { if (node.nodeType !== 1) { // Not a DOMElement, therefore not a React component return false; } var id = ReactMount.getID(node); return id ? id.charAt(0) === SEPARATOR : false; }
javascript
function(node) { if (node.nodeType !== 1) { // Not a DOMElement, therefore not a React component return false; } var id = ReactMount.getID(node); return id ? id.charAt(0) === SEPARATOR : false; }
[ "function", "(", "node", ")", "{", "if", "(", "node", ".", "nodeType", "!==", "1", ")", "{", "// Not a DOMElement, therefore not a React component", "return", "false", ";", "}", "var", "id", "=", "ReactMount", ".", "getID", "(", "node", ")", ";", "return", ...
True if the supplied `node` is rendered by React. @param {*} node DOM Element to check. @return {boolean} True if the DOM Element appears to be rendered by React. @internal
[ "True", "if", "the", "supplied", "node", "is", "rendered", "by", "React", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L6933-L6940
50,134
unijs/bundle
build/web/c0.js
function(node) { var current = node; while (current && current.parentNode !== current) { if (ReactMount.isRenderedByReact(current)) { return current; } current = current.parentNode; } return null; }
javascript
function(node) { var current = node; while (current && current.parentNode !== current) { if (ReactMount.isRenderedByReact(current)) { return current; } current = current.parentNode; } return null; }
[ "function", "(", "node", ")", "{", "var", "current", "=", "node", ";", "while", "(", "current", "&&", "current", ".", "parentNode", "!==", "current", ")", "{", "if", "(", "ReactMount", ".", "isRenderedByReact", "(", "current", ")", ")", "{", "return", ...
Traverses up the ancestors of the supplied node to find a node that is a DOM representation of a React component. @param {*} node @return {?DOMEventTarget} @internal
[ "Traverses", "up", "the", "ancestors", "of", "the", "supplied", "node", "to", "find", "a", "node", "that", "is", "a", "DOM", "representation", "of", "a", "React", "component", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L6950-L6959
50,135
unijs/bundle
build/web/c0.js
function(publicInstance, partialProps) { var internalInstance = getInternalInstanceReadyForUpdate( publicInstance, 'setProps' ); if (!internalInstance) { return; } ("production" !== process.env.NODE_ENV ? invariant( internalInstance._isTopLevel, 'setProps(...): You ca...
javascript
function(publicInstance, partialProps) { var internalInstance = getInternalInstanceReadyForUpdate( publicInstance, 'setProps' ); if (!internalInstance) { return; } ("production" !== process.env.NODE_ENV ? invariant( internalInstance._isTopLevel, 'setProps(...): You ca...
[ "function", "(", "publicInstance", ",", "partialProps", ")", "{", "var", "internalInstance", "=", "getInternalInstanceReadyForUpdate", "(", "publicInstance", ",", "'setProps'", ")", ";", "if", "(", "!", "internalInstance", ")", "{", "return", ";", "}", "(", "\"p...
Sets a subset of the props. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialProps Subset of the next props. @internal
[ "Sets", "a", "subset", "of", "the", "props", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L8973-L9003
50,136
unijs/bundle
build/web/c0.js
function(transaction, prevElement, nextElement, context) { assertValidProps(this._currentElement.props); this._updateDOMProperties(prevElement.props, transaction); this._updateDOMChildren(prevElement.props, transaction, context); }
javascript
function(transaction, prevElement, nextElement, context) { assertValidProps(this._currentElement.props); this._updateDOMProperties(prevElement.props, transaction); this._updateDOMChildren(prevElement.props, transaction, context); }
[ "function", "(", "transaction", ",", "prevElement", ",", "nextElement", ",", "context", ")", "{", "assertValidProps", "(", "this", ".", "_currentElement", ".", "props", ")", ";", "this", ".", "_updateDOMProperties", "(", "prevElement", ".", "props", ",", "tran...
Updates a native DOM component after it has already been allocated and attached to the DOM. Reconciles the root DOM node, then recurses. @param {ReactReconcileTransaction} transaction @param {ReactElement} prevElement @param {ReactElement} nextElement @internal @overridable
[ "Updates", "a", "native", "DOM", "component", "after", "it", "has", "already", "been", "allocated", "and", "attached", "to", "the", "DOM", ".", "Reconciles", "the", "root", "DOM", "node", "then", "recurses", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L9699-L9703
50,137
unijs/bundle
build/web/c0.js
isNode
function isNode(object) { return !!(object && ( ((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')) )); }
javascript
function isNode(object) { return !!(object && ( ((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')) )); }
[ "function", "isNode", "(", "object", ")", "{", "return", "!", "!", "(", "object", "&&", "(", "(", "(", "typeof", "Node", "===", "'function'", "?", "object", "instanceof", "Node", ":", "typeof", "object", "===", "'object'", "&&", "typeof", "object", ".", ...
Copyright 2013-2015, Facebook, Inc. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory. @providesModule isNode @typechecks @para...
[ "Copyright", "2013", "-", "2015", "Facebook", "Inc", ".", "All", "rights", "reserved", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L10205-L10211
50,138
unijs/bundle
build/web/c0.js
function(id, name, value) { var node = ReactMount.getNode(id); ("production" !== process.env.NODE_ENV ? invariant( !INVALID_PROPERTY_ERRORS.hasOwnProperty(name), 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name] ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name))); ...
javascript
function(id, name, value) { var node = ReactMount.getNode(id); ("production" !== process.env.NODE_ENV ? invariant( !INVALID_PROPERTY_ERRORS.hasOwnProperty(name), 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name] ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name))); ...
[ "function", "(", "id", ",", "name", ",", "value", ")", "{", "var", "node", "=", "ReactMount", ".", "getNode", "(", "id", ")", ";", "(", "\"production\"", "!==", "process", ".", "env", ".", "NODE_ENV", "?", "invariant", "(", "!", "INVALID_PROPERTY_ERRORS"...
Updates a DOM node with new property values. This should only be used to update DOM properties in `DOMProperty`. @param {string} id ID of the node to update. @param {string} name A valid property name, see `DOMProperty`. @param {*} value New value of the property. @internal
[ "Updates", "a", "DOM", "node", "with", "new", "property", "values", ".", "This", "should", "only", "be", "used", "to", "update", "DOM", "properties", "in", "DOMProperty", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L10895-L10911
50,139
unijs/bundle
build/web/c0.js
function(id, styles) { var node = ReactMount.getNode(id); CSSPropertyOperations.setValueForStyles(node, styles); }
javascript
function(id, styles) { var node = ReactMount.getNode(id); CSSPropertyOperations.setValueForStyles(node, styles); }
[ "function", "(", "id", ",", "styles", ")", "{", "var", "node", "=", "ReactMount", ".", "getNode", "(", "id", ")", ";", "CSSPropertyOperations", ".", "setValueForStyles", "(", "node", ",", "styles", ")", ";", "}" ]
Updates a DOM node with new style values. If a value is specified as '', the corresponding style property will be unset. @param {string} id ID of the node to update. @param {object} styles Mapping from styles to values. @internal
[ "Updates", "a", "DOM", "node", "with", "new", "style", "values", ".", "If", "a", "value", "is", "specified", "as", "the", "corresponding", "style", "property", "will", "be", "unset", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L10939-L10942
50,140
unijs/bundle
build/web/c0.js
function(id, content) { var node = ReactMount.getNode(id); DOMChildrenOperations.updateTextContent(node, content); }
javascript
function(id, content) { var node = ReactMount.getNode(id); DOMChildrenOperations.updateTextContent(node, content); }
[ "function", "(", "id", ",", "content", ")", "{", "var", "node", "=", "ReactMount", ".", "getNode", "(", "id", ")", ";", "DOMChildrenOperations", ".", "updateTextContent", "(", "node", ",", "content", ")", ";", "}" ]
Updates a DOM node's text content set by `props.content`. @param {string} id ID of the node to update. @param {string} content Text content. @internal
[ "Updates", "a", "DOM", "node", "s", "text", "content", "set", "by", "props", ".", "content", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L10963-L10966
50,141
unijs/bundle
build/web/c0.js
insertChildAt
function insertChildAt(parentNode, childNode, index) { // By exploiting arrays returning `undefined` for an undefined index, we can // rely exclusively on `insertBefore(node, null)` instead of also using // `appendChild(node)`. However, using `undefined` is not allowed by all // browsers so we must replace it w...
javascript
function insertChildAt(parentNode, childNode, index) { // By exploiting arrays returning `undefined` for an undefined index, we can // rely exclusively on `insertBefore(node, null)` instead of also using // `appendChild(node)`. However, using `undefined` is not allowed by all // browsers so we must replace it w...
[ "function", "insertChildAt", "(", "parentNode", ",", "childNode", ",", "index", ")", "{", "// By exploiting arrays returning `undefined` for an undefined index, we can", "// rely exclusively on `insertBefore(node, null)` instead of also using", "// `appendChild(node)`. However, using `undefi...
Inserts `childNode` as a child of `parentNode` at the `index`. @param {DOMElement} parentNode Parent node in which to insert. @param {DOMElement} childNode Child node to insert. @param {number} index Index at which to insert the child. @internal
[ "Inserts", "childNode", "as", "a", "child", "of", "parentNode", "at", "the", "index", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L11933-L11942
50,142
unijs/bundle
build/web/c0.js
findParent
function findParent(node) { // TODO: It may be a good idea to cache this to prevent unnecessary DOM // traversal, but caching is difficult to do correctly without using a // mutation observer to listen for all DOM changes. var nodeID = ReactMount.getID(node); var rootID = ReactInstanceHandles.getReactRootIDFr...
javascript
function findParent(node) { // TODO: It may be a good idea to cache this to prevent unnecessary DOM // traversal, but caching is difficult to do correctly without using a // mutation observer to listen for all DOM changes. var nodeID = ReactMount.getID(node); var rootID = ReactInstanceHandles.getReactRootIDFr...
[ "function", "findParent", "(", "node", ")", "{", "// TODO: It may be a good idea to cache this to prevent unnecessary DOM", "// traversal, but caching is difficult to do correctly without using a", "// mutation observer to listen for all DOM changes.", "var", "nodeID", "=", "ReactMount", "...
Finds the parent React component of `node`. @param {*} node @return {?DOMEventTarget} Parent container, or `null` if the specified node is not nested.
[ "Finds", "the", "parent", "React", "component", "of", "node", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L15626-L15635
50,143
unijs/bundle
build/web/c0.js
function() { CallbackQueue.release(this.reactMountReady); this.reactMountReady = null; ReactPutListenerQueue.release(this.putListenerQueue); this.putListenerQueue = null; }
javascript
function() { CallbackQueue.release(this.reactMountReady); this.reactMountReady = null; ReactPutListenerQueue.release(this.putListenerQueue); this.putListenerQueue = null; }
[ "function", "(", ")", "{", "CallbackQueue", ".", "release", "(", "this", ".", "reactMountReady", ")", ";", "this", ".", "reactMountReady", "=", "null", ";", "ReactPutListenerQueue", ".", "release", "(", "this", ".", "putListenerQueue", ")", ";", "this", ".",...
`PooledClass` looks for this, and will invoke this before allowing this instance to be resused.
[ "PooledClass", "looks", "for", "this", "and", "will", "invoke", "this", "before", "allowing", "this", "instance", "to", "be", "resused", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L15980-L15986
50,144
unijs/bundle
build/web/c0.js
isInternalComponentType
function isInternalComponentType(type) { return ( typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function' ); }
javascript
function isInternalComponentType(type) { return ( typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function' ); }
[ "function", "isInternalComponentType", "(", "type", ")", "{", "return", "(", "typeof", "type", "===", "'function'", "&&", "typeof", "type", ".", "prototype", "!==", "'undefined'", "&&", "typeof", "type", ".", "prototype", ".", "mountComponent", "===", "'function...
Check if the type reference is a known internal type. I.e. not a user provided composite type. @param {function} type @return {boolean} Returns true if this is a valid internal type.
[ "Check", "if", "the", "type", "reference", "is", "a", "known", "internal", "type", ".", "I", ".", "e", ".", "not", "a", "user", "provided", "composite", "type", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L18573-L18580
50,145
unijs/bundle
build/web/c0.js
enqueueMarkup
function enqueueMarkup(parentID, markup, toIndex) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.INSERT_MARKUP, markupIndex: markupQueue.push(markup) - 1, textContent: null, fromIndex: null, toIndex:...
javascript
function enqueueMarkup(parentID, markup, toIndex) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.INSERT_MARKUP, markupIndex: markupQueue.push(markup) - 1, textContent: null, fromIndex: null, toIndex:...
[ "function", "enqueueMarkup", "(", "parentID", ",", "markup", ",", "toIndex", ")", "{", "// NOTE: Null values reduce hidden classes.", "updateQueue", ".", "push", "(", "{", "parentID", ":", "parentID", ",", "parentNode", ":", "null", ",", "type", ":", "ReactMultiCh...
Enqueues markup to be rendered and inserted at a supplied index. @param {string} parentID ID of the parent component. @param {string} markup Markup that renders into an element. @param {number} toIndex Destination index. @private
[ "Enqueues", "markup", "to", "be", "rendered", "and", "inserted", "at", "a", "supplied", "index", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L18943-L18954
50,146
unijs/bundle
build/web/c0.js
function(nextNestedChildren, transaction, context) { updateDepth++; var errorThrown = true; try { this._updateChildren(nextNestedChildren, transaction, context); errorThrown = false; } finally { updateDepth--; if (!updateDepth) { if (errorThrown) { ...
javascript
function(nextNestedChildren, transaction, context) { updateDepth++; var errorThrown = true; try { this._updateChildren(nextNestedChildren, transaction, context); errorThrown = false; } finally { updateDepth--; if (!updateDepth) { if (errorThrown) { ...
[ "function", "(", "nextNestedChildren", ",", "transaction", ",", "context", ")", "{", "updateDepth", "++", ";", "var", "errorThrown", "=", "true", ";", "try", "{", "this", ".", "_updateChildren", "(", "nextNestedChildren", ",", "transaction", ",", "context", ")...
Updates the rendered children with new children. @param {?object} nextNestedChildren Nested child maps. @param {ReactReconcileTransaction} transaction @internal
[ "Updates", "the", "rendered", "children", "with", "new", "children", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L19134-L19151
50,147
unijs/bundle
build/web/c0.js
adler32
function adler32(data) { var a = 1; var b = 0; for (var i = 0; i < data.length; i++) { a = (a + data.charCodeAt(i)) % MOD; b = (b + a) % MOD; } return a | (b << 16); }
javascript
function adler32(data) { var a = 1; var b = 0; for (var i = 0; i < data.length; i++) { a = (a + data.charCodeAt(i)) % MOD; b = (b + a) % MOD; } return a | (b << 16); }
[ "function", "adler32", "(", "data", ")", "{", "var", "a", "=", "1", ";", "var", "b", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "data", ".", "length", ";", "i", "++", ")", "{", "a", "=", "(", "a", "+", "data", ".", ...
This is a clean-room implementation of adler32 designed for detecting if markup is not what we expect it to be. It does not need to be cryptographically strong, only reasonably good at detecting if markup generated on the server is different than that on the client.
[ "This", "is", "a", "clean", "-", "room", "implementation", "of", "adler32", "designed", "for", "detecting", "if", "markup", "is", "not", "what", "we", "expect", "it", "to", "be", ".", "It", "does", "not", "need", "to", "be", "cryptographically", "strong", ...
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L20963-L20971
50,148
unijs/bundle
build/web/c0.js
function(partialProps, callback) { // This is a deoptimized path. We optimize for always having an element. // This creates an extra internal element. var element = this._pendingElement || this._currentElement; this._pendingElement = ReactElement.cloneAndReplaceProps( element, assign({}, ele...
javascript
function(partialProps, callback) { // This is a deoptimized path. We optimize for always having an element. // This creates an extra internal element. var element = this._pendingElement || this._currentElement; this._pendingElement = ReactElement.cloneAndReplaceProps( element, assign({}, ele...
[ "function", "(", "partialProps", ",", "callback", ")", "{", "// This is a deoptimized path. We optimize for always having an element.", "// This creates an extra internal element.", "var", "element", "=", "this", ".", "_pendingElement", "||", "this", ".", "_currentElement", ";"...
Schedule a partial update to the props. Only used for internal testing. @param {object} partialProps Subset of the next props. @param {?function} callback Called after props are updated. @final @internal
[ "Schedule", "a", "partial", "update", "to", "the", "props", ".", "Only", "used", "for", "internal", "testing", "." ]
15f627df9d8c83a59d3e613f68ef4769f15569fc
https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L21595-L21604
50,149
Nazariglez/perenquen
lib/pixi/src/core/graphics/Graphics.js
Graphics
function Graphics() { Container.call(this); /** * The alpha value used when filling the Graphics object. * * @member {number} * @default 1 */ this.fillAlpha = 1; /** * The width (thickness) of any lines drawn. * * @member {number} * @default 0 */ t...
javascript
function Graphics() { Container.call(this); /** * The alpha value used when filling the Graphics object. * * @member {number} * @default 1 */ this.fillAlpha = 1; /** * The width (thickness) of any lines drawn. * * @member {number} * @default 0 */ t...
[ "function", "Graphics", "(", ")", "{", "Container", ".", "call", "(", "this", ")", ";", "/**\n * The alpha value used when filling the Graphics object.\n *\n * @member {number}\n * @default 1\n */", "this", ".", "fillAlpha", "=", "1", ";", "/**\n * The w...
The Graphics class contains methods used to draw primitive shapes such as lines, circles and rectangles to the display, and to color and fill them. @class @extends Container @memberof PIXI
[ "The", "Graphics", "class", "contains", "methods", "used", "to", "draw", "primitive", "shapes", "such", "as", "lines", "circles", "and", "rectangles", "to", "the", "display", "and", "to", "color", "and", "fill", "them", "." ]
e023964d05afeefebdcac4e2044819fdfa3899ae
https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/graphics/Graphics.js#L19-L146
50,150
linyngfly/omelo-rpc
lib/rpc-client/mailstation.js
function(opts) { EventEmitter.call(this); this.opts = opts; this.servers = {}; // remote server info map, key: server id, value: info this.serversMap = {}; // remote server info map, key: serverType, value: servers array this.onlines = {}; // remote server online map, key: server id, value: 0/offline 1/online...
javascript
function(opts) { EventEmitter.call(this); this.opts = opts; this.servers = {}; // remote server info map, key: server id, value: info this.serversMap = {}; // remote server info map, key: serverType, value: servers array this.onlines = {}; // remote server online map, key: server id, value: 0/offline 1/online...
[ "function", "(", "opts", ")", "{", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "opts", "=", "opts", ";", "this", ".", "servers", "=", "{", "}", ";", "// remote server info map, key: server id, value: info", "this", ".", "serversMap", "="...
station has closed Mail station constructor. @param {Object} opts construct parameters
[ "station", "has", "closed", "Mail", "station", "constructor", "." ]
a8d64a4f098f1d174550f0f648d5ccc7716624b8
https://github.com/linyngfly/omelo-rpc/blob/a8d64a4f098f1d174550f0f648d5ccc7716624b8/lib/rpc-client/mailstation.js#L18-L41
50,151
integreat-io/integreat-adapter-couchdb
lib/adapters/couchdb.js
couchdb
function couchdb (json) { return { prepareEndpoint (endpointOptions, sourceOptions) { return prepareEndpoint(json, endpointOptions, sourceOptions) }, async send (request) { return send(json, request) }, async serialize (data, request) { const serializedData = await serializeDat...
javascript
function couchdb (json) { return { prepareEndpoint (endpointOptions, sourceOptions) { return prepareEndpoint(json, endpointOptions, sourceOptions) }, async send (request) { return send(json, request) }, async serialize (data, request) { const serializedData = await serializeDat...
[ "function", "couchdb", "(", "json", ")", "{", "return", "{", "prepareEndpoint", "(", "endpointOptions", ",", "sourceOptions", ")", "{", "return", "prepareEndpoint", "(", "json", ",", "endpointOptions", ",", "sourceOptions", ")", "}", ",", "async", "send", "(",...
Wrap json adapter to provide adjustments for couchdb. @param {Object} json - The json adapter @returns {Object} The couchdb adapter
[ "Wrap", "json", "adapter", "to", "provide", "adjustments", "for", "couchdb", "." ]
e792aaa3e85c5dae41959bc449ed3b0e149f7ebf
https://github.com/integreat-io/integreat-adapter-couchdb/blob/e792aaa3e85c5dae41959bc449ed3b0e149f7ebf/lib/adapters/couchdb.js#L11-L31
50,152
PropellerHealth/asthma-forecast-sdk-node
index.js
function(zip, callback) { var queryString = "?postalCode="+zip; httpGet(queryString, function(err, results) { callback(err, results); }); }
javascript
function(zip, callback) { var queryString = "?postalCode="+zip; httpGet(queryString, function(err, results) { callback(err, results); }); }
[ "function", "(", "zip", ",", "callback", ")", "{", "var", "queryString", "=", "\"?postalCode=\"", "+", "zip", ";", "httpGet", "(", "queryString", ",", "function", "(", "err", ",", "results", ")", "{", "callback", "(", "err", ",", "results", ")", ";", "...
callback for getForecastByZipCode @callback module:asthma-forecast/client~getForecastByZipCodeCallback @param {Object} [err] error calling Propeller API @param {Object} [result] forecast getForecastByZipCode @param {String} options.zipCode Zip code @param {module:asthma-forecast/client~getForecastByZipCodeCallback} [...
[ "callback", "for", "getForecastByZipCode" ]
683611c2b1ea89d644afcc2ff0e2bbb0a4e4dd05
https://github.com/PropellerHealth/asthma-forecast-sdk-node/blob/683611c2b1ea89d644afcc2ff0e2bbb0a4e4dd05/index.js#L69-L76
50,153
PropellerHealth/asthma-forecast-sdk-node
index.js
function(lat, lon, callback) { var queryString = "?latitude="+lat+"&longitude="+lon; httpGet(queryString, function(err, results) { callback(err, results); }); }
javascript
function(lat, lon, callback) { var queryString = "?latitude="+lat+"&longitude="+lon; httpGet(queryString, function(err, results) { callback(err, results); }); }
[ "function", "(", "lat", ",", "lon", ",", "callback", ")", "{", "var", "queryString", "=", "\"?latitude=\"", "+", "lat", "+", "\"&longitude=\"", "+", "lon", ";", "httpGet", "(", "queryString", ",", "function", "(", "err", ",", "results", ")", "{", "callba...
callback for getForecastByLatLong @callback module:asthma-forecast/client~getForecastByLatLongCallback @param {Object} [err] error calling asthma-forecast @param {Object} [result] forecast getForecastByLatLong @param {Number} latitude Latitude in decimal degrees @param {Number} longitude longitude in decimal degrees ...
[ "callback", "for", "getForecastByLatLong" ]
683611c2b1ea89d644afcc2ff0e2bbb0a4e4dd05
https://github.com/PropellerHealth/asthma-forecast-sdk-node/blob/683611c2b1ea89d644afcc2ff0e2bbb0a4e4dd05/index.js#L89-L96
50,154
emiljohansson/captn
captn.dom.hasclass/index.js
hasClass
function hasClass(element, className) { if (!hasClassNameProperty(element)) { return false; } return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1; }
javascript
function hasClass(element, className) { if (!hasClassNameProperty(element)) { return false; } return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1; }
[ "function", "hasClass", "(", "element", ",", "className", ")", "{", "if", "(", "!", "hasClassNameProperty", "(", "element", ")", ")", "{", "return", "false", ";", "}", "return", "(", "' '", "+", "element", ".", "className", "+", "' '", ")", ".", "index...
Returns true if the element's class name contains className. @static @param {DOMElement} element The DOM element to be checked. @param {string} className The name to match. @return {boolean} Returns `true` if `className` exist within the elements className. @example hasClass(el, 'container'); // => true
[ "Returns", "true", "if", "the", "element", "s", "class", "name", "contains", "className", "." ]
dae7520116dc2148b4de06af7e1d7a47a3a3ac37
https://github.com/emiljohansson/captn/blob/dae7520116dc2148b4de06af7e1d7a47a3a3ac37/captn.dom.hasclass/index.js#L17-L22
50,155
gethuman/pancakes-angular
lib/ngapp/state.helper.js
goToUrl
function goToUrl(url) { if (!url) { return; } if (_.isArray(url)) { url = url.join('/'); } var hasHttp = url.indexOf('http') === 0; if (!hasHttp && url.indexOf('/') !== 0) { url = '/' + url; } hasHttp ? $window.location.href = url : $loc...
javascript
function goToUrl(url) { if (!url) { return; } if (_.isArray(url)) { url = url.join('/'); } var hasHttp = url.indexOf('http') === 0; if (!hasHttp && url.indexOf('/') !== 0) { url = '/' + url; } hasHttp ? $window.location.href = url : $loc...
[ "function", "goToUrl", "(", "url", ")", "{", "if", "(", "!", "url", ")", "{", "return", ";", "}", "if", "(", "_", ".", "isArray", "(", "url", ")", ")", "{", "url", "=", "url", ".", "join", "(", "'/'", ")", ";", "}", "var", "hasHttp", "=", "...
Simply go to the url and allow the state to change @param url
[ "Simply", "go", "to", "the", "url", "and", "allow", "the", "state", "to", "change" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/state.helper.js#L15-L28
50,156
gethuman/pancakes-angular
lib/ngapp/state.helper.js
getQueryParams
function getQueryParams(params) { params = params || {}; var url = $location.url(); var idx = url.indexOf('?'); // if there is a query string if (idx < 0) { return {}; } // get the query string and split the keyvals var query = url.substring(idx + 1); va...
javascript
function getQueryParams(params) { params = params || {}; var url = $location.url(); var idx = url.indexOf('?'); // if there is a query string if (idx < 0) { return {}; } // get the query string and split the keyvals var query = url.substring(idx + 1); va...
[ "function", "getQueryParams", "(", "params", ")", "{", "params", "=", "params", "||", "{", "}", ";", "var", "url", "=", "$location", ".", "url", "(", ")", ";", "var", "idx", "=", "url", ".", "indexOf", "(", "'?'", ")", ";", "// if there is a query stri...
Get params from the URL
[ "Get", "params", "from", "the", "URL" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/state.helper.js#L48-L67
50,157
sendanor/nor-newrelic
src/cli.js
save_config
function save_config(path, config) { debug.assert(path).is('string'); debug.assert(config).is('object'); return $Q.fcall(function stringify_json() { return JSON.stringify(config, null, 2); }).then(function write_to_file(data) { return FS.writeFile(path, data, {'encoding':'utf8'}); }); }
javascript
function save_config(path, config) { debug.assert(path).is('string'); debug.assert(config).is('object'); return $Q.fcall(function stringify_json() { return JSON.stringify(config, null, 2); }).then(function write_to_file(data) { return FS.writeFile(path, data, {'encoding':'utf8'}); }); }
[ "function", "save_config", "(", "path", ",", "config", ")", "{", "debug", ".", "assert", "(", "path", ")", ".", "is", "(", "'string'", ")", ";", "debug", ".", "assert", "(", "config", ")", ".", "is", "(", "'object'", ")", ";", "return", "$Q", ".", ...
Save configurations to disk
[ "Save", "configurations", "to", "disk" ]
638c97036c9a1ff79ab2b114abb3c61ceacc81b7
https://github.com/sendanor/nor-newrelic/blob/638c97036c9a1ff79ab2b114abb3c61ceacc81b7/src/cli.js#L50-L58
50,158
toranb/gulp-ember-handlebarz
index.js
function (name) { var n = path.extname(name).length; return n === 0 ? name : name.slice(0, -n); }
javascript
function (name) { var n = path.extname(name).length; return n === 0 ? name : name.slice(0, -n); }
[ "function", "(", "name", ")", "{", "var", "n", "=", "path", ".", "extname", "(", "name", ")", ".", "length", ";", "return", "n", "===", "0", "?", "name", ":", "name", ".", "slice", "(", "0", ",", "-", "n", ")", ";", "}" ]
Default name function returns the template filename without extension.
[ "Default", "name", "function", "returns", "the", "template", "filename", "without", "extension", "." ]
2480533ccb6c3feb4a31373474038705c4d3aada
https://github.com/toranb/gulp-ember-handlebarz/blob/2480533ccb6c3feb4a31373474038705c4d3aada/index.js#L9-L12
50,159
psalaets/grid-walk
lib/walker.js
walk
function walk(start, end, fn) { this.start = new Vec2(start); this.end = new Vec2(end); this.direction = calcDirection(this.start, this.end); // positive deltas go right and down this.cellStepDelta = { horizontal: 0, vertical: 0 } this.tMax = new Vec2(); this.tDelta = new Vec2(); this.curre...
javascript
function walk(start, end, fn) { this.start = new Vec2(start); this.end = new Vec2(end); this.direction = calcDirection(this.start, this.end); // positive deltas go right and down this.cellStepDelta = { horizontal: 0, vertical: 0 } this.tMax = new Vec2(); this.tDelta = new Vec2(); this.curre...
[ "function", "walk", "(", "start", ",", "end", ",", "fn", ")", "{", "this", ".", "start", "=", "new", "Vec2", "(", "start", ")", ";", "this", ".", "end", "=", "new", "Vec2", "(", "end", ")", ";", "this", ".", "direction", "=", "calcDirection", "("...
Walk along a line through the grid. @param {object} start - Start point of line, object with x/y properties. @param {object} end - End point of line, object with x/y properties. @param {function} fn - Callback to be invoked *synchronously* for each cell visited with grid coordinate {column: number, row: number} as the...
[ "Walk", "along", "a", "line", "through", "the", "grid", "." ]
6969e4c9aa0a18289dd3af7da136f7966bcb022d
https://github.com/psalaets/grid-walk/blob/6969e4c9aa0a18289dd3af7da136f7966bcb022d/lib/walker.js#L34-L62
50,160
psalaets/grid-walk
lib/walker.js
coord
function coord(coordOrColumn, row) { if (arguments.length == 1) { // copy incoming coord object return { column: coordOrColumn.column, row: coordOrColumn.row }; } else if (arguments.length == 2) { // create coord object return { column: coordOrColumn, row: row }; } }
javascript
function coord(coordOrColumn, row) { if (arguments.length == 1) { // copy incoming coord object return { column: coordOrColumn.column, row: coordOrColumn.row }; } else if (arguments.length == 2) { // create coord object return { column: coordOrColumn, row: row }; } }
[ "function", "coord", "(", "coordOrColumn", ",", "row", ")", "{", "if", "(", "arguments", ".", "length", "==", "1", ")", "{", "// copy incoming coord object", "return", "{", "column", ":", "coordOrColumn", ".", "column", ",", "row", ":", "coordOrColumn", ".",...
Creates a coordinate object which is an object with column and row properties. @param {object|number} coordOrColumn - Coordinate object to copy or column number to create coordinate object with. @param {number} [row] - Required when first argument is column number. @param {object} object with column and row properties
[ "Creates", "a", "coordinate", "object", "which", "is", "an", "object", "with", "column", "and", "row", "properties", "." ]
6969e4c9aa0a18289dd3af7da136f7966bcb022d
https://github.com/psalaets/grid-walk/blob/6969e4c9aa0a18289dd3af7da136f7966bcb022d/lib/walker.js#L154-L166
50,161
psalaets/grid-walk
lib/walker.js
calcDirection
function calcDirection(start, end) { var direction = new Vec2(end); direction.subtract(start); direction.normalize(); return direction; }
javascript
function calcDirection(start, end) { var direction = new Vec2(end); direction.subtract(start); direction.normalize(); return direction; }
[ "function", "calcDirection", "(", "start", ",", "end", ")", "{", "var", "direction", "=", "new", "Vec2", "(", "end", ")", ";", "direction", ".", "subtract", "(", "start", ")", ";", "direction", ".", "normalize", "(", ")", ";", "return", "direction", ";...
Figure out direction vector of line connecting two points. @param {Vec2} start @param {Vec2} end @return {Vec2} normalized direction vector
[ "Figure", "out", "direction", "vector", "of", "line", "connecting", "two", "points", "." ]
6969e4c9aa0a18289dd3af7da136f7966bcb022d
https://github.com/psalaets/grid-walk/blob/6969e4c9aa0a18289dd3af7da136f7966bcb022d/lib/walker.js#L193-L198
50,162
acos-server/acos-jsparsons
static/js-parsons/ui-extension/parsons-site-ui.js
function(newAction) { // ignore init and feedback actions if (newAction.type === "init" || newAction.type === "feedback") { return; } var action = parson.whatWeDidPreviously(); // if we have been here before (action not undefined) and more than one line in solution... if (action && action.output && ...
javascript
function(newAction) { // ignore init and feedback actions if (newAction.type === "init" || newAction.type === "feedback") { return; } var action = parson.whatWeDidPreviously(); // if we have been here before (action not undefined) and more than one line in solution... if (action && action.output && ...
[ "function", "(", "newAction", ")", "{", "// ignore init and feedback actions", "if", "(", "newAction", ".", "type", "===", "\"init\"", "||", "newAction", ".", "type", "===", "\"feedback\"", ")", "{", "return", ";", "}", "var", "action", "=", "parson", ".", "...
callback function called when user action is done on codelines
[ "callback", "function", "called", "when", "user", "action", "is", "done", "on", "codelines" ]
8c504c261137b0bedf1939a60dd76cfe21d01d7f
https://github.com/acos-server/acos-jsparsons/blob/8c504c261137b0bedf1939a60dd76cfe21d01d7f/static/js-parsons/ui-extension/parsons-site-ui.js#L141-L173
50,163
acos-server/acos-jsparsons
static/js-parsons/ui-extension/parsons-site-ui.js
function(title, message, callback, options) { var buttons = {}; buttons[options?(options.buttonTitle || "OK"):"OK"] = function() { $(this).dialog( "close" ); }; var opts = $.extend(true, { buttons: buttons, modal: true, ti...
javascript
function(title, message, callback, options) { var buttons = {}; buttons[options?(options.buttonTitle || "OK"):"OK"] = function() { $(this).dialog( "close" ); }; var opts = $.extend(true, { buttons: buttons, modal: true, ti...
[ "function", "(", "title", ",", "message", ",", "callback", ",", "options", ")", "{", "var", "buttons", "=", "{", "}", ";", "buttons", "[", "options", "?", "(", "options", ".", "buttonTitle", "||", "\"OK\"", ")", ":", "\"OK\"", "]", "=", "function", "...
function used to show a UI message dialog
[ "function", "used", "to", "show", "a", "UI", "message", "dialog" ]
8c504c261137b0bedf1939a60dd76cfe21d01d7f
https://github.com/acos-server/acos-jsparsons/blob/8c504c261137b0bedf1939a60dd76cfe21d01d7f/static/js-parsons/ui-extension/parsons-site-ui.js#L176-L200
50,164
acos-server/acos-jsparsons
static/js-parsons/ui-extension/parsons-site-ui.js
function(duration) { $("#header").addClass("timer"); $("#timer").show().animate({width: "100%"}, duration, function() { $("#header").removeClass("timer"); $("#timer").hide().css({width: "0"}); }); }
javascript
function(duration) { $("#header").addClass("timer"); $("#timer").show().animate({width: "100%"}, duration, function() { $("#header").removeClass("timer"); $("#timer").hide().css({width: "0"}); }); }
[ "function", "(", "duration", ")", "{", "$", "(", "\"#header\"", ")", ".", "addClass", "(", "\"timer\"", ")", ";", "$", "(", "\"#timer\"", ")", ".", "show", "(", ")", ".", "animate", "(", "{", "width", ":", "\"100%\"", "}", ",", "duration", ",", "fu...
function to disable feedback for duration milliseconds
[ "function", "to", "disable", "feedback", "for", "duration", "milliseconds" ]
8c504c261137b0bedf1939a60dd76cfe21d01d7f
https://github.com/acos-server/acos-jsparsons/blob/8c504c261137b0bedf1939a60dd76cfe21d01d7f/static/js-parsons/ui-extension/parsons-site-ui.js#L203-L209
50,165
acos-server/acos-jsparsons
static/js-parsons/ui-extension/parsons-site-ui.js
function(feedback) { var isCorrect = ($.isArray(feedback) && feedback.length === 0) || ('feedback' in feedback && feedback.success); // correctly solved but collection has more exercises if (isCorrect && $.isFunction(PARSONS_SETTINGS.next)) { $("#ul-sortable").sortable("destroy");...
javascript
function(feedback) { var isCorrect = ($.isArray(feedback) && feedback.length === 0) || ('feedback' in feedback && feedback.success); // correctly solved but collection has more exercises if (isCorrect && $.isFunction(PARSONS_SETTINGS.next)) { $("#ul-sortable").sortable("destroy");...
[ "function", "(", "feedback", ")", "{", "var", "isCorrect", "=", "(", "$", ".", "isArray", "(", "feedback", ")", "&&", "feedback", ".", "length", "===", "0", ")", "||", "(", "'feedback'", "in", "feedback", "&&", "feedback", ".", "success", ")", ";", "...
default feedback callback handler
[ "default", "feedback", "callback", "handler" ]
8c504c261137b0bedf1939a60dd76cfe21d01d7f
https://github.com/acos-server/acos-jsparsons/blob/8c504c261137b0bedf1939a60dd76cfe21d01d7f/static/js-parsons/ui-extension/parsons-site-ui.js#L213-L259
50,166
toddbluhm/bluebird-events
index.js
function (events, func) { for (var i = 0; i < events.length; i++) { obj.once(events[i], func) listeners[events[i]] = func } }
javascript
function (events, func) { for (var i = 0; i < events.length; i++) { obj.once(events[i], func) listeners[events[i]] = func } }
[ "function", "(", "events", ",", "func", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "events", ".", "length", ";", "i", "++", ")", "{", "obj", ".", "once", "(", "events", "[", "i", "]", ",", "func", ")", "listeners", "[", "event...
Adds an array of events to the object with the given func
[ "Adds", "an", "array", "of", "events", "to", "the", "object", "with", "the", "given", "func" ]
3f9045c73c35ad28e6c285feca4a740bfec6ff91
https://github.com/toddbluhm/bluebird-events/blob/3f9045c73c35ad28e6c285feca4a740bfec6ff91/index.js#L45-L50
50,167
yefremov/aggregatejs
max.js
max
function max(array) { var length = array.length; if (length === 0) { return 0; } var index = -1; var result = array[++index]; while (++index < length) { if (array[index] > result) { result = array[index]; } } return result; }
javascript
function max(array) { var length = array.length; if (length === 0) { return 0; } var index = -1; var result = array[++index]; while (++index < length) { if (array[index] > result) { result = array[index]; } } return result; }
[ "function", "max", "(", "array", ")", "{", "var", "length", "=", "array", ".", "length", ";", "if", "(", "length", "===", "0", ")", "{", "return", "0", ";", "}", "var", "index", "=", "-", "1", ";", "var", "result", "=", "array", "[", "++", "ind...
Returns the largest number in `array`. @param {Array} array Range of numbers to get maximum. @return {number} @example max([100, -100, 150, -50, 250, 100]); // => 250
[ "Returns", "the", "largest", "number", "in", "array", "." ]
932b28a15a5707135e7095950000a838db409511
https://github.com/yefremov/aggregatejs/blob/932b28a15a5707135e7095950000a838db409511/max.js#L19-L36
50,168
taoyuan/sira-express-rest
lib/rest.js
buildRoutes
function buildRoutes(obj) { var routes = obj.http; if (routes && !Array.isArray(routes)) { routes = [routes]; } // overidden if (routes) { // patch missing verbs / routes routes.forEach(function (r) { r.verb = String(r.verb || 'all').toLowerCase(); r...
javascript
function buildRoutes(obj) { var routes = obj.http; if (routes && !Array.isArray(routes)) { routes = [routes]; } // overidden if (routes) { // patch missing verbs / routes routes.forEach(function (r) { r.verb = String(r.verb || 'all').toLowerCase(); r...
[ "function", "buildRoutes", "(", "obj", ")", "{", "var", "routes", "=", "obj", ".", "http", ";", "if", "(", "routes", "&&", "!", "Array", ".", "isArray", "(", "routes", ")", ")", "{", "routes", "=", "[", "routes", "]", ";", "}", "// overidden", "if"...
Get the path for the given method. Rest.prototype.buildRoutes = buildRoutes;
[ "Get", "the", "path", "for", "the", "given", "method", ".", "Rest", ".", "prototype", ".", "buildRoutes", "=", "buildRoutes", ";" ]
84b06a3cb127cf68f194a1b1ec115db0e560078c
https://github.com/taoyuan/sira-express-rest/blob/84b06a3cb127cf68f194a1b1ec115db0e560078c/lib/rest.js#L341-L375
50,169
benmosheron/ben-loves-vectors
vector.js
create2x2
function create2x2(a, b, c, d){ if (undef(a)) throw new Error("At least one argument must be provided."); if (undef(b)){ // Everything = a b = a; c = a; d = a; } else{ // we have a and b if(undef(c)){ c = a; d = b; } ...
javascript
function create2x2(a, b, c, d){ if (undef(a)) throw new Error("At least one argument must be provided."); if (undef(b)){ // Everything = a b = a; c = a; d = a; } else{ // we have a and b if(undef(c)){ c = a; d = b; } ...
[ "function", "create2x2", "(", "a", ",", "b", ",", "c", ",", "d", ")", "{", "if", "(", "undef", "(", "a", ")", ")", "throw", "new", "Error", "(", "\"At least one argument must be provided.\"", ")", ";", "if", "(", "undef", "(", "b", ")", ")", "{", "...
Create a 2D vector by providing one, two, or four values
[ "Create", "a", "2D", "vector", "by", "providing", "one", "two", "or", "four", "values" ]
8af737655f6a0fc4a585b3281f516129bb5bc8d3
https://github.com/benmosheron/ben-loves-vectors/blob/8af737655f6a0fc4a585b3281f516129bb5bc8d3/vector.js#L130-L151
50,170
benmosheron/ben-loves-vectors
vector.js
drillRec
function drillRec(v){ const next = v.get(0); if(v.length > 1 || !isAVector(next)) return v; return drillRec(next); }
javascript
function drillRec(v){ const next = v.get(0); if(v.length > 1 || !isAVector(next)) return v; return drillRec(next); }
[ "function", "drillRec", "(", "v", ")", "{", "const", "next", "=", "v", ".", "get", "(", "0", ")", ";", "if", "(", "v", ".", "length", ">", "1", "||", "!", "isAVector", "(", "next", ")", ")", "return", "v", ";", "return", "drillRec", "(", "next"...
drill to first level with >1 value
[ "drill", "to", "first", "level", "with", ">", "1", "value" ]
8af737655f6a0fc4a585b3281f516129bb5bc8d3
https://github.com/benmosheron/ben-loves-vectors/blob/8af737655f6a0fc4a585b3281f516129bb5bc8d3/vector.js#L350-L354
50,171
benmosheron/ben-loves-vectors
vector.js
mapToValues
function mapToValues(v){ function mapRec(e){ if(!isAVector(e)) return e; return mapRec(e.get(0)); } return v.map(mapRec); }
javascript
function mapToValues(v){ function mapRec(e){ if(!isAVector(e)) return e; return mapRec(e.get(0)); } return v.map(mapRec); }
[ "function", "mapToValues", "(", "v", ")", "{", "function", "mapRec", "(", "e", ")", "{", "if", "(", "!", "isAVector", "(", "e", ")", ")", "return", "e", ";", "return", "mapRec", "(", "e", ".", "get", "(", "0", ")", ")", ";", "}", "return", "v",...
map to elementary values
[ "map", "to", "elementary", "values" ]
8af737655f6a0fc4a585b3281f516129bb5bc8d3
https://github.com/benmosheron/ben-loves-vectors/blob/8af737655f6a0fc4a585b3281f516129bb5bc8d3/vector.js#L357-L363
50,172
cli-kit/cli-mid-command
index.js
lazy
function lazy(arg) { var conf = this.configure(); var action = arg.action(); if(!conf.command.dir || action !== undefined) return false; var file = path.join(conf.command.dir, getModulePath.call(this, arg)) try{ action = require(file); if(typeof action !== 'function') { return this.raise(this.er...
javascript
function lazy(arg) { var conf = this.configure(); var action = arg.action(); if(!conf.command.dir || action !== undefined) return false; var file = path.join(conf.command.dir, getModulePath.call(this, arg)) try{ action = require(file); if(typeof action !== 'function') { return this.raise(this.er...
[ "function", "lazy", "(", "arg", ")", "{", "var", "conf", "=", "this", ".", "configure", "(", ")", ";", "var", "action", "=", "arg", ".", "action", "(", ")", ";", "if", "(", "!", "conf", ".", "command", ".", "dir", "||", "action", "!==", "undefine...
lazily load a command action definition from a module
[ "lazily", "load", "a", "command", "action", "definition", "from", "a", "module" ]
fd2c3d758886e2833df7dcf84b0e14cd40649671
https://github.com/cli-kit/cli-mid-command/blob/fd2c3d758886e2833df7dcf84b0e14cd40649671/index.js#L23-L37
50,173
jwoudenberg/require-compiled
index.js
rewriteRequires
function rewriteRequires (filename) { var basedir = path.dirname(filename) return wrapListener( function (nodePath) { if (nodePath.isLiteral() && !path.isAbsolute(nodePath.node.value)) { var match = nodePath.node.value.match(/^compile!(.+)$/) nodePath.node.value = match ...
javascript
function rewriteRequires (filename) { var basedir = path.dirname(filename) return wrapListener( function (nodePath) { if (nodePath.isLiteral() && !path.isAbsolute(nodePath.node.value)) { var match = nodePath.node.value.match(/^compile!(.+)$/) nodePath.node.value = match ...
[ "function", "rewriteRequires", "(", "filename", ")", "{", "var", "basedir", "=", "path", ".", "dirname", "(", "filename", ")", "return", "wrapListener", "(", "function", "(", "nodePath", ")", "{", "if", "(", "nodePath", ".", "isLiteral", "(", ")", "&&", ...
Rewrite requires to use absolute paths. This way tests the compiled tests can still be ran from a different directory.
[ "Rewrite", "requires", "to", "use", "absolute", "paths", ".", "This", "way", "tests", "the", "compiled", "tests", "can", "still", "be", "ran", "from", "a", "different", "directory", "." ]
99f45ad1f286ba346313d23e6d42d78adff68d42
https://github.com/jwoudenberg/require-compiled/blob/99f45ad1f286ba346313d23e6d42d78adff68d42/index.js#L84-L102
50,174
meltmedia/node-usher
lib/activity/poller.js
ActivityPoller
function ActivityPoller(name, domain, options) { if (!(this instanceof ActivityPoller)) { return new ActivityPoller(name, domain, options); } events.EventEmitter.call(this); if (!_.isString(name)) { throw new Error('A `name` is required'); } if (!_.isString(domain)) { throw new Error('A `doma...
javascript
function ActivityPoller(name, domain, options) { if (!(this instanceof ActivityPoller)) { return new ActivityPoller(name, domain, options); } events.EventEmitter.call(this); if (!_.isString(name)) { throw new Error('A `name` is required'); } if (!_.isString(domain)) { throw new Error('A `doma...
[ "function", "ActivityPoller", "(", "name", ",", "domain", ",", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "ActivityPoller", ")", ")", "{", "return", "new", "ActivityPoller", "(", "name", ",", "domain", ",", "options", ")", ";", "}", ...
Represents a single, named poller, where all activities are defined. @constructor @param {string} name - The name of the poller. This is arbitrary and has no bering on SWF. @param {string} domain - The AWS SWF domain name to execute this pollers activities in. @param {object} [options] - Additional options used when po...
[ "Represents", "a", "single", "named", "poller", "where", "all", "activities", "are", "defined", "." ]
fe6183bf7097f84bef935e8d9c19463accc08ad6
https://github.com/meltmedia/node-usher/blob/fe6183bf7097f84bef935e8d9c19463accc08ad6/lib/activity/poller.js#L33-L67
50,175
docLoop/core
manage-calls.js
function(obj, method_name, force_call_after = 1000){ if(typeof obj[method_name] != 'function') throw new TypeError("collateCalls(): Not a method '"+method_name+ "' on "+obj.toString()) var original_fn = obj[method_name], scheduled_runs = {} function requestRun(...args){ var str = JSON.stringify(args...
javascript
function(obj, method_name, force_call_after = 1000){ if(typeof obj[method_name] != 'function') throw new TypeError("collateCalls(): Not a method '"+method_name+ "' on "+obj.toString()) var original_fn = obj[method_name], scheduled_runs = {} function requestRun(...args){ var str = JSON.stringify(args...
[ "function", "(", "obj", ",", "method_name", ",", "force_call_after", "=", "1000", ")", "{", "if", "(", "typeof", "obj", "[", "method_name", "]", "!=", "'function'", ")", "throw", "new", "TypeError", "(", "\"collateCalls(): Not a method '\"", "+", "method_name", ...
Replaces a method of provided object with a proxy, that will prevent multiple calls to the original method with the same arguments while waiting for a response. The proxy method will allways wrap the original method in a Promise. If a previous call with the same arguments is still pending the proxy will return the co...
[ "Replaces", "a", "method", "of", "provided", "object", "with", "a", "proxy", "that", "will", "prevent", "multiple", "calls", "to", "the", "original", "method", "with", "the", "same", "arguments", "while", "waiting", "for", "a", "response", "." ]
111870e3dcc537997fa31dee485e355e487af794
https://github.com/docLoop/core/blob/111870e3dcc537997fa31dee485e355e487af794/manage-calls.js#L96-L121
50,176
billysbilling/inflectors
index.js
function() { singulars = {}; for (var k in plurals) { if (!plurals.hasOwnProperty(k)) continue; singulars[plurals[k]] = k; } }
javascript
function() { singulars = {}; for (var k in plurals) { if (!plurals.hasOwnProperty(k)) continue; singulars[plurals[k]] = k; } }
[ "function", "(", ")", "{", "singulars", "=", "{", "}", ";", "for", "(", "var", "k", "in", "plurals", ")", "{", "if", "(", "!", "plurals", ".", "hasOwnProperty", "(", "k", ")", ")", "continue", ";", "singulars", "[", "plurals", "[", "k", "]", "]",...
Clears singular rules and recreates from opposites of plural rules
[ "Clears", "singular", "rules", "and", "recreates", "from", "opposites", "of", "plural", "rules" ]
092d024e9e883aef911354e2af1c669a463d448f
https://github.com/billysbilling/inflectors/blob/092d024e9e883aef911354e2af1c669a463d448f/index.js#L74-L80
50,177
redisjs/jsr-server
lib/command/script/evalsha.js
execute
function execute(req, res) { ScriptManager.evalsha(req, res, '' + req.args[0], req.args.slice(1)); }
javascript
function execute(req, res) { ScriptManager.evalsha(req, res, '' + req.args[0], req.args.slice(1)); }
[ "function", "execute", "(", "req", ",", "res", ")", "{", "ScriptManager", ".", "evalsha", "(", "req", ",", "res", ",", "''", "+", "req", ".", "args", "[", "0", "]", ",", "req", ".", "args", ".", "slice", "(", "1", ")", ")", ";", "}" ]
Respond to the EVALSHA command.
[ "Respond", "to", "the", "EVALSHA", "command", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/script/evalsha.js#L18-L20
50,178
feedhenry/fh-statsc
lib/stats.js
send
function send(data, cb) { if (enabled) { var send_data = new Buffer(data); try { socket.send(send_data, 0, send_data.length, port, host, function(err, bytes) { if (cb) { return cb(err, bytes); } }); } catch (x) { // Purposely ignored.. ...
javascript
function send(data, cb) { if (enabled) { var send_data = new Buffer(data); try { socket.send(send_data, 0, send_data.length, port, host, function(err, bytes) { if (cb) { return cb(err, bytes); } }); } catch (x) { // Purposely ignored.. ...
[ "function", "send", "(", "data", ",", "cb", ")", "{", "if", "(", "enabled", ")", "{", "var", "send_data", "=", "new", "Buffer", "(", "data", ")", ";", "try", "{", "socket", ".", "send", "(", "send_data", ",", "0", ",", "send_data", ".", "length", ...
needs to send in batches every second or so
[ "needs", "to", "send", "in", "batches", "every", "second", "or", "so" ]
6a320a3dfa5d6baabc6ea4d5d7280bdb60e6757d
https://github.com/feedhenry/fh-statsc/blob/6a320a3dfa5d6baabc6ea4d5d7280bdb60e6757d/lib/stats.js#L23-L39
50,179
nfroidure/common-services
src/codeGenerator.js
codeGenerator
async function codeGenerator(length = 6) { const code = new Array(length) .fill('0') .map(() => CHARS_SET[Math.floor(random() * (charsSetLength - 1))]) .join(''); log('debug', `Generated a new code:`, code); return code; }
javascript
async function codeGenerator(length = 6) { const code = new Array(length) .fill('0') .map(() => CHARS_SET[Math.floor(random() * (charsSetLength - 1))]) .join(''); log('debug', `Generated a new code:`, code); return code; }
[ "async", "function", "codeGenerator", "(", "length", "=", "6", ")", "{", "const", "code", "=", "new", "Array", "(", "length", ")", ".", "fill", "(", "'0'", ")", ".", "map", "(", "(", ")", "=>", "CHARS_SET", "[", "Math", ".", "floor", "(", "random",...
Returns a random code @param {Number} [length] An optional custon code length (defaults to 6) @return {Promise<String>} A promise of the generated code @example console.log([ codeGenerator(), codeGenerator(), codeGenerator(), ]); // Prints: ABCDEF,GHJKMN,PRSTUV
[ "Returns", "a", "random", "code" ]
09df32597fe798777abec0ef1f3a994e91046085
https://github.com/nfroidure/common-services/blob/09df32597fe798777abec0ef1f3a994e91046085/src/codeGenerator.js#L62-L69
50,180
gethuman/pancakes-mongo
lib/pancakes.mongo.adapter.js
getModel
function getModel(resource) { var name = resource.name; // if not already in the model cache, get it if (!cache.models[name]) { var schema = new mongoose.Schema(resource.fields, { collection: name }); // loop through indexes and add them to the schema _.each(resource.indexes, funct...
javascript
function getModel(resource) { var name = resource.name; // if not already in the model cache, get it if (!cache.models[name]) { var schema = new mongoose.Schema(resource.fields, { collection: name }); // loop through indexes and add them to the schema _.each(resource.indexes, funct...
[ "function", "getModel", "(", "resource", ")", "{", "var", "name", "=", "resource", ".", "name", ";", "// if not already in the model cache, get it", "if", "(", "!", "cache", ".", "models", "[", "name", "]", ")", "{", "var", "schema", "=", "new", "mongoose", ...
Create a mongoose model object from a set of fields, fieldsets and indexes @param resource @returns {Model}
[ "Create", "a", "mongoose", "model", "object", "from", "a", "set", "of", "fields", "fieldsets", "and", "indexes" ]
e10d2ca61643607008fdcb14b55d8a383284463b
https://github.com/gethuman/pancakes-mongo/blob/e10d2ca61643607008fdcb14b55d8a383284463b/lib/pancakes.mongo.adapter.js#L114-L130
50,181
gethuman/pancakes-mongo
lib/pancakes.mongo.adapter.js
saveIndexInfo
function saveIndexInfo() { // reset the cache var tmpCache = cache.idxInfo; cache.idxInfo = {}; var promises = []; // add promise for each things being saved/updated _.each(tmpCache, function (idxInfo, key) { var where = { str: key }; var select = '_id count'; var pro...
javascript
function saveIndexInfo() { // reset the cache var tmpCache = cache.idxInfo; cache.idxInfo = {}; var promises = []; // add promise for each things being saved/updated _.each(tmpCache, function (idxInfo, key) { var where = { str: key }; var select = '_id count'; var pro...
[ "function", "saveIndexInfo", "(", ")", "{", "// reset the cache", "var", "tmpCache", "=", "cache", ".", "idxInfo", ";", "cache", ".", "idxInfo", "=", "{", "}", ";", "var", "promises", "=", "[", "]", ";", "// add promise for each things being saved/updated", "_",...
Save a query to the idxInfo table
[ "Save", "a", "query", "to", "the", "idxInfo", "table" ]
e10d2ca61643607008fdcb14b55d8a383284463b
https://github.com/gethuman/pancakes-mongo/blob/e10d2ca61643607008fdcb14b55d8a383284463b/lib/pancakes.mongo.adapter.js#L135-L167
50,182
tomiberes/batoh
src/batoh.js
function(cb) { var self = this; var request; try { request = IndexedDB.open(self.setup.database, self.setup.version); } catch (err) { if (isFunction(cb)) return cb(err); } request.onsuccess = function(event) { self.idb = event.target.result; if (isFunction(cb)) return cb(...
javascript
function(cb) { var self = this; var request; try { request = IndexedDB.open(self.setup.database, self.setup.version); } catch (err) { if (isFunction(cb)) return cb(err); } request.onsuccess = function(event) { self.idb = event.target.result; if (isFunction(cb)) return cb(...
[ "function", "(", "cb", ")", "{", "var", "self", "=", "this", ";", "var", "request", ";", "try", "{", "request", "=", "IndexedDB", ".", "open", "(", "self", ".", "setup", ".", "database", ",", "self", ".", "setup", ".", "version", ")", ";", "}", "...
Open or create the database using the `setup` passed to the constructor. @param {Function} callback - gets one argument `(err)`, if there is no error `err` is null.
[ "Open", "or", "create", "the", "database", "using", "the", "setup", "passed", "to", "the", "constructor", "." ]
2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d
https://github.com/tomiberes/batoh/blob/2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d/src/batoh.js#L66-L101
50,183
tomiberes/batoh
src/batoh.js
function(cb) { if (IndexedDB.deleteDatabase) { var request = IndexedDB.deleteDatabase(this.setup.database); // It's always in an order of onblocked -> onsuccess, // ignoring other handlers, for now. request.onsuccess = function(event) { if (isFunction(cb)) return cb(null, event.targe...
javascript
function(cb) { if (IndexedDB.deleteDatabase) { var request = IndexedDB.deleteDatabase(this.setup.database); // It's always in an order of onblocked -> onsuccess, // ignoring other handlers, for now. request.onsuccess = function(event) { if (isFunction(cb)) return cb(null, event.targe...
[ "function", "(", "cb", ")", "{", "if", "(", "IndexedDB", ".", "deleteDatabase", ")", "{", "var", "request", "=", "IndexedDB", ".", "deleteDatabase", "(", "this", ".", "setup", ".", "database", ")", ";", "// It's always in an order of onblocked -> onsuccess,", "/...
If deleting database is provided by implementation, delete the database used with current setup. @param {Function} callback - gets one argument `(err)`, if there is no error `err` is null. TODO: correct success, blocked, versionchange handling, current spec is unclear and outcome is not usable, thus using only the `o...
[ "If", "deleting", "database", "is", "provided", "by", "implementation", "delete", "the", "database", "used", "with", "current", "setup", "." ]
2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d
https://github.com/tomiberes/batoh/blob/2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d/src/batoh.js#L125-L140
50,184
tomiberes/batoh
src/batoh.js
function(storeNames, mode, result, cb) { var transaction; try { transaction = this.idb.transaction(storeNames, mode); } catch (err) { if (isFunction(cb)) return cb(err); } transaction.onabort = function(event) { if (isFunction(cb)) return cb(event.target.error); }; transact...
javascript
function(storeNames, mode, result, cb) { var transaction; try { transaction = this.idb.transaction(storeNames, mode); } catch (err) { if (isFunction(cb)) return cb(err); } transaction.onabort = function(event) { if (isFunction(cb)) return cb(event.target.error); }; transact...
[ "function", "(", "storeNames", ",", "mode", ",", "result", ",", "cb", ")", "{", "var", "transaction", ";", "try", "{", "transaction", "=", "this", ".", "idb", ".", "transaction", "(", "storeNames", ",", "mode", ")", ";", "}", "catch", "(", "err", ")"...
Wrap IDBDatabase.transaction @param {String} storeNames - names of the object stores to use. @param {String} mode - transaction mode to use. @param {Function} callback - gets two arguments `(err, result)`, if there is no Error `err` is `null`. @param {Object} result - Object that will be returned as a result of the tr...
[ "Wrap", "IDBDatabase", ".", "transaction" ]
2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d
https://github.com/tomiberes/batoh/blob/2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d/src/batoh.js#L152-L169
50,185
tomiberes/batoh
src/batoh.js
function(storeName, transaction, cb) { try { return transaction.objectStore(storeName); } catch (err) { if (isFunction(cb)) return cb(err); } }
javascript
function(storeName, transaction, cb) { try { return transaction.objectStore(storeName); } catch (err) { if (isFunction(cb)) return cb(err); } }
[ "function", "(", "storeName", ",", "transaction", ",", "cb", ")", "{", "try", "{", "return", "transaction", ".", "objectStore", "(", "storeName", ")", ";", "}", "catch", "(", "err", ")", "{", "if", "(", "isFunction", "(", "cb", ")", ")", "return", "c...
Wrap IDBTransation.objectStore @param {String} storeName - name of the object store to use. @param {IDBTransaction} transaction - to use. @param {Function} callback - gets one argument `(err)`, if there is no error, it won't be called.
[ "Wrap", "IDBTransation", ".", "objectStore" ]
2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d
https://github.com/tomiberes/batoh/blob/2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d/src/batoh.js#L179-L185
50,186
tomiberes/batoh
src/batoh.js
function(storeName, value, key, cb) { // For usage of out-of-line keys a `key` argument have to be specified, // otherwise the `request` will be made assuming in-line key or key generator. // For detailed possibilities see what you can't do in `DataError` section here: // `https://developer.mozilla.org/...
javascript
function(storeName, value, key, cb) { // For usage of out-of-line keys a `key` argument have to be specified, // otherwise the `request` will be made assuming in-line key or key generator. // For detailed possibilities see what you can't do in `DataError` section here: // `https://developer.mozilla.org/...
[ "function", "(", "storeName", ",", "value", ",", "key", ",", "cb", ")", "{", "// For usage of out-of-line keys a `key` argument have to be specified,", "// otherwise the `request` will be made assuming in-line key or key generator.", "// For detailed possibilities see what you can't do in ...
Add one or more records. If record already exist in object store, returns an Error. @param {String} storeName - name of the object store to use. @param {Object|Object[]} value - Object or Array of objects to store. @param {String|String[]} [key] - String or an Array of strings, as a keys for the values. If an Array is...
[ "Add", "one", "or", "more", "records", ".", "If", "record", "already", "exist", "in", "object", "store", "returns", "an", "Error", "." ]
2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d
https://github.com/tomiberes/batoh/blob/2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d/src/batoh.js#L201-L250
50,187
tomiberes/batoh
src/batoh.js
function(storeName, key, cb) { if (!Array.isArray(key)) { key = [key]; } var result = []; var transaction = this.transaction(storeName, MODE.READ_WRITE, result, cb); var store = this.store(storeName, transaction, cb); var _del = function(key) { var request; try { reque...
javascript
function(storeName, key, cb) { if (!Array.isArray(key)) { key = [key]; } var result = []; var transaction = this.transaction(storeName, MODE.READ_WRITE, result, cb); var store = this.store(storeName, transaction, cb); var _del = function(key) { var request; try { reque...
[ "function", "(", "storeName", ",", "key", ",", "cb", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "key", ")", ")", "{", "key", "=", "[", "key", "]", ";", "}", "var", "result", "=", "[", "]", ";", "var", "transaction", "=", "this", ...
Delete one or more records specified by the key. @param {String} storeName - name of the object store to use @param {String} key - key that identifies the record to be deleted. @param {Function} callback - gets two arguments `(err, result)`, if there is no Error `err` is `null`. `result` is always an Array of the resu...
[ "Delete", "one", "or", "more", "records", "specified", "by", "the", "key", "." ]
2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d
https://github.com/tomiberes/batoh/blob/2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d/src/batoh.js#L360-L385
50,188
tomiberes/batoh
src/batoh.js
function(storeName, query, each, cb) { if (arguments.length === 3) { cb = each; each = null; } if (arguments.length === 2) { cb = query; query = null; each = null; } var result = []; var transaction = this.transaction(storeName, MODE.READ_ONLY, result, cb); var...
javascript
function(storeName, query, each, cb) { if (arguments.length === 3) { cb = each; each = null; } if (arguments.length === 2) { cb = query; query = null; each = null; } var result = []; var transaction = this.transaction(storeName, MODE.READ_ONLY, result, cb); var...
[ "function", "(", "storeName", ",", "query", ",", "each", ",", "cb", ")", "{", "if", "(", "arguments", ".", "length", "===", "3", ")", "{", "cb", "=", "each", ";", "each", "=", "null", ";", "}", "if", "(", "arguments", ".", "length", "===", "2", ...
Open cursor and query the object store. @param {string} storeName - name of the object store to use @param {Object} query - configuration Object defining the query @param {String} [query.index] - index to use, if omitted cursor is opened on the keyPath of the store @param {Object} [query.range] - IDBKeyRange object de...
[ "Open", "cursor", "and", "query", "the", "object", "store", "." ]
2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d
https://github.com/tomiberes/batoh/blob/2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d/src/batoh.js#L405-L468
50,189
tomiberes/batoh
src/batoh.js
function(storeName, cb) { var result; var transaction = this.transaction(storeName, MODE.READ_ONLY, result, cb); var store = this.store(storeName, transaction, cb); var request; try { request = store.count(); } catch (err) { if (isFunction(cb)) return cb(err); } request.onsuc...
javascript
function(storeName, cb) { var result; var transaction = this.transaction(storeName, MODE.READ_ONLY, result, cb); var store = this.store(storeName, transaction, cb); var request; try { request = store.count(); } catch (err) { if (isFunction(cb)) return cb(err); } request.onsuc...
[ "function", "(", "storeName", ",", "cb", ")", "{", "var", "result", ";", "var", "transaction", "=", "this", ".", "transaction", "(", "storeName", ",", "MODE", ".", "READ_ONLY", ",", "result", ",", "cb", ")", ";", "var", "store", "=", "this", ".", "st...
Count the objects in the store. @param {String} storeName - name of the object store to count. @param {Function} callback - gets one argument `(err)`, if there is no error `err` is null.
[ "Count", "the", "objects", "in", "the", "store", "." ]
2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d
https://github.com/tomiberes/batoh/blob/2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d/src/batoh.js#L477-L493
50,190
tomiberes/batoh
src/batoh.js
function(storeName, cb) { var result; var transaction = this.transaction(storeName, MODE.READ_WRITE, result, cb); var store = this.store(storeName, transaction, cb); var request; try { request = store.clear(); } catch (err) { if (isFunction(cb)) return cb(err); } request.onsu...
javascript
function(storeName, cb) { var result; var transaction = this.transaction(storeName, MODE.READ_WRITE, result, cb); var store = this.store(storeName, transaction, cb); var request; try { request = store.clear(); } catch (err) { if (isFunction(cb)) return cb(err); } request.onsu...
[ "function", "(", "storeName", ",", "cb", ")", "{", "var", "result", ";", "var", "transaction", "=", "this", ".", "transaction", "(", "storeName", ",", "MODE", ".", "READ_WRITE", ",", "result", ",", "cb", ")", ";", "var", "store", "=", "this", ".", "s...
Clear the object store of all records. @param {String} storeName - name of the object store to clear @param {Function} callback - gets one argument `(err)`, if there is no error `err` is null.
[ "Clear", "the", "object", "store", "of", "all", "records", "." ]
2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d
https://github.com/tomiberes/batoh/blob/2bc5d0bb5d5fa8d7fdb6998298ca51c50e4ee54d/src/batoh.js#L502-L518
50,191
gardr/validator
lib/rule/validate/codeUsage.js
validate
function validate(harvested, report, next, options) { report.setChecklist('CodeUsage', 'Static code analysis'); var illegalIdentifiers = ['geolocation']; function analyze(content, sourceURL, origin) { var ast; var trace = { 'trace': { 'sourceURL': sourceURL ...
javascript
function validate(harvested, report, next, options) { report.setChecklist('CodeUsage', 'Static code analysis'); var illegalIdentifiers = ['geolocation']; function analyze(content, sourceURL, origin) { var ast; var trace = { 'trace': { 'sourceURL': sourceURL ...
[ "function", "validate", "(", "harvested", ",", "report", ",", "next", ",", "options", ")", "{", "report", ".", "setChecklist", "(", "'CodeUsage'", ",", "'Static code analysis'", ")", ";", "var", "illegalIdentifiers", "=", "[", "'geolocation'", "]", ";", "funct...
navigator.geolocation
[ "navigator", ".", "geolocation" ]
8ff6acc9e312d3a33f35422110397cd83b035036
https://github.com/gardr/validator/blob/8ff6acc9e312d3a33f35422110397cd83b035036/lib/rule/validate/codeUsage.js#L5-L75
50,192
inception-soa/inception.primitives
lib/error.js
PrimitiveError
function PrimitiveError(code, metadata, cause) { if (code === undefined || code === null) { throw new TypeError('`code` is a required argument!'); } PrimitiveError.super_.call(this, this.constructor.ERRORS[code]); if (metadata instanceof Error) { cause = metadata; metadata = undefined; } /** ...
javascript
function PrimitiveError(code, metadata, cause) { if (code === undefined || code === null) { throw new TypeError('`code` is a required argument!'); } PrimitiveError.super_.call(this, this.constructor.ERRORS[code]); if (metadata instanceof Error) { cause = metadata; metadata = undefined; } /** ...
[ "function", "PrimitiveError", "(", "code", ",", "metadata", ",", "cause", ")", "{", "if", "(", "code", "===", "undefined", "||", "code", "===", "null", ")", "{", "throw", "new", "TypeError", "(", "'`code` is a required argument!'", ")", ";", "}", "PrimitiveE...
A base class for all errors This class inherits from the JavaScript Error class, and then parasitically inherits from PrimitiveObject. Multiple inheritance isn't pretty! @param {String} code A unique code identifying the error @param {Object} [metadata] Metadata related to the error @param {Error} [cause] The origina...
[ "A", "base", "class", "for", "all", "errors" ]
fc9fa777248050eefe3e62f73b9f15494bdc0bbc
https://github.com/inception-soa/inception.primitives/blob/fc9fa777248050eefe3e62f73b9f15494bdc0bbc/lib/error.js#L41-L64
50,193
redisjs/jsr-server
lib/client.js
Client
function Client(socket) { // flag whether an external or internal client socket this._tcp = (socket instanceof Socket); // index into the connections array this._index = -1; // file descriptor this._fd = socket._handle.fd; // remote ip address this._remoteAddress = socket.remoteAddress; // remote...
javascript
function Client(socket) { // flag whether an external or internal client socket this._tcp = (socket instanceof Socket); // index into the connections array this._index = -1; // file descriptor this._fd = socket._handle.fd; // remote ip address this._remoteAddress = socket.remoteAddress; // remote...
[ "function", "Client", "(", "socket", ")", "{", "// flag whether an external or internal client socket", "this", ".", "_tcp", "=", "(", "socket", "instanceof", "Socket", ")", ";", "// index into the connections array", "this", ".", "_index", "=", "-", "1", ";", "// f...
Encapsulates client connection state.
[ "Encapsulates", "client", "connection", "state", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/client.js#L25-L83
50,194
redisjs/jsr-server
lib/client.js
getObject
function getObject() { var o = {} , i , fields = arguments.length ? Array.prototype.slice.call(arguments, 0) : keys; for(i = 0;i < fields.length;i++) { o[fields[i]] = this[fields[i]]; } return o; }
javascript
function getObject() { var o = {} , i , fields = arguments.length ? Array.prototype.slice.call(arguments, 0) : keys; for(i = 0;i < fields.length;i++) { o[fields[i]] = this[fields[i]]; } return o; }
[ "function", "getObject", "(", ")", "{", "var", "o", "=", "{", "}", ",", "i", ",", "fields", "=", "arguments", ".", "length", "?", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "0", ")", ":", "keys", ";", "for", "(",...
Get an object of information about this client.
[ "Get", "an", "object", "of", "information", "about", "this", "client", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/client.js#L88-L97
50,195
SebastianOsuna/configure.js
lib/configure.js
_configFilter
function _configFilter ( f ) { var parts = f.split("."), ext = parts[ parts.length - 1 ], pre = parts[ parts.length - 2 ], name = parts[ parts.length - 3]; return !!(ext === "dist" && pre === "json" && exports.__ignores.indexOf( name ) === -1 && e...
javascript
function _configFilter ( f ) { var parts = f.split("."), ext = parts[ parts.length - 1 ], pre = parts[ parts.length - 2 ], name = parts[ parts.length - 3]; return !!(ext === "dist" && pre === "json" && exports.__ignores.indexOf( name ) === -1 && e...
[ "function", "_configFilter", "(", "f", ")", "{", "var", "parts", "=", "f", ".", "split", "(", "\".\"", ")", ",", "ext", "=", "parts", "[", "parts", ".", "length", "-", "1", "]", ",", "pre", "=", "parts", "[", "parts", ".", "length", "-", "2", "...
filename filter function
[ "filename", "filter", "function" ]
39551c58d92a4ce065df25e6b9999b8495ca4833
https://github.com/SebastianOsuna/configure.js/blob/39551c58d92a4ce065df25e6b9999b8495ca4833/lib/configure.js#L90-L98
50,196
foru17/gulp-rev-custom-tag
tool.js
function (directory, filename) { return Path.join(directory, filename).replace(/^[a-z]:\\/i, '/').replace(/\\/g, '/'); }
javascript
function (directory, filename) { return Path.join(directory, filename).replace(/^[a-z]:\\/i, '/').replace(/\\/g, '/'); }
[ "function", "(", "directory", ",", "filename", ")", "{", "return", "Path", ".", "join", "(", "directory", ",", "filename", ")", ".", "replace", "(", "/", "^[a-z]:\\\\", "/", "i", ",", "'/'", ")", ".", "replace", "(", "/", "\\\\", "/", "g", ",", "'/...
Joins a directory and a filename, replaces Windows forward-slash with a backslash.
[ "Joins", "a", "directory", "and", "a", "filename", "replaces", "Windows", "forward", "-", "slash", "with", "a", "backslash", "." ]
96ef47647629f49b15d3f8fca024fc567bcb358e
https://github.com/foru17/gulp-rev-custom-tag/blob/96ef47647629f49b15d3f8fca024fc567bcb358e/tool.js#L27-L31
50,197
foru17/gulp-rev-custom-tag
tool.js
function (base, path, noStartingSlash) { if (base === path) { return ''; } // Sanitize inputs, convert windows to posix style slashes, ensure trailing slash for base base = base.replace(/^[a-z]:/i, '').replace(/\\/g, '/').replace(/\/$/g, '') + '/'; path = path.repla...
javascript
function (base, path, noStartingSlash) { if (base === path) { return ''; } // Sanitize inputs, convert windows to posix style slashes, ensure trailing slash for base base = base.replace(/^[a-z]:/i, '').replace(/\\/g, '/').replace(/\/$/g, '') + '/'; path = path.repla...
[ "function", "(", "base", ",", "path", ",", "noStartingSlash", ")", "{", "if", "(", "base", "===", "path", ")", "{", "return", "''", ";", "}", "// Sanitize inputs, convert windows to posix style slashes, ensure trailing slash for base", "base", "=", "base", ".", "rep...
Given a base path and resource path, will return resource path relative to the base. Also replaces Windows forward-slash with a backslash.
[ "Given", "a", "base", "path", "and", "resource", "path", "will", "return", "resource", "path", "relative", "to", "the", "base", ".", "Also", "replaces", "Windows", "forward", "-", "slash", "with", "a", "backslash", "." ]
96ef47647629f49b15d3f8fca024fc567bcb358e
https://github.com/foru17/gulp-rev-custom-tag/blob/96ef47647629f49b15d3f8fca024fc567bcb358e/tool.js#L37-L64
50,198
ksmithut/logget
index.js
Log
function Log(namespace) { // If it's called without new, still return a new instance. if (!(this instanceof Log)) { return new Log(namespace); } // Configure Log if it hasn't already if (!logger) { Log.configure(); } // This gets all of the log levels and applies them to this Object.keys(logger.levels).fo...
javascript
function Log(namespace) { // If it's called without new, still return a new instance. if (!(this instanceof Log)) { return new Log(namespace); } // Configure Log if it hasn't already if (!logger) { Log.configure(); } // This gets all of the log levels and applies them to this Object.keys(logger.levels).fo...
[ "function", "Log", "(", "namespace", ")", "{", "// If it's called without new, still return a new instance.", "if", "(", "!", "(", "this", "instanceof", "Log", ")", ")", "{", "return", "new", "Log", "(", "namespace", ")", ";", "}", "// Configure Log if it hasn't alr...
Log You create a new log by specifying a namespace. This basically only keeps track of the namepace prefix that goes into each log. If nothing is passed, then it doesn't prefix it with anything.
[ "Log", "You", "create", "a", "new", "log", "by", "specifying", "a", "namespace", ".", "This", "basically", "only", "keeps", "track", "of", "the", "namepace", "prefix", "that", "goes", "into", "each", "log", ".", "If", "nothing", "is", "passed", "then", "...
b04ea84cb573fb2aef8e7d46589c94d5a0c085d4
https://github.com/ksmithut/logget/blob/b04ea84cb573fb2aef8e7d46589c94d5a0c085d4/index.js#L31-L52
50,199
trekjs/utils
lib/pbkdf2.js
genSalt
function genSalt() { var len = arguments[0] === undefined ? 16 : arguments[0]; var encoding = arguments[1] === undefined ? 'hex' : arguments[1]; return (0, _token2['default'])(len, encoding); }
javascript
function genSalt() { var len = arguments[0] === undefined ? 16 : arguments[0]; var encoding = arguments[1] === undefined ? 'hex' : arguments[1]; return (0, _token2['default'])(len, encoding); }
[ "function", "genSalt", "(", ")", "{", "var", "len", "=", "arguments", "[", "0", "]", "===", "undefined", "?", "16", ":", "arguments", "[", "0", "]", ";", "var", "encoding", "=", "arguments", "[", "1", "]", "===", "undefined", "?", "'hex'", ":", "ar...
Generate a salt. @method @param {Number} len @param {String} encoding @return {Promise} by default 32 of slat length.
[ "Generate", "a", "salt", "." ]
a6c7138ec7f7ccdff95df85c6662e7cefcd94eb0
https://github.com/trekjs/utils/blob/a6c7138ec7f7ccdff95df85c6662e7cefcd94eb0/lib/pbkdf2.js#L29-L34