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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
nodeGame/nodegame-server | public/javascripts/nodegame-full.js | setupTimer | function setupTimer(opts) {
var name, timer;
name = opts.name || node.game.timer.name;
timer = node.timer.getTimer(name);
if (!timer) {
node.warn('setup("timer"): timer not found: ' + name);
return false;
... | javascript | function setupTimer(opts) {
var name, timer;
name = opts.name || node.game.timer.name;
timer = node.timer.getTimer(name);
if (!timer) {
node.warn('setup("timer"): timer not found: ' + name);
return false;
... | [
"function",
"setupTimer",
"(",
"opts",
")",
"{",
"var",
"name",
",",
"timer",
";",
"name",
"=",
"opts",
".",
"name",
"||",
"node",
".",
"game",
".",
"timer",
".",
"name",
";",
"timer",
"=",
"node",
".",
"timer",
".",
"getTimer",
"(",
"name",
")",
... | Helper function to setup a single timer. | [
"Helper",
"function",
"to",
"setup",
"a",
"single",
"timer",
"."
] | e59952399e7db8ca2cb600036867b2a543baf826 | https://github.com/nodeGame/nodegame-server/blob/e59952399e7db8ca2cb600036867b2a543baf826/public/javascripts/nodegame-full.js#L31453-L31483 | train |
nodeGame/nodegame-server | public/javascripts/nodegame-full.js | completed | function completed(event) {
var iframeDoc;
// IE < 10 (also 11?) gives 'Permission Denied' if trying to access
// the iframeDoc from the context of the function above.
// We need to re-get it from the DOM.
iframeDoc = J.getIFrameDocument(iframe);
... | javascript | function completed(event) {
var iframeDoc;
// IE < 10 (also 11?) gives 'Permission Denied' if trying to access
// the iframeDoc from the context of the function above.
// We need to re-get it from the DOM.
iframeDoc = J.getIFrameDocument(iframe);
... | [
"function",
"completed",
"(",
"event",
")",
"{",
"var",
"iframeDoc",
";",
"// IE < 10 (also 11?) gives 'Permission Denied' if trying to access",
"// the iframeDoc from the context of the function above.",
"// We need to re-get it from the DOM.",
"iframeDoc",
"=",
"J",
".",
"getIFrame... | We cannot get the iframeDoc here and use it in completed. See below. | [
"We",
"cannot",
"get",
"the",
"iframeDoc",
"here",
"and",
"use",
"it",
"in",
"completed",
".",
"See",
"below",
"."
] | e59952399e7db8ca2cb600036867b2a543baf826 | https://github.com/nodeGame/nodegame-server/blob/e59952399e7db8ca2cb600036867b2a543baf826/public/javascripts/nodegame-full.js#L32127-L32149 | train |
nodeGame/nodegame-server | public/javascripts/nodegame-full.js | function(w, data) {
return (w.senderToNameMap[data.id] || data.id) + ' ' +
(data.collapsed ? 'mini' : 'maxi') + 'mized the chat';
} | javascript | function(w, data) {
return (w.senderToNameMap[data.id] || data.id) + ' ' +
(data.collapsed ? 'mini' : 'maxi') + 'mized the chat';
} | [
"function",
"(",
"w",
",",
"data",
")",
"{",
"return",
"(",
"w",
".",
"senderToNameMap",
"[",
"data",
".",
"id",
"]",
"||",
"data",
".",
"id",
")",
"+",
"' '",
"+",
"(",
"data",
".",
"collapsed",
"?",
"'mini'",
":",
"'maxi'",
")",
"+",
"'mized th... | For both collapse and uncollapse. | [
"For",
"both",
"collapse",
"and",
"uncollapse",
"."
] | e59952399e7db8ca2cb600036867b2a543baf826 | https://github.com/nodeGame/nodegame-server/blob/e59952399e7db8ca2cb600036867b2a543baf826/public/javascripts/nodegame-full.js#L40621-L40624 | train | |
nodeGame/nodegame-server | public/javascripts/nodegame-full.js | FacePainter | function FacePainter(canvas, settings) {
this.canvas = new W.Canvas(canvas);
this.scaleX = canvas.width / ChernoffFaces.defaults.canvas.width;
this.scaleY = canvas.height / ChernoffFaces.defaults.canvas.heigth;
} | javascript | function FacePainter(canvas, settings) {
this.canvas = new W.Canvas(canvas);
this.scaleX = canvas.width / ChernoffFaces.defaults.canvas.width;
this.scaleY = canvas.height / ChernoffFaces.defaults.canvas.heigth;
} | [
"function",
"FacePainter",
"(",
"canvas",
",",
"settings",
")",
"{",
"this",
".",
"canvas",
"=",
"new",
"W",
".",
"Canvas",
"(",
"canvas",
")",
";",
"this",
".",
"scaleX",
"=",
"canvas",
".",
"width",
"/",
"ChernoffFaces",
".",
"defaults",
".",
"canvas... | FacePainter The class that actually draws the faces on the Canvas | [
"FacePainter",
"The",
"class",
"that",
"actually",
"draws",
"the",
"faces",
"on",
"the",
"Canvas"
] | e59952399e7db8ca2cb600036867b2a543baf826 | https://github.com/nodeGame/nodegame-server/blob/e59952399e7db8ca2cb600036867b2a543baf826/public/javascripts/nodegame-full.js#L42362-L42366 | train |
nodeGame/nodegame-server | public/javascripts/nodegame-full.js | objToLK | function objToLK(obj) {
var p, objLow;
objLow = {};
for (p in obj) {
if (obj.hasOwnProperty(p)) {
objLow[p.toLowerCase()] = obj[p];
}
}
return objLow;
} | javascript | function objToLK(obj) {
var p, objLow;
objLow = {};
for (p in obj) {
if (obj.hasOwnProperty(p)) {
objLow[p.toLowerCase()] = obj[p];
}
}
return objLow;
} | [
"function",
"objToLK",
"(",
"obj",
")",
"{",
"var",
"p",
",",
"objLow",
";",
"objLow",
"=",
"{",
"}",
";",
"for",
"(",
"p",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"hasOwnProperty",
"(",
"p",
")",
")",
"{",
"objLow",
"[",
"p",
".",
"toL... | Helper function for getUsStatesList | [
"Helper",
"function",
"for",
"getUsStatesList"
] | e59952399e7db8ca2cb600036867b2a543baf826 | https://github.com/nodeGame/nodegame-server/blob/e59952399e7db8ca2cb600036867b2a543baf826/public/javascripts/nodegame-full.js#L48418-L48427 | train |
nodeGame/nodegame-server | bin/static.js | invalidRange | function invalidRange(res) {
var body = 'Requested Range Not Satisfiable';
res.setHeader('Content-Type', 'text/plain');
res.setHeader('Content-Length', body.length);
res.statusCode = 416;
res.end(body);
} | javascript | function invalidRange(res) {
var body = 'Requested Range Not Satisfiable';
res.setHeader('Content-Type', 'text/plain');
res.setHeader('Content-Length', body.length);
res.statusCode = 416;
res.end(body);
} | [
"function",
"invalidRange",
"(",
"res",
")",
"{",
"var",
"body",
"=",
"'Requested Range Not Satisfiable'",
";",
"res",
".",
"setHeader",
"(",
"'Content-Type'",
",",
"'text/plain'",
")",
";",
"res",
".",
"setHeader",
"(",
"'Content-Length'",
",",
"body",
".",
"... | Respond with 416 "Requested Range Not Satisfiable"
@param {ServerResponse} res
@api private | [
"Respond",
"with",
"416",
"Requested",
"Range",
"Not",
"Satisfiable"
] | e59952399e7db8ca2cb600036867b2a543baf826 | https://github.com/nodeGame/nodegame-server/blob/e59952399e7db8ca2cb600036867b2a543baf826/bin/static.js#L77-L83 | train |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function( page, desiredHeight ) {
var pageParent = page.parent(),
toolbarsAffectingHeight = [],
// We use this function to filter fixed toolbars with option updatePagePadding set to
// true (which is the default) from our height subtraction, because fixed toolbars with
... | javascript | function( page, desiredHeight ) {
var pageParent = page.parent(),
toolbarsAffectingHeight = [],
// We use this function to filter fixed toolbars with option updatePagePadding set to
// true (which is the default) from our height subtraction, because fixed toolbars with
... | [
"function",
"(",
"page",
",",
"desiredHeight",
")",
"{",
"var",
"pageParent",
"=",
"page",
".",
"parent",
"(",
")",
",",
"toolbarsAffectingHeight",
"=",
"[",
"]",
",",
"// We use this function to filter fixed toolbars with option updatePagePadding set to",
"// true (which... | Subtract the height of external toolbars from the page height, if the page does not have internal toolbars of the same type. We take care to use the widget options if we find a widget instance and the element's data-attributes otherwise. | [
"Subtract",
"the",
"height",
"of",
"external",
"toolbars",
"from",
"the",
"page",
"height",
"if",
"the",
"page",
"does",
"not",
"have",
"internal",
"toolbars",
"of",
"the",
"same",
"type",
".",
"We",
"take",
"care",
"to",
"use",
"the",
"widget",
"options",... | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L7713-L7757 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function( height ) {
var page = $( "." + $.mobile.activePageClass ),
pageHeight = page.height(),
pageOuterHeight = page.outerHeight( true );
height = compensateToolbars( page,
( typeof height === "number" ) ? height : $.mobile.getScreenHeight() );... | javascript | function( height ) {
var page = $( "." + $.mobile.activePageClass ),
pageHeight = page.height(),
pageOuterHeight = page.outerHeight( true );
height = compensateToolbars( page,
( typeof height === "number" ) ? height : $.mobile.getScreenHeight() );... | [
"function",
"(",
"height",
")",
"{",
"var",
"page",
"=",
"$",
"(",
"\".\"",
"+",
"$",
".",
"mobile",
".",
"activePageClass",
")",
",",
"pageHeight",
"=",
"page",
".",
"height",
"(",
")",
",",
"pageOuterHeight",
"=",
"page",
".",
"outerHeight",
"(",
"... | simply set the active page's minimum height to screen height, depending on orientation | [
"simply",
"set",
"the",
"active",
"page",
"s",
"minimum",
"height",
"to",
"screen",
"height",
"depending",
"on",
"orientation"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L7884-L7899 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function() {
var offset = this.element.offset(),
scrollTop = this.window.scrollTop(),
screenHeight = $.mobile.getScreenHeight();
if ( offset.top < scrollTop || ( offset.top - scrollTop ) > screenHeight ) {
this.element.addClass( "ui-loader-fakefix... | javascript | function() {
var offset = this.element.offset(),
scrollTop = this.window.scrollTop(),
screenHeight = $.mobile.getScreenHeight();
if ( offset.top < scrollTop || ( offset.top - scrollTop ) > screenHeight ) {
this.element.addClass( "ui-loader-fakefix... | [
"function",
"(",
")",
"{",
"var",
"offset",
"=",
"this",
".",
"element",
".",
"offset",
"(",
")",
",",
"scrollTop",
"=",
"this",
".",
"window",
".",
"scrollTop",
"(",
")",
",",
"screenHeight",
"=",
"$",
".",
"mobile",
".",
"getScreenHeight",
"(",
")"... | check position of loader to see if it appears to be "fixed" to center if not, use abs positioning | [
"check",
"position",
"of",
"loader",
"to",
"see",
"if",
"it",
"appears",
"to",
"be",
"fixed",
"to",
"center",
"if",
"not",
"use",
"abs",
"positioning"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L8832-L8844 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function( url, data ) {
data = data || {};
//if there's forward history, wipe it
if ( this.getNext() ) {
this.clearForward();
}
// if the hash is included in the data make sure the shape
// is consistent for comparison
... | javascript | function( url, data ) {
data = data || {};
//if there's forward history, wipe it
if ( this.getNext() ) {
this.clearForward();
}
// if the hash is included in the data make sure the shape
// is consistent for comparison
... | [
"function",
"(",
"url",
",",
"data",
")",
"{",
"data",
"=",
"data",
"||",
"{",
"}",
";",
"//if there's forward history, wipe it",
"if",
"(",
"this",
".",
"getNext",
"(",
")",
")",
"{",
"this",
".",
"clearForward",
"(",
")",
";",
"}",
"// if the hash is i... | addNew is used whenever a new page is added | [
"addNew",
"is",
"used",
"whenever",
"a",
"new",
"page",
"is",
"added"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L10206-L10223 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function( historyEntry, direction ) {
// make sure to create a new object to pass down as the navigate event data
event.hashchangeState = $.extend({}, historyEntry);
event.hashchangeState.direction = direction;
} | javascript | function( historyEntry, direction ) {
// make sure to create a new object to pass down as the navigate event data
event.hashchangeState = $.extend({}, historyEntry);
event.hashchangeState.direction = direction;
} | [
"function",
"(",
"historyEntry",
",",
"direction",
")",
"{",
"// make sure to create a new object to pass down as the navigate event data",
"event",
".",
"hashchangeState",
"=",
"$",
".",
"extend",
"(",
"{",
"}",
",",
"historyEntry",
")",
";",
"event",
".",
"hashchang... | When the url is either forward or backward in history include the entry as data on the event object for merging as data in the navigate event | [
"When",
"the",
"url",
"is",
"either",
"forward",
"or",
"backward",
"in",
"history",
"include",
"the",
"entry",
"as",
"data",
"on",
"the",
"event",
"object",
"for",
"merging",
"as",
"data",
"in",
"the",
"navigate",
"event"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L10558-L10562 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function( href ) {
// we should do nothing if the user wants to manage their url base
// manually
if ( !$.mobile.dynamicBaseEnabled ) {
return;
}
// we should use the base tag if we can manipulate it dynamically
if ( $.support.dyn... | javascript | function( href ) {
// we should do nothing if the user wants to manage their url base
// manually
if ( !$.mobile.dynamicBaseEnabled ) {
return;
}
// we should use the base tag if we can manipulate it dynamically
if ( $.support.dyn... | [
"function",
"(",
"href",
")",
"{",
"// we should do nothing if the user wants to manage their url base",
"// manually",
"if",
"(",
"!",
"$",
".",
"mobile",
".",
"dynamicBaseEnabled",
")",
"{",
"return",
";",
"}",
"// we should use the base tag if we can manipulate it dynamica... | set the generated BASE element's href to a new page's base path | [
"set",
"the",
"generated",
"BASE",
"element",
"s",
"href",
"to",
"a",
"new",
"page",
"s",
"base",
"path"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L11727-L11740 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function() {
var options = this.options,
keepNative = $.trim( options.keepNative || "" ),
globalValue = $.trim( $.mobile.keepNative ),
optionValue = $.trim( options.keepNativeDefault ),
// Check if $.mobile.keepNative has changed from the factory default
... | javascript | function() {
var options = this.options,
keepNative = $.trim( options.keepNative || "" ),
globalValue = $.trim( $.mobile.keepNative ),
optionValue = $.trim( options.keepNativeDefault ),
// Check if $.mobile.keepNative has changed from the factory default
... | [
"function",
"(",
")",
"{",
"var",
"options",
"=",
"this",
".",
"options",
",",
"keepNative",
"=",
"$",
".",
"trim",
"(",
"options",
".",
"keepNative",
"||",
"\"\"",
")",
",",
"globalValue",
"=",
"$",
".",
"trim",
"(",
"$",
".",
"mobile",
".",
"keep... | Deprecated in 1.4 remove in 1.5 | [
"Deprecated",
"in",
"1",
".",
"4",
"remove",
"in",
"1",
".",
"5"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L11922-L11941 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function() {
var hist = $.mobile.navigate.history;
if ( this._isCloseable ) {
this._isCloseable = false;
// If the hash listening is enabled and there is at least one preceding history
// entry it's ok to go back. Initial pages with the dialog hash state are an examp... | javascript | function() {
var hist = $.mobile.navigate.history;
if ( this._isCloseable ) {
this._isCloseable = false;
// If the hash listening is enabled and there is at least one preceding history
// entry it's ok to go back. Initial pages with the dialog hash state are an examp... | [
"function",
"(",
")",
"{",
"var",
"hist",
"=",
"$",
".",
"mobile",
".",
"navigate",
".",
"history",
";",
"if",
"(",
"this",
".",
"_isCloseable",
")",
"{",
"this",
".",
"_isCloseable",
"=",
"false",
";",
"// If the hash listening is enabled and there is at leas... | Close method goes back in history | [
"Close",
"method",
"goes",
"back",
"in",
"history"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L14193-L14207 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function( options ) {
var key,
accordion = this._ui.accordion,
accordionWidget = this._ui.accordionWidget;
// Copy options
options = $.extend( {}, options );
if ( accordion.length && !accordionWidget ) {
this._ui.accordionWidget =
accordi... | javascript | function( options ) {
var key,
accordion = this._ui.accordion,
accordionWidget = this._ui.accordionWidget;
// Copy options
options = $.extend( {}, options );
if ( accordion.length && !accordionWidget ) {
this._ui.accordionWidget =
accordi... | [
"function",
"(",
"options",
")",
"{",
"var",
"key",
",",
"accordion",
"=",
"this",
".",
"_ui",
".",
"accordion",
",",
"accordionWidget",
"=",
"this",
".",
"_ui",
".",
"accordionWidget",
";",
"// Copy options",
"options",
"=",
"$",
".",
"extend",
"(",
"{"... | Adjust the keys inside options for inherited values | [
"Adjust",
"the",
"keys",
"inside",
"options",
"for",
"inherited",
"values"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L14275-L14306 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function() {
var dstOffset = this.handle.offset();
this._popup.offset( {
left: dstOffset.left + ( this.handle.width() - this._popup.width() ) / 2,
top: dstOffset.top - this._popup.outerHeight() - 5
});
} | javascript | function() {
var dstOffset = this.handle.offset();
this._popup.offset( {
left: dstOffset.left + ( this.handle.width() - this._popup.width() ) / 2,
top: dstOffset.top - this._popup.outerHeight() - 5
});
} | [
"function",
"(",
")",
"{",
"var",
"dstOffset",
"=",
"this",
".",
"handle",
".",
"offset",
"(",
")",
";",
"this",
".",
"_popup",
".",
"offset",
"(",
"{",
"left",
":",
"dstOffset",
".",
"left",
"+",
"(",
"this",
".",
"handle",
".",
"width",
"(",
")... | position the popup centered 5px above the handle | [
"position",
"the",
"popup",
"centered",
"5px",
"above",
"the",
"handle"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L16497-L16504 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function() {
var screen = this._ui.screen,
popupHeight = this._ui.container.outerHeight( true ),
screenHeight = screen.removeAttr( "style" ).height(),
// Subtracting 1 here is necessary for an obscure Andrdoid 4.0 bug where
// the browser hangs if the screen cove... | javascript | function() {
var screen = this._ui.screen,
popupHeight = this._ui.container.outerHeight( true ),
screenHeight = screen.removeAttr( "style" ).height(),
// Subtracting 1 here is necessary for an obscure Andrdoid 4.0 bug where
// the browser hangs if the screen cove... | [
"function",
"(",
")",
"{",
"var",
"screen",
"=",
"this",
".",
"_ui",
".",
"screen",
",",
"popupHeight",
"=",
"this",
".",
"_ui",
".",
"container",
".",
"outerHeight",
"(",
"true",
")",
",",
"screenHeight",
"=",
"screen",
".",
"removeAttr",
"(",
"\"styl... | Make sure the screen covers the entire document - CSS is sometimes not enough to accomplish this. | [
"Make",
"sure",
"the",
"screen",
"covers",
"the",
"entire",
"document",
"-",
"CSS",
"is",
"sometimes",
"not",
"enough",
"to",
"accomplish",
"this",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L17830-L17844 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function( theEvent ) {
var target,
targetElement = theEvent.target,
ui = this._ui;
if ( !this._isOpen ) {
return;
}
if ( targetElement !== ui.container[ 0 ] ) {
target = $( targetElement );
if ( !$.contains( ui.container[ 0 ],... | javascript | function( theEvent ) {
var target,
targetElement = theEvent.target,
ui = this._ui;
if ( !this._isOpen ) {
return;
}
if ( targetElement !== ui.container[ 0 ] ) {
target = $( targetElement );
if ( !$.contains( ui.container[ 0 ],... | [
"function",
"(",
"theEvent",
")",
"{",
"var",
"target",
",",
"targetElement",
"=",
"theEvent",
".",
"target",
",",
"ui",
"=",
"this",
".",
"_ui",
";",
"if",
"(",
"!",
"this",
".",
"_isOpen",
")",
"{",
"return",
";",
"}",
"if",
"(",
"targetElement",
... | When the popup is open, attempting to focus on an element that is not a child of the popup will redirect focus to the popup | [
"When",
"the",
"popup",
"is",
"open",
"attempting",
"to",
"focus",
"on",
"an",
"element",
"that",
"is",
"not",
"a",
"child",
"of",
"the",
"popup",
"will",
"redirect",
"focus",
"to",
"the",
"popup"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L17928-L17953 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function() {
var ua = navigator.userAgent,
platform = navigator.platform,
// Rendering engine is Webkit, and capture major version
wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ ),
wkversion = !!wkmatch && wkmatch[ 1 ],
os = null,
self = t... | javascript | function() {
var ua = navigator.userAgent,
platform = navigator.platform,
// Rendering engine is Webkit, and capture major version
wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ ),
wkversion = !!wkmatch && wkmatch[ 1 ],
os = null,
self = t... | [
"function",
"(",
")",
"{",
"var",
"ua",
"=",
"navigator",
".",
"userAgent",
",",
"platform",
"=",
"navigator",
".",
"platform",
",",
"// Rendering engine is Webkit, and capture major version",
"wkmatch",
"=",
"ua",
".",
"match",
"(",
"/",
"AppleWebKit\\/([0-9]+)",
... | check the browser and version and run needed workarounds | [
"check",
"the",
"browser",
"and",
"version",
"and",
"run",
"needed",
"workarounds"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L20125-L20152 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function() {
var $el = this.element,
header = $el.hasClass( "ui-header" ),
offset = Math.abs( $el.offset().top - this.window.scrollTop() );
if ( !header ) {
offset = Math.round( offset - this.window.height() + $el.outerHeight() ) - 60;
... | javascript | function() {
var $el = this.element,
header = $el.hasClass( "ui-header" ),
offset = Math.abs( $el.offset().top - this.window.scrollTop() );
if ( !header ) {
offset = Math.round( offset - this.window.height() + $el.outerHeight() ) - 60;
... | [
"function",
"(",
")",
"{",
"var",
"$el",
"=",
"this",
".",
"element",
",",
"header",
"=",
"$el",
".",
"hasClass",
"(",
"\"ui-header\"",
")",
",",
"offset",
"=",
"Math",
".",
"abs",
"(",
"$el",
".",
"offset",
"(",
")",
".",
"top",
"-",
"this",
"."... | Utility class for checking header and footer positions relative to viewport | [
"Utility",
"class",
"for",
"checking",
"header",
"and",
"footer",
"positions",
"relative",
"to",
"viewport"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L20155-L20163 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function( p, dir, desired, s, best ) {
var result, r, diff, desiredForArrow = {}, tip = {};
// If the arrow has no wiggle room along the edge of the popup, it cannot
// be displayed along the requested edge without it sticking out.
if ( s.arFull[ p.dimKey ] > s.guideDims[ p.dimKey ] ) {... | javascript | function( p, dir, desired, s, best ) {
var result, r, diff, desiredForArrow = {}, tip = {};
// If the arrow has no wiggle room along the edge of the popup, it cannot
// be displayed along the requested edge without it sticking out.
if ( s.arFull[ p.dimKey ] > s.guideDims[ p.dimKey ] ) {... | [
"function",
"(",
"p",
",",
"dir",
",",
"desired",
",",
"s",
",",
"best",
")",
"{",
"var",
"result",
",",
"r",
",",
"diff",
",",
"desiredForArrow",
"=",
"{",
"}",
",",
"tip",
"=",
"{",
"}",
";",
"// If the arrow has no wiggle room along the edge of the popu... | Pretend to show an arrow described by @p and @dir and calculate the distance from the desired point. If a best-distance is passed in, return the minimum of the one passed in and the one calculated. | [
"Pretend",
"to",
"show",
"an",
"arrow",
"described",
"by"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L20273-L20303 | train | |
sony/cdp-js | packages/cdp-mobile/dist/cdp.js | function (event) {
var target = event.target;
var e = event;
var ev;
// [CDP modified]: set target.clientX.
if (null == target.clientX || null == target.clientY) {
if (null != e.pageX && null != e.pageY) {
... | javascript | function (event) {
var target = event.target;
var e = event;
var ev;
// [CDP modified]: set target.clientX.
if (null == target.clientX || null == target.clientY) {
if (null != e.pageX && null != e.pageY) {
... | [
"function",
"(",
"event",
")",
"{",
"var",
"target",
"=",
"event",
".",
"target",
";",
"var",
"e",
"=",
"event",
";",
"var",
"ev",
";",
"// [CDP modified]: set target.clientX.",
"if",
"(",
"null",
"==",
"target",
".",
"clientX",
"||",
"null",
"==",
"targ... | ! iScroll.click patch | [
"!",
"iScroll",
".",
"click",
"patch"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-mobile/dist/cdp.js#L29662-L29683 | train | |
sony/cdp-js | packages/master-tasks/provider.js | setupByCopy | function setupByCopy() {
let task_dir;
let required_tasks;
try {
const config = require(path.join(process.cwd(), 'project.config'));
required_tasks = config.required_tasks;
if (!required_tasks) {
throw Error('no task required.');
}
task_dir = config.dir.t... | javascript | function setupByCopy() {
let task_dir;
let required_tasks;
try {
const config = require(path.join(process.cwd(), 'project.config'));
required_tasks = config.required_tasks;
if (!required_tasks) {
throw Error('no task required.');
}
task_dir = config.dir.t... | [
"function",
"setupByCopy",
"(",
")",
"{",
"let",
"task_dir",
";",
"let",
"required_tasks",
";",
"try",
"{",
"const",
"config",
"=",
"require",
"(",
"path",
".",
"join",
"(",
"process",
".",
"cwd",
"(",
")",
",",
"'project.config'",
")",
")",
";",
"requ... | call from packages | [
"call",
"from",
"packages"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/master-tasks/provider.js#L31-L69 | train |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function () {
var encTable = this._tables[0], decTable = this._tables[1],
sbox = encTable[4], sboxInv = decTable[4],
i, x, xInv, d=[], th=[], x2, x4, x8, s, tEnc, tDec;
// Compute double and third tables
for (i = 0; i < 256; i++) {
th[( d[i] = i<<1 ^ (i>>7)*283 )^i]=i;
}
for (x = xI... | javascript | function () {
var encTable = this._tables[0], decTable = this._tables[1],
sbox = encTable[4], sboxInv = decTable[4],
i, x, xInv, d=[], th=[], x2, x4, x8, s, tEnc, tDec;
// Compute double and third tables
for (i = 0; i < 256; i++) {
th[( d[i] = i<<1 ^ (i>>7)*283 )^i]=i;
}
for (x = xI... | [
"function",
"(",
")",
"{",
"var",
"encTable",
"=",
"this",
".",
"_tables",
"[",
"0",
"]",
",",
"decTable",
"=",
"this",
".",
"_tables",
"[",
"1",
"]",
",",
"sbox",
"=",
"encTable",
"[",
"4",
"]",
",",
"sboxInv",
"=",
"decTable",
"[",
"4",
"]",
... | Expand the S-box tables.
@private | [
"Expand",
"the",
"S",
"-",
"box",
"tables",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L199-L232 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (input, dir) {
if (input.length !== 4) {
throw new sjcl.exception.invalid("invalid aes block size");
}
var key = this._key[dir],
// state variables a,b,c,d are loaded with pre-whitened data
a = input[0] ^ key[0],
b = input[dir ? 3 : 1] ^ key[1],
c = ... | javascript | function (input, dir) {
if (input.length !== 4) {
throw new sjcl.exception.invalid("invalid aes block size");
}
var key = this._key[dir],
// state variables a,b,c,d are loaded with pre-whitened data
a = input[0] ^ key[0],
b = input[dir ? 3 : 1] ^ key[1],
c = ... | [
"function",
"(",
"input",
",",
"dir",
")",
"{",
"if",
"(",
"input",
".",
"length",
"!==",
"4",
")",
"{",
"throw",
"new",
"sjcl",
".",
"exception",
".",
"invalid",
"(",
"\"invalid aes block size\"",
")",
";",
"}",
"var",
"key",
"=",
"this",
".",
"_key... | Encryption and decryption core.
@param {Array} input Four words to be encrypted or decrypted.
@param dir The direction, 0 for encrypt and 1 for decrypt.
@return {Array} The four encrypted or decrypted words.
@private | [
"Encryption",
"and",
"decryption",
"core",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L241-L289 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (a, bstart, bend) {
a = sjcl.bitArray._shiftRight(a.slice(bstart/32), 32 - (bstart & 31)).slice(1);
return (bend === undefined) ? a : sjcl.bitArray.clamp(a, bend-bstart);
} | javascript | function (a, bstart, bend) {
a = sjcl.bitArray._shiftRight(a.slice(bstart/32), 32 - (bstart & 31)).slice(1);
return (bend === undefined) ? a : sjcl.bitArray.clamp(a, bend-bstart);
} | [
"function",
"(",
"a",
",",
"bstart",
",",
"bend",
")",
"{",
"a",
"=",
"sjcl",
".",
"bitArray",
".",
"_shiftRight",
"(",
"a",
".",
"slice",
"(",
"bstart",
"/",
"32",
")",
",",
"32",
"-",
"(",
"bstart",
"&",
"31",
")",
")",
".",
"slice",
"(",
"... | Array slices in units of bits.
@param {bitArray} a The array to slice.
@param {Number} bstart The offset to the start of the slice, in bits.
@param {Number} bend The offset to the end of the slice, in bits. If this is undefined,
slice until the end of the array.
@return {bitArray} The requested slice. | [
"Array",
"slices",
"in",
"units",
"of",
"bits",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L331-L334 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function(a, bstart, blength) {
// FIXME: this Math.floor is not necessary at all, but for some reason
// seems to suppress a bug in the Chromium JIT.
var x, sh = Math.floor((-bstart-blength) & 31);
if ((bstart + blength - 1 ^ bstart) & -32) {
// it crosses a boundary
x = (a[bstart/32|0] << (... | javascript | function(a, bstart, blength) {
// FIXME: this Math.floor is not necessary at all, but for some reason
// seems to suppress a bug in the Chromium JIT.
var x, sh = Math.floor((-bstart-blength) & 31);
if ((bstart + blength - 1 ^ bstart) & -32) {
// it crosses a boundary
x = (a[bstart/32|0] << (... | [
"function",
"(",
"a",
",",
"bstart",
",",
"blength",
")",
"{",
"// FIXME: this Math.floor is not necessary at all, but for some reason",
"// seems to suppress a bug in the Chromium JIT.",
"var",
"x",
",",
"sh",
"=",
"Math",
".",
"floor",
"(",
"(",
"-",
"bstart",
"-",
... | Extract a number packed into a bit array.
@param {bitArray} a The array to slice.
@param {Number} bstart The offset to the start of the slice, in bits.
@param {Number} length The length of the number to extract.
@return {Number} The requested slice. | [
"Extract",
"a",
"number",
"packed",
"into",
"a",
"bit",
"array",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L343-L355 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (a1, a2) {
if (a1.length === 0 || a2.length === 0) {
return a1.concat(a2);
}
var last = a1[a1.length-1], shift = sjcl.bitArray.getPartial(last);
if (shift === 32) {
return a1.concat(a2);
} else {
return sjcl.bitArray._shiftRight(a2, shift, last|0, a1.slice(0,a1.length-1))... | javascript | function (a1, a2) {
if (a1.length === 0 || a2.length === 0) {
return a1.concat(a2);
}
var last = a1[a1.length-1], shift = sjcl.bitArray.getPartial(last);
if (shift === 32) {
return a1.concat(a2);
} else {
return sjcl.bitArray._shiftRight(a2, shift, last|0, a1.slice(0,a1.length-1))... | [
"function",
"(",
"a1",
",",
"a2",
")",
"{",
"if",
"(",
"a1",
".",
"length",
"===",
"0",
"||",
"a2",
".",
"length",
"===",
"0",
")",
"{",
"return",
"a1",
".",
"concat",
"(",
"a2",
")",
";",
"}",
"var",
"last",
"=",
"a1",
"[",
"a1",
".",
"len... | Concatenate two bit arrays.
@param {bitArray} a1 The first array.
@param {bitArray} a2 The second array.
@return {bitArray} The concatenation of a1 and a2. | [
"Concatenate",
"two",
"bit",
"arrays",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L363-L374 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (a) {
var l = a.length, x;
if (l === 0) { return 0; }
x = a[l - 1];
return (l-1) * 32 + sjcl.bitArray.getPartial(x);
} | javascript | function (a) {
var l = a.length, x;
if (l === 0) { return 0; }
x = a[l - 1];
return (l-1) * 32 + sjcl.bitArray.getPartial(x);
} | [
"function",
"(",
"a",
")",
"{",
"var",
"l",
"=",
"a",
".",
"length",
",",
"x",
";",
"if",
"(",
"l",
"===",
"0",
")",
"{",
"return",
"0",
";",
"}",
"x",
"=",
"a",
"[",
"l",
"-",
"1",
"]",
";",
"return",
"(",
"l",
"-",
"1",
")",
"*",
"3... | Find the length of an array of bits.
@param {bitArray} a The array.
@return {Number} The length of a, in bits. | [
"Find",
"the",
"length",
"of",
"an",
"array",
"of",
"bits",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L381-L386 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (a, len) {
if (a.length * 32 < len) { return a; }
a = a.slice(0, Math.ceil(len / 32));
var l = a.length;
len = len & 31;
if (l > 0 && len) {
a[l-1] = sjcl.bitArray.partial(len, a[l-1] & 0x80000000 >> (len-1), 1);
}
return a;
} | javascript | function (a, len) {
if (a.length * 32 < len) { return a; }
a = a.slice(0, Math.ceil(len / 32));
var l = a.length;
len = len & 31;
if (l > 0 && len) {
a[l-1] = sjcl.bitArray.partial(len, a[l-1] & 0x80000000 >> (len-1), 1);
}
return a;
} | [
"function",
"(",
"a",
",",
"len",
")",
"{",
"if",
"(",
"a",
".",
"length",
"*",
"32",
"<",
"len",
")",
"{",
"return",
"a",
";",
"}",
"a",
"=",
"a",
".",
"slice",
"(",
"0",
",",
"Math",
".",
"ceil",
"(",
"len",
"/",
"32",
")",
")",
";",
... | Truncate an array.
@param {bitArray} a The array.
@param {Number} len The length to truncate to, in bits.
@return {bitArray} A new array, truncated to len bits. | [
"Truncate",
"an",
"array",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L394-L403 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (a, b) {
if (sjcl.bitArray.bitLength(a) !== sjcl.bitArray.bitLength(b)) {
return false;
}
var x = 0, i;
for (i=0; i<a.length; i++) {
x |= a[i]^b[i];
}
return (x === 0);
} | javascript | function (a, b) {
if (sjcl.bitArray.bitLength(a) !== sjcl.bitArray.bitLength(b)) {
return false;
}
var x = 0, i;
for (i=0; i<a.length; i++) {
x |= a[i]^b[i];
}
return (x === 0);
} | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"sjcl",
".",
"bitArray",
".",
"bitLength",
"(",
"a",
")",
"!==",
"sjcl",
".",
"bitArray",
".",
"bitLength",
"(",
"b",
")",
")",
"{",
"return",
"false",
";",
"}",
"var",
"x",
"=",
"0",
",",
... | Compare two arrays for equality in a predictable amount of time.
@param {bitArray} a The first array.
@param {bitArray} b The second array.
@return {boolean} true if a == b; false otherwise. | [
"Compare",
"two",
"arrays",
"for",
"equality",
"in",
"a",
"predictable",
"amount",
"of",
"time",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L432-L441 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (a, shift, carry, out) {
var i, last2=0, shift2;
if (out === undefined) { out = []; }
for (; shift >= 32; shift -= 32) {
out.push(carry);
carry = 0;
}
if (shift === 0) {
return out.concat(a);
}
for (i=0; i<a.length; i++) {
out.push(carry | a[i]>>>shift);
... | javascript | function (a, shift, carry, out) {
var i, last2=0, shift2;
if (out === undefined) { out = []; }
for (; shift >= 32; shift -= 32) {
out.push(carry);
carry = 0;
}
if (shift === 0) {
return out.concat(a);
}
for (i=0; i<a.length; i++) {
out.push(carry | a[i]>>>shift);
... | [
"function",
"(",
"a",
",",
"shift",
",",
"carry",
",",
"out",
")",
"{",
"var",
"i",
",",
"last2",
"=",
"0",
",",
"shift2",
";",
"if",
"(",
"out",
"===",
"undefined",
")",
"{",
"out",
"=",
"[",
"]",
";",
"}",
"for",
"(",
";",
"shift",
">=",
... | Shift an array right.
@param {bitArray} a The array to shift.
@param {Number} shift The number of bits to shift.
@param {Number} [carry=0] A byte to carry in
@param {bitArray} [out=[]] An array to prepend to the output.
@private | [
"Shift",
"an",
"array",
"right",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L450-L470 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (arr) {
var out = "", bl = sjcl.bitArray.bitLength(arr), i, tmp;
for (i=0; i<bl/8; i++) {
if ((i&3) === 0) {
tmp = arr[i/4];
}
out += String.fromCharCode(tmp >>> 24);
tmp <<= 8;
}
return decodeURIComponent(escape(out));
} | javascript | function (arr) {
var out = "", bl = sjcl.bitArray.bitLength(arr), i, tmp;
for (i=0; i<bl/8; i++) {
if ((i&3) === 0) {
tmp = arr[i/4];
}
out += String.fromCharCode(tmp >>> 24);
tmp <<= 8;
}
return decodeURIComponent(escape(out));
} | [
"function",
"(",
"arr",
")",
"{",
"var",
"out",
"=",
"\"\"",
",",
"bl",
"=",
"sjcl",
".",
"bitArray",
".",
"bitLength",
"(",
"arr",
")",
",",
"i",
",",
"tmp",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"bl",
"/",
"8",
";",
"i",
"++",
... | Convert from a bitArray to a UTF-8 string. | [
"Convert",
"from",
"a",
"bitArray",
"to",
"a",
"UTF",
"-",
"8",
"string",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L503-L513 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (str) {
str = unescape(encodeURIComponent(str));
var out = [], i, tmp=0;
for (i=0; i<str.length; i++) {
tmp = tmp << 8 | str.charCodeAt(i);
if ((i&3) === 3) {
out.push(tmp);
tmp = 0;
}
}
if (i&3) {
out.push(sjcl.bitArray.partial(8*(i&3), tmp));
}
... | javascript | function (str) {
str = unescape(encodeURIComponent(str));
var out = [], i, tmp=0;
for (i=0; i<str.length; i++) {
tmp = tmp << 8 | str.charCodeAt(i);
if ((i&3) === 3) {
out.push(tmp);
tmp = 0;
}
}
if (i&3) {
out.push(sjcl.bitArray.partial(8*(i&3), tmp));
}
... | [
"function",
"(",
"str",
")",
"{",
"str",
"=",
"unescape",
"(",
"encodeURIComponent",
"(",
"str",
")",
")",
";",
"var",
"out",
"=",
"[",
"]",
",",
"i",
",",
"tmp",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
... | Convert from a UTF-8 string to a bitArray. | [
"Convert",
"from",
"a",
"UTF",
"-",
"8",
"string",
"to",
"a",
"bitArray",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L516-L530 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (arr) {
var out = "", i;
for (i=0; i<arr.length; i++) {
out += ((arr[i]|0)+0xF00000000000).toString(16).substr(4);
}
return out.substr(0, sjcl.bitArray.bitLength(arr)/4);//.replace(/(.{8})/g, "$1 ");
} | javascript | function (arr) {
var out = "", i;
for (i=0; i<arr.length; i++) {
out += ((arr[i]|0)+0xF00000000000).toString(16).substr(4);
}
return out.substr(0, sjcl.bitArray.bitLength(arr)/4);//.replace(/(.{8})/g, "$1 ");
} | [
"function",
"(",
"arr",
")",
"{",
"var",
"out",
"=",
"\"\"",
",",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"length",
";",
"i",
"++",
")",
"{",
"out",
"+=",
"(",
"(",
"arr",
"[",
"i",
"]",
"|",
"0",
")",
"+",
"0xF0... | Convert from a bitArray to a hex string. | [
"Convert",
"from",
"a",
"bitArray",
"to",
"a",
"hex",
"string",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L542-L548 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (str) {
var i, out=[], len;
str = str.replace(/\s|0x/g, "");
len = str.length;
str = str + "00000000";
for (i=0; i<str.length; i+=8) {
out.push(parseInt(str.substr(i,8),16)^0);
}
return sjcl.bitArray.clamp(out, len*4);
} | javascript | function (str) {
var i, out=[], len;
str = str.replace(/\s|0x/g, "");
len = str.length;
str = str + "00000000";
for (i=0; i<str.length; i+=8) {
out.push(parseInt(str.substr(i,8),16)^0);
}
return sjcl.bitArray.clamp(out, len*4);
} | [
"function",
"(",
"str",
")",
"{",
"var",
"i",
",",
"out",
"=",
"[",
"]",
",",
"len",
";",
"str",
"=",
"str",
".",
"replace",
"(",
"/",
"\\s|0x",
"/",
"g",
",",
"\"\"",
")",
";",
"len",
"=",
"str",
".",
"length",
";",
"str",
"=",
"str",
"+",... | Convert from a hex string to a bitArray. | [
"Convert",
"from",
"a",
"hex",
"string",
"to",
"a",
"bitArray",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L550-L559 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (arr, _noEquals, _url) {
var out = "", i, bits=0, c = sjcl.codec.base64._chars, ta=0, bl = sjcl.bitArray.bitLength(arr);
if (_url) {
c = c.substr(0,62) + '-_';
}
for (i=0; out.length * 6 < bl; ) {
out += c.charAt((ta ^ arr[i]>>>bits) >>> 26);
if (bits < 6) {
ta = arr[i... | javascript | function (arr, _noEquals, _url) {
var out = "", i, bits=0, c = sjcl.codec.base64._chars, ta=0, bl = sjcl.bitArray.bitLength(arr);
if (_url) {
c = c.substr(0,62) + '-_';
}
for (i=0; out.length * 6 < bl; ) {
out += c.charAt((ta ^ arr[i]>>>bits) >>> 26);
if (bits < 6) {
ta = arr[i... | [
"function",
"(",
"arr",
",",
"_noEquals",
",",
"_url",
")",
"{",
"var",
"out",
"=",
"\"\"",
",",
"i",
",",
"bits",
"=",
"0",
",",
"c",
"=",
"sjcl",
".",
"codec",
".",
"base64",
".",
"_chars",
",",
"ta",
"=",
"0",
",",
"bl",
"=",
"sjcl",
".",
... | Convert from a bitArray to a base64 string. | [
"Convert",
"from",
"a",
"bitArray",
"to",
"a",
"base64",
"string",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L577-L595 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function(str, _url) {
str = str.replace(/\s|=/g,'');
var out = [], i, bits=0, c = sjcl.codec.base64._chars, ta=0, x;
if (_url) {
c = c.substr(0,62) + '-_';
}
for (i=0; i<str.length; i++) {
x = c.indexOf(str.charAt(i));
if (x < 0) {
throw new sjcl.exception.invalid("this isn... | javascript | function(str, _url) {
str = str.replace(/\s|=/g,'');
var out = [], i, bits=0, c = sjcl.codec.base64._chars, ta=0, x;
if (_url) {
c = c.substr(0,62) + '-_';
}
for (i=0; i<str.length; i++) {
x = c.indexOf(str.charAt(i));
if (x < 0) {
throw new sjcl.exception.invalid("this isn... | [
"function",
"(",
"str",
",",
"_url",
")",
"{",
"str",
"=",
"str",
".",
"replace",
"(",
"/",
"\\s|=",
"/",
"g",
",",
"''",
")",
";",
"var",
"out",
"=",
"[",
"]",
",",
"i",
",",
"bits",
"=",
"0",
",",
"c",
"=",
"sjcl",
".",
"codec",
".",
"b... | Convert from a base64 string to a bitArray | [
"Convert",
"from",
"a",
"base64",
"string",
"to",
"a",
"bitArray"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L598-L622 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (data) {
if (typeof data === "string") {
data = sjcl.codec.utf8String.toBits(data);
}
var i, b = this._buffer = sjcl.bitArray.concat(this._buffer, data),
ol = this._length,
nl = this._length = ol + sjcl.bitArray.bitLength(data);
for (i = 512+ol & -512; i <= nl; i+= 512) {
... | javascript | function (data) {
if (typeof data === "string") {
data = sjcl.codec.utf8String.toBits(data);
}
var i, b = this._buffer = sjcl.bitArray.concat(this._buffer, data),
ol = this._length,
nl = this._length = ol + sjcl.bitArray.bitLength(data);
for (i = 512+ol & -512; i <= nl; i+= 512) {
... | [
"function",
"(",
"data",
")",
"{",
"if",
"(",
"typeof",
"data",
"===",
"\"string\"",
")",
"{",
"data",
"=",
"sjcl",
".",
"codec",
".",
"utf8String",
".",
"toBits",
"(",
"data",
")",
";",
"}",
"var",
"i",
",",
"b",
"=",
"this",
".",
"_buffer",
"="... | Input several words to the hash.
@param {bitArray|String} data the data to hash.
@return this | [
"Input",
"several",
"words",
"to",
"the",
"hash",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L693-L704 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (words) {
var i, tmp, a, b,
w = words.slice(0),
h = this._h,
k = this._key,
h0 = h[0], h1 = h[1], h2 = h[2], h3 = h[3],
h4 = h[4], h5 = h[5], h6 = h[6], h7 = h[7];
/* Rationale for placement of |0 :
* If a value can overflow is original 32 bits by a factor of more th... | javascript | function (words) {
var i, tmp, a, b,
w = words.slice(0),
h = this._h,
k = this._key,
h0 = h[0], h1 = h[1], h2 = h[2], h3 = h[3],
h4 = h[4], h5 = h[5], h6 = h[6], h7 = h[7];
/* Rationale for placement of |0 :
* If a value can overflow is original 32 bits by a factor of more th... | [
"function",
"(",
"words",
")",
"{",
"var",
"i",
",",
"tmp",
",",
"a",
",",
"b",
",",
"w",
"=",
"words",
".",
"slice",
"(",
"0",
")",
",",
"h",
"=",
"this",
".",
"_h",
",",
"k",
"=",
"this",
".",
"_key",
",",
"h0",
"=",
"h",
"[",
"0",
"]... | Perform one cycle of SHA-256.
@param {bitArray} words one block of words.
@private | [
"Perform",
"one",
"cycle",
"of",
"SHA",
"-",
"256",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L790-L841 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function(prf, plaintext, iv, adata, tlen) {
var L, out = plaintext.slice(0), tag, w=sjcl.bitArray, ivl = w.bitLength(iv) / 8, ol = w.bitLength(out) / 8;
tlen = tlen || 64;
adata = adata || [];
if (ivl < 7) {
throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");
}
// compu... | javascript | function(prf, plaintext, iv, adata, tlen) {
var L, out = plaintext.slice(0), tag, w=sjcl.bitArray, ivl = w.bitLength(iv) / 8, ol = w.bitLength(out) / 8;
tlen = tlen || 64;
adata = adata || [];
if (ivl < 7) {
throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");
}
// compu... | [
"function",
"(",
"prf",
",",
"plaintext",
",",
"iv",
",",
"adata",
",",
"tlen",
")",
"{",
"var",
"L",
",",
"out",
"=",
"plaintext",
".",
"slice",
"(",
"0",
")",
",",
"tag",
",",
"w",
"=",
"sjcl",
".",
"bitArray",
",",
"ivl",
"=",
"w",
".",
"b... | Encrypt in CCM mode.
@static
@param {Object} prf The pseudorandom function. It must have a block size of 16 bytes.
@param {bitArray} plaintext The plaintext data.
@param {bitArray} iv The initialization value.
@param {bitArray} [adata=[]] The authenticated data.
@param {Number} [tlen=64] the desired tag length, in bit... | [
"Encrypt",
"in",
"CCM",
"mode",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L871-L892 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function(prf, ciphertext, iv, adata, tlen) {
tlen = tlen || 64;
adata = adata || [];
var L,
w=sjcl.bitArray,
ivl = w.bitLength(iv) / 8,
ol = w.bitLength(ciphertext),
out = w.clamp(ciphertext, ol - tlen),
tag = w.bitSlice(ciphertext, ol - tlen), tag2;
ol = (ol - ... | javascript | function(prf, ciphertext, iv, adata, tlen) {
tlen = tlen || 64;
adata = adata || [];
var L,
w=sjcl.bitArray,
ivl = w.bitLength(iv) / 8,
ol = w.bitLength(ciphertext),
out = w.clamp(ciphertext, ol - tlen),
tag = w.bitSlice(ciphertext, ol - tlen), tag2;
ol = (ol - ... | [
"function",
"(",
"prf",
",",
"ciphertext",
",",
"iv",
",",
"adata",
",",
"tlen",
")",
"{",
"tlen",
"=",
"tlen",
"||",
"64",
";",
"adata",
"=",
"adata",
"||",
"[",
"]",
";",
"var",
"L",
",",
"w",
"=",
"sjcl",
".",
"bitArray",
",",
"ivl",
"=",
... | Decrypt in CCM mode.
@static
@param {Object} prf The pseudorandom function. It must have a block size of 16 bytes.
@param {bitArray} ciphertext The ciphertext data.
@param {bitArray} iv The initialization value.
@param {bitArray} [[]] adata The authenticated data.
@param {Number} [64] tlen the desired tag length, in b... | [
"Decrypt",
"in",
"CCM",
"mode",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L903-L935 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function(prf, data, iv, tag, tlen, L) {
var enc, i, w=sjcl.bitArray, xor = w._xor4, ctr, l = data.length, bl=w.bitLength(data);
// start the ctr
ctr = w.concat([w.partial(8,L-1)],iv).concat([0,0,0]).slice(0,4);
// en/decrypt the tag
tag = w.bitSlice(xor(tag,prf.encrypt(ctr)), 0, tlen);
// en/... | javascript | function(prf, data, iv, tag, tlen, L) {
var enc, i, w=sjcl.bitArray, xor = w._xor4, ctr, l = data.length, bl=w.bitLength(data);
// start the ctr
ctr = w.concat([w.partial(8,L-1)],iv).concat([0,0,0]).slice(0,4);
// en/decrypt the tag
tag = w.bitSlice(xor(tag,prf.encrypt(ctr)), 0, tlen);
// en/... | [
"function",
"(",
"prf",
",",
"data",
",",
"iv",
",",
"tag",
",",
"tlen",
",",
"L",
")",
"{",
"var",
"enc",
",",
"i",
",",
"w",
"=",
"sjcl",
".",
"bitArray",
",",
"xor",
"=",
"w",
".",
"_xor4",
",",
"ctr",
",",
"l",
"=",
"data",
".",
"length... | CCM CTR mode.
Encrypt or decrypt data and tag with the prf in CCM-style CTR mode.
May mutate its arguments.
@param {Object} prf The PRF.
@param {bitArray} data The data to be encrypted or decrypted.
@param {bitArray} iv The initialization vector.
@param {bitArray} tag The authentication tag.
@param {Number} tlen The le... | [
"CCM",
"CTR",
"mode",
".",
"Encrypt",
"or",
"decrypt",
"data",
"and",
"tag",
"with",
"the",
"prf",
"in",
"CCM",
"-",
"style",
"CTR",
"mode",
".",
"May",
"mutate",
"its",
"arguments",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1007-L1028 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function(prp, plaintext, iv, adata, tlen, premac) {
if (sjcl.bitArray.bitLength(iv) !== 128) {
throw new sjcl.exception.invalid("ocb iv must be 128 bits");
}
var i,
times2 = sjcl.mode.ocb2._times2,
w = sjcl.bitArray,
xor = w._xor4,
checksum = [0,0,0,0],
delta = ... | javascript | function(prp, plaintext, iv, adata, tlen, premac) {
if (sjcl.bitArray.bitLength(iv) !== 128) {
throw new sjcl.exception.invalid("ocb iv must be 128 bits");
}
var i,
times2 = sjcl.mode.ocb2._times2,
w = sjcl.bitArray,
xor = w._xor4,
checksum = [0,0,0,0],
delta = ... | [
"function",
"(",
"prp",
",",
"plaintext",
",",
"iv",
",",
"adata",
",",
"tlen",
",",
"premac",
")",
"{",
"if",
"(",
"sjcl",
".",
"bitArray",
".",
"bitLength",
"(",
"iv",
")",
"!==",
"128",
")",
"{",
"throw",
"new",
"sjcl",
".",
"exception",
".",
... | Encrypt in OCB mode, version 2.0.
@param {Object} prp The block cipher. It must have a block size of 16 bytes.
@param {bitArray} plaintext The plaintext data.
@param {bitArray} iv The initialization value.
@param {bitArray} [adata=[]] The authenticated data.
@param {Number} [tlen=64] the desired tag length, in bits.
@... | [
"Encrypt",
"in",
"OCB",
"mode",
"version",
"2",
".",
"0",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1061-L1102 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function(prp, adata) {
var i,
times2 = sjcl.mode.ocb2._times2,
w = sjcl.bitArray,
xor = w._xor4,
checksum = [0,0,0,0],
delta = prp.encrypt([0,0,0,0]),
bi;
delta = xor(delta,times2(times2(delta)));
for (i=0; i+4<adata.length; i+=4) {
delta = times2(delt... | javascript | function(prp, adata) {
var i,
times2 = sjcl.mode.ocb2._times2,
w = sjcl.bitArray,
xor = w._xor4,
checksum = [0,0,0,0],
delta = prp.encrypt([0,0,0,0]),
bi;
delta = xor(delta,times2(times2(delta)));
for (i=0; i+4<adata.length; i+=4) {
delta = times2(delt... | [
"function",
"(",
"prp",
",",
"adata",
")",
"{",
"var",
"i",
",",
"times2",
"=",
"sjcl",
".",
"mode",
".",
"ocb2",
".",
"_times2",
",",
"w",
"=",
"sjcl",
".",
"bitArray",
",",
"xor",
"=",
"w",
".",
"_xor4",
",",
"checksum",
"=",
"[",
"0",
",",
... | PMAC authentication for OCB associated data.
@param {Object} prp The block cipher. It must have a block size of 16 bytes.
@param {bitArray} adata The authenticated data. | [
"PMAC",
"authentication",
"for",
"OCB",
"associated",
"data",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1166-L1189 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (prf, plaintext, iv, adata, tlen) {
var out, data = plaintext.slice(0), w=sjcl.bitArray;
tlen = tlen || 128;
adata = adata || [];
// encrypt and tag
out = sjcl.mode.gcm._ctrMode(true, prf, data, adata, iv, tlen);
return w.concat(out.data, out.tag);
} | javascript | function (prf, plaintext, iv, adata, tlen) {
var out, data = plaintext.slice(0), w=sjcl.bitArray;
tlen = tlen || 128;
adata = adata || [];
// encrypt and tag
out = sjcl.mode.gcm._ctrMode(true, prf, data, adata, iv, tlen);
return w.concat(out.data, out.tag);
} | [
"function",
"(",
"prf",
",",
"plaintext",
",",
"iv",
",",
"adata",
",",
"tlen",
")",
"{",
"var",
"out",
",",
"data",
"=",
"plaintext",
".",
"slice",
"(",
"0",
")",
",",
"w",
"=",
"sjcl",
".",
"bitArray",
";",
"tlen",
"=",
"tlen",
"||",
"128",
"... | Encrypt in GCM mode.
@static
@param {Object} prf The pseudorandom function. It must have a block size of 16 bytes.
@param {bitArray} plaintext The plaintext data.
@param {bitArray} iv The initialization value.
@param {bitArray} [adata=[]] The authenticated data.
@param {Number} [tlen=128] The desired tag length, in bi... | [
"Encrypt",
"in",
"GCM",
"mode",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1222-L1231 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (prf, ciphertext, iv, adata, tlen) {
var out, data = ciphertext.slice(0), tag, w=sjcl.bitArray, l=w.bitLength(data);
tlen = tlen || 128;
adata = adata || [];
// Slice tag out of data
if (tlen <= l) {
tag = w.bitSlice(data, l-tlen);
data = w.bitSlice(data, 0, l-tlen);
} else... | javascript | function (prf, ciphertext, iv, adata, tlen) {
var out, data = ciphertext.slice(0), tag, w=sjcl.bitArray, l=w.bitLength(data);
tlen = tlen || 128;
adata = adata || [];
// Slice tag out of data
if (tlen <= l) {
tag = w.bitSlice(data, l-tlen);
data = w.bitSlice(data, 0, l-tlen);
} else... | [
"function",
"(",
"prf",
",",
"ciphertext",
",",
"iv",
",",
"adata",
",",
"tlen",
")",
"{",
"var",
"out",
",",
"data",
"=",
"ciphertext",
".",
"slice",
"(",
"0",
")",
",",
"tag",
",",
"w",
"=",
"sjcl",
".",
"bitArray",
",",
"l",
"=",
"w",
".",
... | Decrypt in GCM mode.
@static
@param {Object} prf The pseudorandom function. It must have a block size of 16 bytes.
@param {bitArray} ciphertext The ciphertext data.
@param {bitArray} iv The initialization value.
@param {bitArray} [adata=[]] The authenticated data.
@param {Number} [tlen=128] The desired tag length, in ... | [
"Decrypt",
"in",
"GCM",
"mode",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1242-L1263 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function(encrypt, prf, data, adata, iv, tlen) {
var H, J0, S0, enc, i, ctr, tag, last, l, bl, abl, ivbl, w=sjcl.bitArray;
// Calculate data lengths
l = data.length;
bl = w.bitLength(data);
abl = w.bitLength(adata);
ivbl = w.bitLength(iv);
// Calculate the parameters
H = prf.encrypt([0,... | javascript | function(encrypt, prf, data, adata, iv, tlen) {
var H, J0, S0, enc, i, ctr, tag, last, l, bl, abl, ivbl, w=sjcl.bitArray;
// Calculate data lengths
l = data.length;
bl = w.bitLength(data);
abl = w.bitLength(adata);
ivbl = w.bitLength(iv);
// Calculate the parameters
H = prf.encrypt([0,... | [
"function",
"(",
"encrypt",
",",
"prf",
",",
"data",
",",
"adata",
",",
"iv",
",",
"tlen",
")",
"{",
"var",
"H",
",",
"J0",
",",
"S0",
",",
"enc",
",",
"i",
",",
"ctr",
",",
"tag",
",",
"last",
",",
"l",
",",
"bl",
",",
"abl",
",",
"ivbl",
... | GCM CTR mode.
Encrypt or decrypt data and tag with the prf in GCM-style CTR mode.
@param {Boolean} encrypt True if encrypt, false if decrypt.
@param {Object} prf The PRF.
@param {bitArray} data The data to be encrypted or decrypted.
@param {bitArray} iv The initialization vector.
@param {bitArray} adata The associated ... | [
"GCM",
"CTR",
"mode",
".",
"Encrypt",
"or",
"decrypt",
"data",
"and",
"tag",
"with",
"the",
"prf",
"in",
"GCM",
"-",
"style",
"CTR",
"mode",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1322-L1382 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (paranoia) {
var entropyRequired = this._PARANOIA_LEVELS[ (paranoia !== undefined) ? paranoia : this._defaultParanoia ];
if (this._strength && this._strength >= entropyRequired) {
return (this._poolEntropy[0] > this._BITS_PER_RESEED && (new Date()).valueOf() > this._nextReseed) ?
this._R... | javascript | function (paranoia) {
var entropyRequired = this._PARANOIA_LEVELS[ (paranoia !== undefined) ? paranoia : this._defaultParanoia ];
if (this._strength && this._strength >= entropyRequired) {
return (this._poolEntropy[0] > this._BITS_PER_RESEED && (new Date()).valueOf() > this._nextReseed) ?
this._R... | [
"function",
"(",
"paranoia",
")",
"{",
"var",
"entropyRequired",
"=",
"this",
".",
"_PARANOIA_LEVELS",
"[",
"(",
"paranoia",
"!==",
"undefined",
")",
"?",
"paranoia",
":",
"this",
".",
"_defaultParanoia",
"]",
";",
"if",
"(",
"this",
".",
"_strength",
"&&"... | Is the generator ready? | [
"Is",
"the",
"generator",
"ready?"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1713-L1725 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (paranoia) {
var entropyRequired = this._PARANOIA_LEVELS[ paranoia ? paranoia : this._defaultParanoia ];
if (this._strength >= entropyRequired) {
return 1.0;
} else {
return (this._poolStrength > entropyRequired) ?
1.0 :
this._poolStrength / entropyRequired;
}
} | javascript | function (paranoia) {
var entropyRequired = this._PARANOIA_LEVELS[ paranoia ? paranoia : this._defaultParanoia ];
if (this._strength >= entropyRequired) {
return 1.0;
} else {
return (this._poolStrength > entropyRequired) ?
1.0 :
this._poolStrength / entropyRequired;
}
} | [
"function",
"(",
"paranoia",
")",
"{",
"var",
"entropyRequired",
"=",
"this",
".",
"_PARANOIA_LEVELS",
"[",
"paranoia",
"?",
"paranoia",
":",
"this",
".",
"_defaultParanoia",
"]",
";",
"if",
"(",
"this",
".",
"_strength",
">=",
"entropyRequired",
")",
"{",
... | Get the generator's progress toward readiness, as a fraction | [
"Get",
"the",
"generator",
"s",
"progress",
"toward",
"readiness",
"as",
"a",
"fraction"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1728-L1738 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function () {
if (this._collectorsStarted) { return; }
this._eventListener = {
loadTimeCollector: this._bind(this._loadTimeCollector),
mouseCollector: this._bind(this._mouseCollector),
keyboardCollector: this._bind(this._keyboardCollector),
accelerometerCollector: this._bind(this._accel... | javascript | function () {
if (this._collectorsStarted) { return; }
this._eventListener = {
loadTimeCollector: this._bind(this._loadTimeCollector),
mouseCollector: this._bind(this._mouseCollector),
keyboardCollector: this._bind(this._keyboardCollector),
accelerometerCollector: this._bind(this._accel... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_collectorsStarted",
")",
"{",
"return",
";",
"}",
"this",
".",
"_eventListener",
"=",
"{",
"loadTimeCollector",
":",
"this",
".",
"_bind",
"(",
"this",
".",
"_loadTimeCollector",
")",
",",
"mouseCollecto... | start the built-in entropy collectors | [
"start",
"the",
"built",
"-",
"in",
"entropy",
"collectors"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1741-L1767 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function () {
if (!this._collectorsStarted) { return; }
if (window.removeEventListener) {
window.removeEventListener("load", this._eventListener.loadTimeCollector, false);
window.removeEventListener("mousemove", this._eventListener.mouseCollector, false);
window.removeEventListener("keypress"... | javascript | function () {
if (!this._collectorsStarted) { return; }
if (window.removeEventListener) {
window.removeEventListener("load", this._eventListener.loadTimeCollector, false);
window.removeEventListener("mousemove", this._eventListener.mouseCollector, false);
window.removeEventListener("keypress"... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_collectorsStarted",
")",
"{",
"return",
";",
"}",
"if",
"(",
"window",
".",
"removeEventListener",
")",
"{",
"window",
".",
"removeEventListener",
"(",
"\"load\"",
",",
"this",
".",
"_eventListener"... | stop the built-in entropy collectors | [
"stop",
"the",
"built",
"-",
"in",
"entropy",
"collectors"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1770-L1786 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (name, cb) {
var i, j, cbs=this._callbacks[name], jsTemp=[];
/* I'm not sure if this is necessary; in C++, iterating over a
* collection and modifying it at the same time is a no-no.
*/
for (j in cbs) {
if (cbs.hasOwnProperty(j) && cbs[j] === cb) {
jsTemp.push(j);
}
... | javascript | function (name, cb) {
var i, j, cbs=this._callbacks[name], jsTemp=[];
/* I'm not sure if this is necessary; in C++, iterating over a
* collection and modifying it at the same time is a no-no.
*/
for (j in cbs) {
if (cbs.hasOwnProperty(j) && cbs[j] === cb) {
jsTemp.push(j);
}
... | [
"function",
"(",
"name",
",",
"cb",
")",
"{",
"var",
"i",
",",
"j",
",",
"cbs",
"=",
"this",
".",
"_callbacks",
"[",
"name",
"]",
",",
"jsTemp",
"=",
"[",
"]",
";",
"/* I'm not sure if this is necessary; in C++, iterating over a\n * collection and modifying it... | remove an event listener for progress or seeded-ness | [
"remove",
"an",
"event",
"listener",
"for",
"progress",
"or",
"seeded",
"-",
"ness"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1799-L1816 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function () {
for (var i=0; i<4; i++) {
this._counter[i] = this._counter[i]+1 | 0;
if (this._counter[i]) { break; }
}
return this._cipher.encrypt(this._counter);
} | javascript | function () {
for (var i=0; i<4; i++) {
this._counter[i] = this._counter[i]+1 | 0;
if (this._counter[i]) { break; }
}
return this._cipher.encrypt(this._counter);
} | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"this",
".",
"_counter",
"[",
"i",
"]",
"=",
"this",
".",
"_counter",
"[",
"i",
"]",
"+",
"1",
"|",
"0",
";",
"if",
"(",
"this",
... | Generate 4 random words, no reseed, no gate.
@private | [
"Generate",
"4",
"random",
"words",
"no",
"reseed",
"no",
"gate",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1828-L1834 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (seedWords) {
this._key = sjcl.hash.sha256.hash(this._key.concat(seedWords));
this._cipher = new sjcl.cipher.aes(this._key);
for (var i=0; i<4; i++) {
this._counter[i] = this._counter[i]+1 | 0;
if (this._counter[i]) { break; }
}
} | javascript | function (seedWords) {
this._key = sjcl.hash.sha256.hash(this._key.concat(seedWords));
this._cipher = new sjcl.cipher.aes(this._key);
for (var i=0; i<4; i++) {
this._counter[i] = this._counter[i]+1 | 0;
if (this._counter[i]) { break; }
}
} | [
"function",
"(",
"seedWords",
")",
"{",
"this",
".",
"_key",
"=",
"sjcl",
".",
"hash",
".",
"sha256",
".",
"hash",
"(",
"this",
".",
"_key",
".",
"concat",
"(",
"seedWords",
")",
")",
";",
"this",
".",
"_cipher",
"=",
"new",
"sjcl",
".",
"cipher",
... | Reseed the generator with the given words
@private | [
"Reseed",
"the",
"generator",
"with",
"the",
"given",
"words"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1847-L1854 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (full) {
var reseedData = [], strength = 0, i;
this._nextReseed = reseedData[0] =
(new Date()).valueOf() + this._MILLISECONDS_PER_RESEED;
for (i=0; i<16; i++) {
/* On some browsers, this is cryptographically random. So we might
* as well toss it in the pot and stir...
*... | javascript | function (full) {
var reseedData = [], strength = 0, i;
this._nextReseed = reseedData[0] =
(new Date()).valueOf() + this._MILLISECONDS_PER_RESEED;
for (i=0; i<16; i++) {
/* On some browsers, this is cryptographically random. So we might
* as well toss it in the pot and stir...
*... | [
"function",
"(",
"full",
")",
"{",
"var",
"reseedData",
"=",
"[",
"]",
",",
"strength",
"=",
"0",
",",
"i",
";",
"this",
".",
"_nextReseed",
"=",
"reseedData",
"[",
"0",
"]",
"=",
"(",
"new",
"Date",
"(",
")",
")",
".",
"valueOf",
"(",
")",
"+"... | reseed the data from the entropy pools
@param full If set, use all the entropy pools in the reseed. | [
"reseed",
"the",
"data",
"from",
"the",
"entropy",
"pools"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L1859-L1894 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (obj) {
var i, out='{', comma='';
for (i in obj) {
if (obj.hasOwnProperty(i)) {
if (!i.match(/^[a-z0-9]+$/i)) {
throw new sjcl.exception.invalid("json encode: invalid property name");
}
out += comma + '"' + i + '":';
comma = ',';
switch (typeof o... | javascript | function (obj) {
var i, out='{', comma='';
for (i in obj) {
if (obj.hasOwnProperty(i)) {
if (!i.match(/^[a-z0-9]+$/i)) {
throw new sjcl.exception.invalid("json encode: invalid property name");
}
out += comma + '"' + i + '":';
comma = ',';
switch (typeof o... | [
"function",
"(",
"obj",
")",
"{",
"var",
"i",
",",
"out",
"=",
"'{'",
",",
"comma",
"=",
"''",
";",
"for",
"(",
"i",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"hasOwnProperty",
"(",
"i",
")",
")",
"{",
"if",
"(",
"!",
"i",
".",
"match",... | Encode a flat structure into a JSON string.
@param {Object} obj The structure to encode.
@return {String} A JSON string.
@throws {sjcl.exception.invalid} if obj has a non-alphanumeric property.
@throws {sjcl.exception.bug} if a parameter has an unsupported type. | [
"Encode",
"a",
"flat",
"structure",
"into",
"a",
"JSON",
"string",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L2182-L2212 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (target, src, requireSame) {
if (target === undefined) { target = {}; }
if (src === undefined) { return target; }
var i;
for (i in src) {
if (src.hasOwnProperty(i)) {
if (requireSame && target[i] !== undefined && target[i] !== src[i]) {
throw new sjcl.exception.invalid("... | javascript | function (target, src, requireSame) {
if (target === undefined) { target = {}; }
if (src === undefined) { return target; }
var i;
for (i in src) {
if (src.hasOwnProperty(i)) {
if (requireSame && target[i] !== undefined && target[i] !== src[i]) {
throw new sjcl.exception.invalid("... | [
"function",
"(",
"target",
",",
"src",
",",
"requireSame",
")",
"{",
"if",
"(",
"target",
"===",
"undefined",
")",
"{",
"target",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"src",
"===",
"undefined",
")",
"{",
"return",
"target",
";",
"}",
"var",
"i",
"... | Insert all elements of src into target, modifying and returning target.
@param {Object} target The object to be modified.
@param {Object} src The object to pull data from.
@param {boolean} [requireSame=false] If true, throw an exception if any field of target differs from corresponding field of src.
@return {Object} ta... | [
"Insert",
"all",
"elements",
"of",
"src",
"into",
"target",
"modifying",
"and",
"returning",
"target",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L2248-L2261 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (plus, minus) {
var out = {}, i;
for (i in plus) {
if (plus.hasOwnProperty(i) && plus[i] !== minus[i]) {
out[i] = plus[i];
}
}
return out;
} | javascript | function (plus, minus) {
var out = {}, i;
for (i in plus) {
if (plus.hasOwnProperty(i) && plus[i] !== minus[i]) {
out[i] = plus[i];
}
}
return out;
} | [
"function",
"(",
"plus",
",",
"minus",
")",
"{",
"var",
"out",
"=",
"{",
"}",
",",
"i",
";",
"for",
"(",
"i",
"in",
"plus",
")",
"{",
"if",
"(",
"plus",
".",
"hasOwnProperty",
"(",
"i",
")",
"&&",
"plus",
"[",
"i",
"]",
"!==",
"minus",
"[",
... | Remove all elements of minus from plus. Does not modify plus.
@private | [
"Remove",
"all",
"elements",
"of",
"minus",
"from",
"plus",
".",
"Does",
"not",
"modify",
"plus",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L2266-L2276 | train | |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js | function (src, filter) {
var out = {}, i;
for (i=0; i<filter.length; i++) {
if (src[filter[i]] !== undefined) {
out[filter[i]] = src[filter[i]];
}
}
return out;
} | javascript | function (src, filter) {
var out = {}, i;
for (i=0; i<filter.length; i++) {
if (src[filter[i]] !== undefined) {
out[filter[i]] = src[filter[i]];
}
}
return out;
} | [
"function",
"(",
"src",
",",
"filter",
")",
"{",
"var",
"out",
"=",
"{",
"}",
",",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"filter",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"src",
"[",
"filter",
"[",
"i",
"]",
"]",... | Return only the specified elements of src.
@private | [
"Return",
"only",
"the",
"specified",
"elements",
"of",
"src",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js#L2281-L2289 | train | |
sony/cdp-js | packages/cafeteria/docs/localize/resource_conv.js | function (singular) {
var self = this;
this.singluer = singular;
this.requireDefaultFile = false;
// [CDP customize]
this.folderName = '..\\..\\app\\res\\locales';
// [CDP customize]
this.formatLine = function (key, value) {
var v2 = '' + value;
return ' "' + key + '": "' + ... | javascript | function (singular) {
var self = this;
this.singluer = singular;
this.requireDefaultFile = false;
// [CDP customize]
this.folderName = '..\\..\\app\\res\\locales';
// [CDP customize]
this.formatLine = function (key, value) {
var v2 = '' + value;
return ' "' + key + '": "' + ... | [
"function",
"(",
"singular",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"singluer",
"=",
"singular",
";",
"this",
".",
"requireDefaultFile",
"=",
"false",
";",
"// [CDP customize]",
"this",
".",
"folderName",
"=",
"'..\\\\..\\\\app\\\\res\\\\locales... | JSON file formatter | [
"JSON",
"file",
"formatter"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/docs/localize/resource_conv.js#L34-L117 | train | |
sony/cdp-js | packages/cafeteria/docs/localize/resource_conv.js | function() {
this.requireDefaultFile = true;
this.folderName = 'conf';
this.isDefaultLocale = function (localeKey) {
if (localeKey == 'en-us' || localeKey == 'en-US') {
return true;
}
return false;
};
this.getDefaultFilePath = function (folderPath) {
retur... | javascript | function() {
this.requireDefaultFile = true;
this.folderName = 'conf';
this.isDefaultLocale = function (localeKey) {
if (localeKey == 'en-us' || localeKey == 'en-US') {
return true;
}
return false;
};
this.getDefaultFilePath = function (folderPath) {
retur... | [
"function",
"(",
")",
"{",
"this",
".",
"requireDefaultFile",
"=",
"true",
";",
"this",
".",
"folderName",
"=",
"'conf'",
";",
"this",
".",
"isDefaultLocale",
"=",
"function",
"(",
"localeKey",
")",
"{",
"if",
"(",
"localeKey",
"==",
"'en-us'",
"||",
"lo... | Play framework language file formatter | [
"Play",
"framework",
"language",
"file",
"formatter"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/docs/localize/resource_conv.js#L122-L153 | train | |
sony/cdp-js | packages/cafeteria/docs/localize/resource_conv.js | findExcelFile | function findExcelFile() {
var files = fso.getFolder(".").Files;
for (var e = new Enumerator(files) ; !e.atEnd() ; e.moveNext()) {
var file = e.item();
// [CDP customize]
var extXLSX = '.xlsx';
var extODS = '.ods';
if (file.Name.substr(file.Name.length - extXLSX.length) =... | javascript | function findExcelFile() {
var files = fso.getFolder(".").Files;
for (var e = new Enumerator(files) ; !e.atEnd() ; e.moveNext()) {
var file = e.item();
// [CDP customize]
var extXLSX = '.xlsx';
var extODS = '.ods';
if (file.Name.substr(file.Name.length - extXLSX.length) =... | [
"function",
"findExcelFile",
"(",
")",
"{",
"var",
"files",
"=",
"fso",
".",
"getFolder",
"(",
"\".\"",
")",
".",
"Files",
";",
"for",
"(",
"var",
"e",
"=",
"new",
"Enumerator",
"(",
"files",
")",
";",
"!",
"e",
".",
"atEnd",
"(",
")",
";",
"e",
... | Find first .ods file | [
"Find",
"first",
".",
"ods",
"file"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/docs/localize/resource_conv.js#L361-L376 | train |
sony/cdp-js | packages/master-tasks/tasks/srcmap.js | getNodeFromFiles | function getNodeFromFiles(scriptFile, mapFile) {
if (fs.existsSync(scriptFile) && fs.existsSync(mapFile)) {
try {
return SourceNode.fromStringWithSourceMap(
getScriptFromFile(scriptFile),
new SourceMapConsumer(getMapFromMapFile(mapFile))
);
} c... | javascript | function getNodeFromFiles(scriptFile, mapFile) {
if (fs.existsSync(scriptFile) && fs.existsSync(mapFile)) {
try {
return SourceNode.fromStringWithSourceMap(
getScriptFromFile(scriptFile),
new SourceMapConsumer(getMapFromMapFile(mapFile))
);
} c... | [
"function",
"getNodeFromFiles",
"(",
"scriptFile",
",",
"mapFile",
")",
"{",
"if",
"(",
"fs",
".",
"existsSync",
"(",
"scriptFile",
")",
"&&",
"fs",
".",
"existsSync",
"(",
"mapFile",
")",
")",
"{",
"try",
"{",
"return",
"SourceNode",
".",
"fromStringWithS... | get sourceNode from script and map files | [
"get",
"sourceNode",
"from",
"script",
"and",
"map",
"files"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/master-tasks/tasks/srcmap.js#L30-L44 | train |
sony/cdp-js | packages/master-tasks/tasks/srcmap.js | getNodeFromCode | function getNodeFromCode(code) {
if (convert.mapFileCommentRegex.test(code)) {
try {
return SourceNode.fromStringWithSourceMap(
convertCode2Script(code),
new SourceMapConsumer(convert.fromComment(code).toObject())
);
} catch (error) {
... | javascript | function getNodeFromCode(code) {
if (convert.mapFileCommentRegex.test(code)) {
try {
return SourceNode.fromStringWithSourceMap(
convertCode2Script(code),
new SourceMapConsumer(convert.fromComment(code).toObject())
);
} catch (error) {
... | [
"function",
"getNodeFromCode",
"(",
"code",
")",
"{",
"if",
"(",
"convert",
".",
"mapFileCommentRegex",
".",
"test",
"(",
"code",
")",
")",
"{",
"try",
"{",
"return",
"SourceNode",
".",
"fromStringWithSourceMap",
"(",
"convertCode2Script",
"(",
"code",
")",
... | get sourceNode from code | [
"get",
"sourceNode",
"from",
"code"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/master-tasks/tasks/srcmap.js#L47-L65 | train |
sony/cdp-js | packages/master-tasks/tasks/srcmap.js | getCodeFromNode | function getCodeFromNode(node, renameSources, options) {
const code_map = getCodeMap(node);
const rename = renameSources;
const objMap = code_map.map.toJSON();
let i, n;
if (rename) {
if ('string' === typeof rename) {
for (i = 0, n = objMap.sources.length; i < n; i++) {
... | javascript | function getCodeFromNode(node, renameSources, options) {
const code_map = getCodeMap(node);
const rename = renameSources;
const objMap = code_map.map.toJSON();
let i, n;
if (rename) {
if ('string' === typeof rename) {
for (i = 0, n = objMap.sources.length; i < n; i++) {
... | [
"function",
"getCodeFromNode",
"(",
"node",
",",
"renameSources",
",",
"options",
")",
"{",
"const",
"code_map",
"=",
"getCodeMap",
"(",
"node",
")",
";",
"const",
"rename",
"=",
"renameSources",
";",
"const",
"objMap",
"=",
"code_map",
".",
"map",
".",
"t... | get code with inline-source-map from file SourceNode | [
"get",
"code",
"with",
"inline",
"-",
"source",
"-",
"map",
"from",
"file",
"SourceNode"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/master-tasks/tasks/srcmap.js#L68-L93 | train |
sony/cdp-js | packages/master-tasks/tasks/srcmap.js | separateScriptAndMapFromScriptFile | function separateScriptAndMapFromScriptFile(scriptFile, multiline, mapPath) {
const node = getNodeFromScriptFile(scriptFile);
mapPath = mapPath || path.basename(scriptFile) + '.map';
return {
script: node.toString().replace(/\r\n/gm, '\n') + (
multiline
? ('/*# sourceMappingU... | javascript | function separateScriptAndMapFromScriptFile(scriptFile, multiline, mapPath) {
const node = getNodeFromScriptFile(scriptFile);
mapPath = mapPath || path.basename(scriptFile) + '.map';
return {
script: node.toString().replace(/\r\n/gm, '\n') + (
multiline
? ('/*# sourceMappingU... | [
"function",
"separateScriptAndMapFromScriptFile",
"(",
"scriptFile",
",",
"multiline",
",",
"mapPath",
")",
"{",
"const",
"node",
"=",
"getNodeFromScriptFile",
"(",
"scriptFile",
")",
";",
"mapPath",
"=",
"mapPath",
"||",
"path",
".",
"basename",
"(",
"scriptFile"... | separate source script and map from file | [
"separate",
"source",
"script",
"and",
"map",
"from",
"file"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/master-tasks/tasks/srcmap.js#L96-L107 | train |
sony/cdp-js | packages/master-tasks/tasks/srcmap.js | getCodeMap | function getCodeMap(node) {
const code_map = node.toStringWithSourceMap();
// patch
node.walkSourceContents(function (sourceFile, sourceContent) {
if (!code_map.map._sources.has(sourceFile)) {
code_map.map._sources.add(sourceFile);
}
});
return code_map;
} | javascript | function getCodeMap(node) {
const code_map = node.toStringWithSourceMap();
// patch
node.walkSourceContents(function (sourceFile, sourceContent) {
if (!code_map.map._sources.has(sourceFile)) {
code_map.map._sources.add(sourceFile);
}
});
return code_map;
} | [
"function",
"getCodeMap",
"(",
"node",
")",
"{",
"const",
"code_map",
"=",
"node",
".",
"toStringWithSourceMap",
"(",
")",
";",
"// patch",
"node",
".",
"walkSourceContents",
"(",
"function",
"(",
"sourceFile",
",",
"sourceContent",
")",
"{",
"if",
"(",
"!",... | get code map with path from node | [
"get",
"code",
"map",
"with",
"path",
"from",
"node"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/master-tasks/tasks/srcmap.js#L140-L151 | train |
npm/ndm | lib/config.js | Config | function Config(opts) {
_.extend(this, {
appName: 'ndm', // used by rc.
serviceJsonPath: path.resolve(process.cwd(), 'service.json'),
tmpServiceJsonPath: null, // used during install phase.
logsDirectory: this.defaultLogsDirectory(),
env: process.env,
uid: null,
gid: null,
console: nul... | javascript | function Config(opts) {
_.extend(this, {
appName: 'ndm', // used by rc.
serviceJsonPath: path.resolve(process.cwd(), 'service.json'),
tmpServiceJsonPath: null, // used during install phase.
logsDirectory: this.defaultLogsDirectory(),
env: process.env,
uid: null,
gid: null,
console: nul... | [
"function",
"Config",
"(",
"opts",
")",
"{",
"_",
".",
"extend",
"(",
"this",
",",
"{",
"appName",
":",
"'ndm'",
",",
"// used by rc.",
"serviceJsonPath",
":",
"path",
".",
"resolve",
"(",
"process",
".",
"cwd",
"(",
")",
",",
"'service.json'",
")",
",... | handles loading and detecting configuration pulling together OS-specific variables, ENV, and args. | [
"handles",
"loading",
"and",
"detecting",
"configuration",
"pulling",
"together",
"OS",
"-",
"specific",
"variables",
"ENV",
"and",
"args",
"."
] | 0c5c50c409c365d5304bedc15754ddffa86aedbc | https://github.com/npm/ndm/blob/0c5c50c409c365d5304bedc15754ddffa86aedbc/lib/config.js#L11-L49 | train |
sony/cdp-js | packages/cafeteria/platforms/ios/cordova/lib/prepare.js | getLaunchStoryboardContentsJSON | function getLaunchStoryboardContentsJSON(splashScreens, launchStoryboardImagesDir) {
var platformLaunchStoryboardImages = mapLaunchStoryboardContents(splashScreens, launchStoryboardImagesDir);
var contentsJSON = {
images: [],
info: {
author: 'Xcode',
version: 1
}... | javascript | function getLaunchStoryboardContentsJSON(splashScreens, launchStoryboardImagesDir) {
var platformLaunchStoryboardImages = mapLaunchStoryboardContents(splashScreens, launchStoryboardImagesDir);
var contentsJSON = {
images: [],
info: {
author: 'Xcode',
version: 1
}... | [
"function",
"getLaunchStoryboardContentsJSON",
"(",
"splashScreens",
",",
"launchStoryboardImagesDir",
")",
"{",
"var",
"platformLaunchStoryboardImages",
"=",
"mapLaunchStoryboardContents",
"(",
"splashScreens",
",",
"launchStoryboardImagesDir",
")",
";",
"var",
"contentsJSON",... | Builds the object that represents the contents.json file for the LaunchStoryboard image set.
The resulting return looks like this:
{
images: [
{
idiom: 'universal|ipad|iphone',
scale: '1x|2x|3x',
width-class: undefined|'compact',
height-class: undefined|'compact'
}, ...
],
info: {
author: 'Xcode',
version: 1
}
}
A b... | [
"Builds",
"the",
"object",
"that",
"represents",
"the",
"contents",
".",
"json",
"file",
"for",
"the",
"LaunchStoryboard",
"image",
"set",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/platforms/ios/cordova/lib/prepare.js#L659-L691 | train |
sony/cdp-js | packages/cafeteria/platforms/ios/cordova/lib/prepare.js | checkIfBuildSettingsNeedUpdatedForLaunchStoryboard | function checkIfBuildSettingsNeedUpdatedForLaunchStoryboard(platformConfig, infoPlist) {
var hasLaunchStoryboardImages = platformHasLaunchStoryboardImages(platformConfig);
var hasLegacyLaunchImages = platformHasLegacyLaunchImages(platformConfig);
var currentLaunchStoryboard = infoPlist[UI_LAUNCH_STORYBOARD_... | javascript | function checkIfBuildSettingsNeedUpdatedForLaunchStoryboard(platformConfig, infoPlist) {
var hasLaunchStoryboardImages = platformHasLaunchStoryboardImages(platformConfig);
var hasLegacyLaunchImages = platformHasLegacyLaunchImages(platformConfig);
var currentLaunchStoryboard = infoPlist[UI_LAUNCH_STORYBOARD_... | [
"function",
"checkIfBuildSettingsNeedUpdatedForLaunchStoryboard",
"(",
"platformConfig",
",",
"infoPlist",
")",
"{",
"var",
"hasLaunchStoryboardImages",
"=",
"platformHasLaunchStoryboardImages",
"(",
"platformConfig",
")",
";",
"var",
"hasLegacyLaunchImages",
"=",
"platformHasL... | Determines if the project's build settings may need to be updated for launch storyboard support | [
"Determines",
"if",
"the",
"project",
"s",
"build",
"settings",
"may",
"need",
"to",
"be",
"updated",
"for",
"launch",
"storyboard",
"support"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/platforms/ios/cordova/lib/prepare.js#L697-L715 | train |
sony/cdp-js | packages/cafeteria/plugins/cordova-plugin-cdp-nativebridge/www/cdp.plugin.nativebridge.js | NativeBridge | function NativeBridge(feature, options) {
if (!(this instanceof NativeBridge)) {
return new NativeBridge(feature, options);
}
this._feature = feature;
this._objectId = "object:" + _utils.createUUID();
this._execTaskHisto... | javascript | function NativeBridge(feature, options) {
if (!(this instanceof NativeBridge)) {
return new NativeBridge(feature, options);
}
this._feature = feature;
this._objectId = "object:" + _utils.createUUID();
this._execTaskHisto... | [
"function",
"NativeBridge",
"(",
"feature",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"NativeBridge",
")",
")",
"{",
"return",
"new",
"NativeBridge",
"(",
"feature",
",",
"options",
")",
";",
"}",
"this",
".",
"_feature",
"=",
... | \~english
constructor
@param feature {Feature} [in] feature information.
@param options {ConstructOptions?} [in] construction options.
\~japanese
constructor
@param feature {Feature} [in] 機能情報
@param options {ConstructOptions?} [in] オプション情報 | [
"\\",
"~english",
"constructor"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/plugins/cordova-plugin-cdp-nativebridge/www/cdp.plugin.nativebridge.js#L94-L101 | train |
richardeoin/nodejs-plotter | plotter.js | moving_maximum | function moving_maximum(array, n) {
var nums = [];
for (i in array) {
if (_.isNumber(array[i])) {
nums.push(array[i]);
if (nums.length > n) {
nums.splice(0,1); /* Remove the first element of the array */
}
/* Take the average of the n items in this array */
var maximum = _.max(nu... | javascript | function moving_maximum(array, n) {
var nums = [];
for (i in array) {
if (_.isNumber(array[i])) {
nums.push(array[i]);
if (nums.length > n) {
nums.splice(0,1); /* Remove the first element of the array */
}
/* Take the average of the n items in this array */
var maximum = _.max(nu... | [
"function",
"moving_maximum",
"(",
"array",
",",
"n",
")",
"{",
"var",
"nums",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"in",
"array",
")",
"{",
"if",
"(",
"_",
".",
"isNumber",
"(",
"array",
"[",
"i",
"]",
")",
")",
"{",
"nums",
".",
"push",
"("... | Performs a n-point maximum on array. | [
"Performs",
"a",
"n",
"-",
"point",
"maximum",
"on",
"array",
"."
] | 06460f357334c32d5a255b038c6f5bc6215d8b86 | https://github.com/richardeoin/nodejs-plotter/blob/06460f357334c32d5a255b038c6f5bc6215d8b86/plotter.js#L34-L50 | train |
richardeoin/nodejs-plotter | plotter.js | apply_moving_filter | function apply_moving_filter(set, filter, n) {
if (!_.isNumber(n)) { n = 3; }
for (series in set) { /* For each series */
/* Apply the filter */
set[series] = filter(set[series], n);
}
return set;
} | javascript | function apply_moving_filter(set, filter, n) {
if (!_.isNumber(n)) { n = 3; }
for (series in set) { /* For each series */
/* Apply the filter */
set[series] = filter(set[series], n);
}
return set;
} | [
"function",
"apply_moving_filter",
"(",
"set",
",",
"filter",
",",
"n",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isNumber",
"(",
"n",
")",
")",
"{",
"n",
"=",
"3",
";",
"}",
"for",
"(",
"series",
"in",
"set",
")",
"{",
"/* For each series */",
"/* Appl... | Applys an n-point moving filter to a set of series. | [
"Applys",
"an",
"n",
"-",
"point",
"moving",
"filter",
"to",
"a",
"set",
"of",
"series",
"."
] | 06460f357334c32d5a255b038c6f5bc6215d8b86 | https://github.com/richardeoin/nodejs-plotter/blob/06460f357334c32d5a255b038c6f5bc6215d8b86/plotter.js#L54-L63 | train |
richardeoin/nodejs-plotter | plotter.js | time_format | function time_format(options) {
if (_.isString(options.time)) {
/* Translate the string we've been given into a format */
switch(options.time) {
case 'days':
case 'Days':
return "%d/%m";
case 'hours':
case 'Hours':
return "%H:%M";
default: /* Presume we've been given a gnuplot-... | javascript | function time_format(options) {
if (_.isString(options.time)) {
/* Translate the string we've been given into a format */
switch(options.time) {
case 'days':
case 'Days':
return "%d/%m";
case 'hours':
case 'Hours':
return "%H:%M";
default: /* Presume we've been given a gnuplot-... | [
"function",
"time_format",
"(",
"options",
")",
"{",
"if",
"(",
"_",
".",
"isString",
"(",
"options",
".",
"time",
")",
")",
"{",
"/* Translate the string we've been given into a format */",
"switch",
"(",
"options",
".",
"time",
")",
"{",
"case",
"'days'",
":... | Returns the string to give to gnuplot based on the value of options.time. | [
"Returns",
"the",
"string",
"to",
"give",
"to",
"gnuplot",
"based",
"on",
"the",
"value",
"of",
"options",
".",
"time",
"."
] | 06460f357334c32d5a255b038c6f5bc6215d8b86 | https://github.com/richardeoin/nodejs-plotter/blob/06460f357334c32d5a255b038c6f5bc6215d8b86/plotter.js#L67-L83 | train |
richardeoin/nodejs-plotter | plotter.js | setup_gnuplot | function setup_gnuplot(gnuplot, options) {
if (options.format === 'svg') { /* Setup gnuplot for SVG */
gnuplot.stdin.write('set term svg fname \"Helvetica\" fsize 14\n');
} else if (options.format == 'pdf') {
/* PDF: setup Gnuplot output to postscript so ps2pdf can interpret it */
gnuplot.stdin.write('s... | javascript | function setup_gnuplot(gnuplot, options) {
if (options.format === 'svg') { /* Setup gnuplot for SVG */
gnuplot.stdin.write('set term svg fname \"Helvetica\" fsize 14\n');
} else if (options.format == 'pdf') {
/* PDF: setup Gnuplot output to postscript so ps2pdf can interpret it */
gnuplot.stdin.write('s... | [
"function",
"setup_gnuplot",
"(",
"gnuplot",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"format",
"===",
"'svg'",
")",
"{",
"/* Setup gnuplot for SVG */",
"gnuplot",
".",
"stdin",
".",
"write",
"(",
"'set term svg fname \\\"Helvetica\\\" fsize 14\\n'",
")"... | Sets up gnuplot based on the properties we're given in the options object. | [
"Sets",
"up",
"gnuplot",
"based",
"on",
"the",
"properties",
"we",
"re",
"given",
"in",
"the",
"options",
"object",
"."
] | 06460f357334c32d5a255b038c6f5bc6215d8b86 | https://github.com/richardeoin/nodejs-plotter/blob/06460f357334c32d5a255b038c6f5bc6215d8b86/plotter.js#L87-L125 | train |
npm/ndm | lib/platform-apis/platform-base.js | PlatformBase | function PlatformBase(opts) {
_.extend(this, {
platform: null,
// path to template to use for service generation,
// use of a template may be optional.
template: null,
logger: require('../logger')
}, opts);
} | javascript | function PlatformBase(opts) {
_.extend(this, {
platform: null,
// path to template to use for service generation,
// use of a template may be optional.
template: null,
logger: require('../logger')
}, opts);
} | [
"function",
"PlatformBase",
"(",
"opts",
")",
"{",
"_",
".",
"extend",
"(",
"this",
",",
"{",
"platform",
":",
"null",
",",
"// path to template to use for service generation,",
"// use of a template may be optional.",
"template",
":",
"null",
",",
"logger",
":",
"r... | An API for executing OS-specific commands, and generating OS-specific daemon scripts. | [
"An",
"API",
"for",
"executing",
"OS",
"-",
"specific",
"commands",
"and",
"generating",
"OS",
"-",
"specific",
"daemon",
"scripts",
"."
] | 0c5c50c409c365d5304bedc15754ddffa86aedbc | https://github.com/npm/ndm/blob/0c5c50c409c365d5304bedc15754ddffa86aedbc/lib/platform-apis/platform-base.js#L9-L17 | train |
sony/cdp-js | packages/cafeteria/app/external/sylvester/scripts/sylvester-0.1.3.js | function(vector) {
var n = this.elements.length;
var V = vector.elements || vector;
if (n != V.length) { return false; }
do {
if (Math.abs(this.elements[n-1] - V[n-1]) > Sylvester.precision) { return false; }
} while (--n);
return true;
} | javascript | function(vector) {
var n = this.elements.length;
var V = vector.elements || vector;
if (n != V.length) { return false; }
do {
if (Math.abs(this.elements[n-1] - V[n-1]) > Sylvester.precision) { return false; }
} while (--n);
return true;
} | [
"function",
"(",
"vector",
")",
"{",
"var",
"n",
"=",
"this",
".",
"elements",
".",
"length",
";",
"var",
"V",
"=",
"vector",
".",
"elements",
"||",
"vector",
";",
"if",
"(",
"n",
"!=",
"V",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
... | Returns true iff the vector is equal to the argument | [
"Returns",
"true",
"iff",
"the",
"vector",
"is",
"equal",
"to",
"the",
"argument"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/app/external/sylvester/scripts/sylvester-0.1.3.js#L47-L55 | train | |
sony/cdp-js | packages/cafeteria/app/external/sylvester/scripts/sylvester-0.1.3.js | function(vector) {
var V = vector.elements || vector;
var i, product = 0, n = this.elements.length;
if (n != V.length) { return null; }
do { product += this.elements[n-1] * V[n-1]; } while (--n);
return product;
} | javascript | function(vector) {
var V = vector.elements || vector;
var i, product = 0, n = this.elements.length;
if (n != V.length) { return null; }
do { product += this.elements[n-1] * V[n-1]; } while (--n);
return product;
} | [
"function",
"(",
"vector",
")",
"{",
"var",
"V",
"=",
"vector",
".",
"elements",
"||",
"vector",
";",
"var",
"i",
",",
"product",
"=",
"0",
",",
"n",
"=",
"this",
".",
"elements",
".",
"length",
";",
"if",
"(",
"n",
"!=",
"V",
".",
"length",
")... | Returns the scalar product of the vector with the argument Both vectors must have equal dimensionality | [
"Returns",
"the",
"scalar",
"product",
"of",
"the",
"vector",
"with",
"the",
"argument",
"Both",
"vectors",
"must",
"have",
"equal",
"dimensionality"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/app/external/sylvester/scripts/sylvester-0.1.3.js#L147-L153 | train | |
sony/cdp-js | packages/cafeteria/app/external/sylvester/scripts/sylvester-0.1.3.js | function(obj) {
if (obj.anchor) { return obj.distanceFrom(this); }
var V = obj.elements || obj;
if (V.length != this.elements.length) { return null; }
var sum = 0, part;
this.each(function(x, i) {
part = x - V[i-1];
sum += part * part;
});
return Math.sqrt(sum);
} | javascript | function(obj) {
if (obj.anchor) { return obj.distanceFrom(this); }
var V = obj.elements || obj;
if (V.length != this.elements.length) { return null; }
var sum = 0, part;
this.each(function(x, i) {
part = x - V[i-1];
sum += part * part;
});
return Math.sqrt(sum);
} | [
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"anchor",
")",
"{",
"return",
"obj",
".",
"distanceFrom",
"(",
"this",
")",
";",
"}",
"var",
"V",
"=",
"obj",
".",
"elements",
"||",
"obj",
";",
"if",
"(",
"V",
".",
"length",
"!=",
"this... | Returns the vector's distance from the argument, when considered as a point in space | [
"Returns",
"the",
"vector",
"s",
"distance",
"from",
"the",
"argument",
"when",
"considered",
"as",
"a",
"point",
"in",
"space"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/app/external/sylvester/scripts/sylvester-0.1.3.js#L207-L217 | train | |
sony/cdp-js | packages/cafeteria/app/external/sylvester/scripts/sylvester-0.1.3.js | function() {
if (!this.isSquare()) { return null; }
var tr = this.elements[0][0], n = this.elements.length - 1, k = n, i;
do { i = k - n + 1;
tr += this.elements[i][i];
} while (--n);
return tr;
} | javascript | function() {
if (!this.isSquare()) { return null; }
var tr = this.elements[0][0], n = this.elements.length - 1, k = n, i;
do { i = k - n + 1;
tr += this.elements[i][i];
} while (--n);
return tr;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isSquare",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"var",
"tr",
"=",
"this",
".",
"elements",
"[",
"0",
"]",
"[",
"0",
"]",
",",
"n",
"=",
"this",
".",
"elements",
".",
"length"... | Returns the trace for square matrices | [
"Returns",
"the",
"trace",
"for",
"square",
"matrices"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/app/external/sylvester/scripts/sylvester-0.1.3.js#L599-L606 | train | |
sony/cdp-js | packages/cafeteria/app/external/sylvester/scripts/sylvester-0.1.3.js | function(obj) {
if (obj.normal) { return obj.distanceFrom(this); }
if (obj.direction) {
// obj is a line
if (this.isParallelTo(obj)) { return this.distanceFrom(obj.anchor); }
var N = this.direction.cross(obj.direction).toUnitVector().elements;
var A = this.anchor.elements, B = obj.anchor... | javascript | function(obj) {
if (obj.normal) { return obj.distanceFrom(this); }
if (obj.direction) {
// obj is a line
if (this.isParallelTo(obj)) { return this.distanceFrom(obj.anchor); }
var N = this.direction.cross(obj.direction).toUnitVector().elements;
var A = this.anchor.elements, B = obj.anchor... | [
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"normal",
")",
"{",
"return",
"obj",
".",
"distanceFrom",
"(",
"this",
")",
";",
"}",
"if",
"(",
"obj",
".",
"direction",
")",
"{",
"// obj is a line",
"if",
"(",
"this",
".",
"isParallelTo",
... | Returns the line's perpendicular distance from the argument, which can be a point, a line or a plane | [
"Returns",
"the",
"line",
"s",
"perpendicular",
"distance",
"from",
"the",
"argument",
"which",
"can",
"be",
"a",
"point",
"a",
"line",
"or",
"a",
"plane"
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/app/external/sylvester/scripts/sylvester-0.1.3.js#L861-L881 | train | |
sony/cdp-js | packages/cafeteria/app/external/sylvester/scripts/sylvester-0.1.3.js | function(anchor, direction) {
// Need to do this so that line's properties are not
// references to the arguments passed in
anchor = Vector.create(anchor);
direction = Vector.create(direction);
if (anchor.elements.length == 2) {anchor.elements.push(0); }
if (direction.elements.length == 2) { dir... | javascript | function(anchor, direction) {
// Need to do this so that line's properties are not
// references to the arguments passed in
anchor = Vector.create(anchor);
direction = Vector.create(direction);
if (anchor.elements.length == 2) {anchor.elements.push(0); }
if (direction.elements.length == 2) { dir... | [
"function",
"(",
"anchor",
",",
"direction",
")",
"{",
"// Need to do this so that line's properties are not",
"// references to the arguments passed in",
"anchor",
"=",
"Vector",
".",
"create",
"(",
"anchor",
")",
";",
"direction",
"=",
"Vector",
".",
"create",
"(",
... | Set the line's anchor point and direction. | [
"Set",
"the",
"line",
"s",
"anchor",
"point",
"and",
"direction",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cafeteria/app/external/sylvester/scripts/sylvester-0.1.3.js#L995-L1012 | train | |
sony/cdp-js | packages/cdp-lazyload/src/scripts/cdp.lazyload.js | _getExtension | function _getExtension(file) {
var ret;
if (file) {
var fileTypes = file.split(".");
var len = fileTypes.length;
if (0 === len) {
return ret;
}
ret = fileTypes[len - 1];
return ret;
}
} | javascript | function _getExtension(file) {
var ret;
if (file) {
var fileTypes = file.split(".");
var len = fileTypes.length;
if (0 === len) {
return ret;
}
ret = fileTypes[len - 1];
return ret;
}
} | [
"function",
"_getExtension",
"(",
"file",
")",
"{",
"var",
"ret",
";",
"if",
"(",
"file",
")",
"{",
"var",
"fileTypes",
"=",
"file",
".",
"split",
"(",
"\".\"",
")",
";",
"var",
"len",
"=",
"fileTypes",
".",
"length",
";",
"if",
"(",
"0",
"===",
... | \~english
Get file extension by file name.
@private
@param file {String} [in] file path / file name
@return {String} file extension
\~japanese
ファイル名から拡張子を取得
@private
@param file {String} [in] file path / file name
@return {String} file extension | [
"\\",
"~english",
"Get",
"file",
"extension",
"by",
"file",
"name",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-lazyload/src/scripts/cdp.lazyload.js#L30-L41 | train |
sony/cdp-js | packages/cdp-lazyload/src/scripts/cdp.lazyload.js | _getScriptElements | function _getScriptElements($typeLazy) {
var scripts;
var src = $typeLazy.attr("src");
if (!src) {
src = $typeLazy.data("src");
}
if ("js" === _getExtension(src).toLowerCase()) {
return $typeLazy;
} else {
if (requirejs && typeof requir... | javascript | function _getScriptElements($typeLazy) {
var scripts;
var src = $typeLazy.attr("src");
if (!src) {
src = $typeLazy.data("src");
}
if ("js" === _getExtension(src).toLowerCase()) {
return $typeLazy;
} else {
if (requirejs && typeof requir... | [
"function",
"_getScriptElements",
"(",
"$typeLazy",
")",
"{",
"var",
"scripts",
";",
"var",
"src",
"=",
"$typeLazy",
".",
"attr",
"(",
"\"src\"",
")",
";",
"if",
"(",
"!",
"src",
")",
"{",
"src",
"=",
"$typeLazy",
".",
"data",
"(",
"\"src\"",
")",
";... | \~english
Get script elements.
@private
@param file {jQuery} [in] type lazy elements
@return {jQuery} script elements
\~japanese
script element の取得
@private
@param file {jQuery} [in] type lazy elements
@return {jQuery} script elements | [
"\\",
"~english",
"Get",
"script",
"elements",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-lazyload/src/scripts/cdp.lazyload.js#L58-L84 | train |
sony/cdp-js | packages/cdp-lazyload/src/scripts/cdp.lazyload.js | _appendSync | function _appendSync($script) {
var _src = $script.attr("src");
if (!_src) {
_src = $script.data("src");
}
var _url = function ($elem) {
var ret = _src;
if (requirejs && typeof requirejs.toUrl === "function") {
ret = requirejs.toUrl(re... | javascript | function _appendSync($script) {
var _src = $script.attr("src");
if (!_src) {
_src = $script.data("src");
}
var _url = function ($elem) {
var ret = _src;
if (requirejs && typeof requirejs.toUrl === "function") {
ret = requirejs.toUrl(re... | [
"function",
"_appendSync",
"(",
"$script",
")",
"{",
"var",
"_src",
"=",
"$script",
".",
"attr",
"(",
"\"src\"",
")",
";",
"if",
"(",
"!",
"_src",
")",
"{",
"_src",
"=",
"$script",
".",
"data",
"(",
"\"src\"",
")",
";",
"}",
"var",
"_url",
"=",
"... | \~english
Load script and append to head with "sourceURL".
@param $script {JQuery} [in] script's jQuery object
\~japanese
"sourceURL" コメントと共に、script を同期読み込み
jQuery.append() の Hack。 eval() でスクリプトを有効化している。
Developer Tool の Source Tree 上に表示するため、sourceURL が無ければ埋め込む
@param $script {JQuery} [in] script の jQuery object | [
"\\",
"~english",
"Load",
"script",
"and",
"append",
"to",
"head",
"with",
"sourceURL",
"."
] | 00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6 | https://github.com/sony/cdp-js/blob/00e5ef7f2cb4addac61bfbee1fa2bc99e939e0b6/packages/cdp-lazyload/src/scripts/cdp.lazyload.js#L99-L158 | train |
npm/ndm | lib/service.js | Service | function Service(opts) {
_.extend(this,
{
description: '',
utils: require('./utils'),
logger: require('./logger')
},
require('./config')(),
opts
);
// scoped modules contain a '/' (@foo/bar).
// this causes problems when generating logs/scripts
// on some platforms.
this.n... | javascript | function Service(opts) {
_.extend(this,
{
description: '',
utils: require('./utils'),
logger: require('./logger')
},
require('./config')(),
opts
);
// scoped modules contain a '/' (@foo/bar).
// this causes problems when generating logs/scripts
// on some platforms.
this.n... | [
"function",
"Service",
"(",
"opts",
")",
"{",
"_",
".",
"extend",
"(",
"this",
",",
"{",
"description",
":",
"''",
",",
"utils",
":",
"require",
"(",
"'./utils'",
")",
",",
"logger",
":",
"require",
"(",
"'./logger'",
")",
"}",
",",
"require",
"(",
... | an OS-specific service wrapper for a Node.js process. | [
"an",
"OS",
"-",
"specific",
"service",
"wrapper",
"for",
"a",
"Node",
".",
"js",
"process",
"."
] | 0c5c50c409c365d5304bedc15754ddffa86aedbc | https://github.com/npm/ndm/blob/0c5c50c409c365d5304bedc15754ddffa86aedbc/lib/service.js#L9-L35 | train |
npm/ndm | lib/service.js | parseServiceJson | function parseServiceJson(serviceNameFilter, serviceJson) {
var services = [],
config = require('./config')();
Object.keys(serviceJson).forEach(function(serviceName) {
if (serviceName === 'env' || serviceName === 'args') return;
var serviceConfig = serviceJson[serviceName],
processCount = servic... | javascript | function parseServiceJson(serviceNameFilter, serviceJson) {
var services = [],
config = require('./config')();
Object.keys(serviceJson).forEach(function(serviceName) {
if (serviceName === 'env' || serviceName === 'args') return;
var serviceConfig = serviceJson[serviceName],
processCount = servic... | [
"function",
"parseServiceJson",
"(",
"serviceNameFilter",
",",
"serviceJson",
")",
"{",
"var",
"services",
"=",
"[",
"]",
",",
"config",
"=",
"require",
"(",
"'./config'",
")",
"(",
")",
";",
"Object",
".",
"keys",
"(",
"serviceJson",
")",
".",
"forEach",
... | service.json files can be used to describe multiple services, they have a slightly different format than package.json. | [
"service",
".",
"json",
"files",
"can",
"be",
"used",
"to",
"describe",
"multiple",
"services",
"they",
"have",
"a",
"slightly",
"different",
"format",
"than",
"package",
".",
"json",
"."
] | 0c5c50c409c365d5304bedc15754ddffa86aedbc | https://github.com/npm/ndm/blob/0c5c50c409c365d5304bedc15754ddffa86aedbc/lib/service.js#L301-L358 | train |
cloudflare/json-schema-example-loader | lib/curl.js | function(uri, method, headers, data, encType) {
var config = this.config;
var flags = [];
var str;
method = method || 'GET';
if (data && method.toLowerCase() === 'get') {
uri += this.buildQueryString(data);
}
str = ['curl', this.buildFlag('X', method.toUpperCase(), 0, ''), '"' + uri... | javascript | function(uri, method, headers, data, encType) {
var config = this.config;
var flags = [];
var str;
method = method || 'GET';
if (data && method.toLowerCase() === 'get') {
uri += this.buildQueryString(data);
}
str = ['curl', this.buildFlag('X', method.toUpperCase(), 0, ''), '"' + uri... | [
"function",
"(",
"uri",
",",
"method",
",",
"headers",
",",
"data",
",",
"encType",
")",
"{",
"var",
"config",
"=",
"this",
".",
"config",
";",
"var",
"flags",
"=",
"[",
"]",
";",
"var",
"str",
";",
"method",
"=",
"method",
"||",
"'GET'",
";",
"i... | Build a cURL string
@param {String} uri
@param {String} [method=GET]
@param {Object} [headers]
@param {Object|Array} [data]
@param {String} [encType=undefined]
@returns {String} | [
"Build",
"a",
"cURL",
"string"
] | cc3bba87a4990a229cbb2bd52d8159fc0bb4088b | https://github.com/cloudflare/json-schema-example-loader/blob/cc3bba87a4990a229cbb2bd52d8159fc0bb4088b/lib/curl.js#L24-L58 | train | |
insin/react-heatpack | webpack.config.js | findNodeModules | function findNodeModules(cwd) {
var parts = cwd.split(path.sep)
while (parts.length > 0) {
var target = path.join(parts.join(path.sep), 'node_modules')
if (fs.existsSync(target)) {
return target
}
parts.pop()
}
} | javascript | function findNodeModules(cwd) {
var parts = cwd.split(path.sep)
while (parts.length > 0) {
var target = path.join(parts.join(path.sep), 'node_modules')
if (fs.existsSync(target)) {
return target
}
parts.pop()
}
} | [
"function",
"findNodeModules",
"(",
"cwd",
")",
"{",
"var",
"parts",
"=",
"cwd",
".",
"split",
"(",
"path",
".",
"sep",
")",
"while",
"(",
"parts",
".",
"length",
">",
"0",
")",
"{",
"var",
"target",
"=",
"path",
".",
"join",
"(",
"parts",
".",
"... | Find the node_modules directory which will be resolved from a given dir. | [
"Find",
"the",
"node_modules",
"directory",
"which",
"will",
"be",
"resolved",
"from",
"a",
"given",
"dir",
"."
] | e862e92d39b7e89fc43c7e9c857bcef8f3fd6912 | https://github.com/insin/react-heatpack/blob/e862e92d39b7e89fc43c7e9c857bcef8f3fd6912/webpack.config.js#L14-L23 | train |
xpl/useless | base/component.js | function () {
Meta.globalTag ('dummy')
$assertEveryCalled (function (mkay1, mkay2) { var this_ = undefined
var Trait = $trait ({
somethingHappened: $trigger () })
var Other = $trait ({
somethingHappened: $dummy (function (_42) { $assert (this, ... | javascript | function () {
Meta.globalTag ('dummy')
$assertEveryCalled (function (mkay1, mkay2) { var this_ = undefined
var Trait = $trait ({
somethingHappened: $trigger () })
var Other = $trait ({
somethingHappened: $dummy (function (_42) { $assert (this, ... | [
"function",
"(",
")",
"{",
"Meta",
".",
"globalTag",
"(",
"'dummy'",
")",
"$assertEveryCalled",
"(",
"function",
"(",
"mkay1",
",",
"mkay2",
")",
"{",
"var",
"this_",
"=",
"undefined",
"var",
"Trait",
"=",
"$trait",
"(",
"{",
"somethingHappened",
":",
"$... | supply POD value from property accessor | [
"supply",
"POD",
"value",
"from",
"property",
"accessor"
] | f44dcaff5ea6bfa817c1807b4ba29a1aadf5e40d | https://github.com/xpl/useless/blob/f44dcaff5ea6bfa817c1807b4ba29a1aadf5e40d/base/component.js#L367-L384 | train | |
mikolalysenko/game-shell | shell.js | tryFullscreen | function tryFullscreen(shell) {
//Request full screen
var elem = shell.element
if(shell._wantFullscreen && !shell._fullscreenActive) {
var fs = elem.requestFullscreen ||
elem.requestFullScreen ||
elem.webkitRequestFullscreen ||
elem.webkitRequestFullScreen ||
... | javascript | function tryFullscreen(shell) {
//Request full screen
var elem = shell.element
if(shell._wantFullscreen && !shell._fullscreenActive) {
var fs = elem.requestFullscreen ||
elem.requestFullScreen ||
elem.webkitRequestFullscreen ||
elem.webkitRequestFullScreen ||
... | [
"function",
"tryFullscreen",
"(",
"shell",
")",
"{",
"//Request full screen",
"var",
"elem",
"=",
"shell",
".",
"element",
"if",
"(",
"shell",
".",
"_wantFullscreen",
"&&",
"!",
"shell",
".",
"_fullscreenActive",
")",
"{",
"var",
"fs",
"=",
"elem",
".",
"r... | Fullscreen state toggle | [
"Fullscreen",
"state",
"toggle"
] | 74b81aabc1750c6c3d5e73a5566b4b9ca2032fb9 | https://github.com/mikolalysenko/game-shell/blob/74b81aabc1750c6c3d5e73a5566b4b9ca2032fb9/shell.js#L236-L259 | train |
mikolalysenko/game-shell | shell.js | setKeyState | function setKeyState(shell, key, state) {
var ps = shell._curKeyState[key]
if(ps !== state) {
if(state) {
shell._pressCount[key]++
} else {
shell._releaseCount[key]++
}
shell._curKeyState[key] = state
}
} | javascript | function setKeyState(shell, key, state) {
var ps = shell._curKeyState[key]
if(ps !== state) {
if(state) {
shell._pressCount[key]++
} else {
shell._releaseCount[key]++
}
shell._curKeyState[key] = state
}
} | [
"function",
"setKeyState",
"(",
"shell",
",",
"key",
",",
"state",
")",
"{",
"var",
"ps",
"=",
"shell",
".",
"_curKeyState",
"[",
"key",
"]",
"if",
"(",
"ps",
"!==",
"state",
")",
"{",
"if",
"(",
"state",
")",
"{",
"shell",
".",
"_pressCount",
"[",... | Set key state | [
"Set",
"key",
"state"
] | 74b81aabc1750c6c3d5e73a5566b4b9ca2032fb9 | https://github.com/mikolalysenko/game-shell/blob/74b81aabc1750c6c3d5e73a5566b4b9ca2032fb9/shell.js#L348-L358 | train |
mikolalysenko/game-shell | shell.js | tick | function tick(shell) {
var skip = hrtime() + shell.frameSkip
, pCount = shell._pressCount
, rCount = shell._releaseCount
, i, s, t
, tr = shell._tickRate
, n = keyNames.length
while(!shell._paused &&
hrtime() >= shell._lastTick + tr) {
//Skip frames if we are over budget
if(... | javascript | function tick(shell) {
var skip = hrtime() + shell.frameSkip
, pCount = shell._pressCount
, rCount = shell._releaseCount
, i, s, t
, tr = shell._tickRate
, n = keyNames.length
while(!shell._paused &&
hrtime() >= shell._lastTick + tr) {
//Skip frames if we are over budget
if(... | [
"function",
"tick",
"(",
"shell",
")",
"{",
"var",
"skip",
"=",
"hrtime",
"(",
")",
"+",
"shell",
".",
"frameSkip",
",",
"pCount",
"=",
"shell",
".",
"_pressCount",
",",
"rCount",
"=",
"shell",
".",
"_releaseCount",
",",
"i",
",",
"s",
",",
"t",
",... | Ticks the game state one update | [
"Ticks",
"the",
"game",
"state",
"one",
"update"
] | 74b81aabc1750c6c3d5e73a5566b4b9ca2032fb9 | https://github.com/mikolalysenko/game-shell/blob/74b81aabc1750c6c3d5e73a5566b4b9ca2032fb9/shell.js#L368-L407 | train |
mikolalysenko/game-shell | shell.js | handleKeyUp | function handleKeyUp(shell, ev) {
handleEvent(shell, ev)
var kc = physicalKeyCode(ev.keyCode || ev.char || ev.which || ev.charCode)
if(kc >= 0) {
setKeyState(shell, kc, false)
}
} | javascript | function handleKeyUp(shell, ev) {
handleEvent(shell, ev)
var kc = physicalKeyCode(ev.keyCode || ev.char || ev.which || ev.charCode)
if(kc >= 0) {
setKeyState(shell, kc, false)
}
} | [
"function",
"handleKeyUp",
"(",
"shell",
",",
"ev",
")",
"{",
"handleEvent",
"(",
"shell",
",",
"ev",
")",
"var",
"kc",
"=",
"physicalKeyCode",
"(",
"ev",
".",
"keyCode",
"||",
"ev",
".",
"char",
"||",
"ev",
".",
"which",
"||",
"ev",
".",
"charCode",... | Set key up | [
"Set",
"key",
"up"
] | 74b81aabc1750c6c3d5e73a5566b4b9ca2032fb9 | https://github.com/mikolalysenko/game-shell/blob/74b81aabc1750c6c3d5e73a5566b4b9ca2032fb9/shell.js#L447-L453 | train |
mikolalysenko/game-shell | shell.js | handleKeyDown | function handleKeyDown(shell, ev) {
if(!isFocused(shell)) {
return
}
handleEvent(shell, ev)
if(ev.metaKey) {
//Hack: Clear key state when meta gets pressed to prevent keys sticking
handleBlur(shell, ev)
} else {
var kc = physicalKeyCode(ev.keyCode || ev.char || ev.which || ev.charCode)
if(... | javascript | function handleKeyDown(shell, ev) {
if(!isFocused(shell)) {
return
}
handleEvent(shell, ev)
if(ev.metaKey) {
//Hack: Clear key state when meta gets pressed to prevent keys sticking
handleBlur(shell, ev)
} else {
var kc = physicalKeyCode(ev.keyCode || ev.char || ev.which || ev.charCode)
if(... | [
"function",
"handleKeyDown",
"(",
"shell",
",",
"ev",
")",
"{",
"if",
"(",
"!",
"isFocused",
"(",
"shell",
")",
")",
"{",
"return",
"}",
"handleEvent",
"(",
"shell",
",",
"ev",
")",
"if",
"(",
"ev",
".",
"metaKey",
")",
"{",
"//Hack: Clear key state wh... | Set key down | [
"Set",
"key",
"down"
] | 74b81aabc1750c6c3d5e73a5566b4b9ca2032fb9 | https://github.com/mikolalysenko/game-shell/blob/74b81aabc1750c6c3d5e73a5566b4b9ca2032fb9/shell.js#L456-L470 | train |
mikolalysenko/game-shell | shell.js | handleMouseWheel | function handleMouseWheel(shell, ev) {
handleEvent(shell, ev)
var scale = 1
switch(ev.deltaMode) {
case 0: //Pixel
scale = 1
break
case 1: //Line
scale = 12
break
case 2: //Page
scale = shell.height
break
}
//Add scroll
shell.scroll[0] += ev.deltaX * scale
shell... | javascript | function handleMouseWheel(shell, ev) {
handleEvent(shell, ev)
var scale = 1
switch(ev.deltaMode) {
case 0: //Pixel
scale = 1
break
case 1: //Line
scale = 12
break
case 2: //Page
scale = shell.height
break
}
//Add scroll
shell.scroll[0] += ev.deltaX * scale
shell... | [
"function",
"handleMouseWheel",
"(",
"shell",
",",
"ev",
")",
"{",
"handleEvent",
"(",
"shell",
",",
"ev",
")",
"var",
"scale",
"=",
"1",
"switch",
"(",
"ev",
".",
"deltaMode",
")",
"{",
"case",
"0",
":",
"//Pixel",
"scale",
"=",
"1",
"break",
"case"... | Handle mouse wheel events | [
"Handle",
"mouse",
"wheel",
"events"
] | 74b81aabc1750c6c3d5e73a5566b4b9ca2032fb9 | https://github.com/mikolalysenko/game-shell/blob/74b81aabc1750c6c3d5e73a5566b4b9ca2032fb9/shell.js#L534-L553 | train |
cloudflare/json-schema-example-loader | lib/pointer.js | createPointerEvaluator | function createPointerEvaluator(target) {
// Use cache to store already received values.
var cache = {};
return function(pointer) {
if (!isValidJSONPointer(pointer)) {
// If it's not, an exception will be thrown.
throw new ReferenceError(ErrorMessage.INVALID_POINTER);
}
// ... | javascript | function createPointerEvaluator(target) {
// Use cache to store already received values.
var cache = {};
return function(pointer) {
if (!isValidJSONPointer(pointer)) {
// If it's not, an exception will be thrown.
throw new ReferenceError(ErrorMessage.INVALID_POINTER);
}
// ... | [
"function",
"createPointerEvaluator",
"(",
"target",
")",
"{",
"// Use cache to store already received values.",
"var",
"cache",
"=",
"{",
"}",
";",
"return",
"function",
"(",
"pointer",
")",
"{",
"if",
"(",
"!",
"isValidJSONPointer",
"(",
"pointer",
")",
")",
"... | Returns function that takes JSON Pointer as single argument
and evaluates it in given |target| context.
Returned function throws an exception if pointer is not valid
or any error occurs during evaluation.
@param {Object} target Evaluation target.
@returns {Function} | [
"Returns",
"function",
"that",
"takes",
"JSON",
"Pointer",
"as",
"single",
"argument",
"and",
"evaluates",
"it",
"in",
"given",
"|target|",
"context",
".",
"Returned",
"function",
"throws",
"an",
"exception",
"if",
"pointer",
"is",
"not",
"valid",
"or",
"any",... | cc3bba87a4990a229cbb2bd52d8159fc0bb4088b | https://github.com/cloudflare/json-schema-example-loader/blob/cc3bba87a4990a229cbb2bd52d8159fc0bb4088b/lib/pointer.js#L42-L76 | train |
cloudflare/json-schema-example-loader | lib/pointer.js | isValidJSONPointer | function isValidJSONPointer(pointer) {
if (!_.isString(pointer)) {
// If it's not a string, it obviously is not valid.
return false;
}
// If it is string and is an empty string, it's valid.
if ('' === pointer) {
return true;
}
// If it is non-empty string, it must match spec defined form... | javascript | function isValidJSONPointer(pointer) {
if (!_.isString(pointer)) {
// If it's not a string, it obviously is not valid.
return false;
}
// If it is string and is an empty string, it's valid.
if ('' === pointer) {
return true;
}
// If it is non-empty string, it must match spec defined form... | [
"function",
"isValidJSONPointer",
"(",
"pointer",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"pointer",
")",
")",
"{",
"// If it's not a string, it obviously is not valid.",
"return",
"false",
";",
"}",
"// If it is string and is an empty string, it's valid.",
... | Validates JSON pointer string.
@param pointer
@returns {boolean} | [
"Validates",
"JSON",
"pointer",
"string",
"."
] | cc3bba87a4990a229cbb2bd52d8159fc0bb4088b | https://github.com/cloudflare/json-schema-example-loader/blob/cc3bba87a4990a229cbb2bd52d8159fc0bb4088b/lib/pointer.js#L85-L99 | train |
cloudflare/json-schema-example-loader | lib/pointer.js | getPointedValue | function getPointedValue(target, pointer) {
// If not object, an exception will be thrown.
if (!_.isPlainObject(target)) {
throw new ReferenceError(ErrorMessage.INVALID_DOCUMENT_TYPE);
}
// target is already parsed, create an evaluator for it.
var evaluator = createPointerEvaluator(target);
// If no p... | javascript | function getPointedValue(target, pointer) {
// If not object, an exception will be thrown.
if (!_.isPlainObject(target)) {
throw new ReferenceError(ErrorMessage.INVALID_DOCUMENT_TYPE);
}
// target is already parsed, create an evaluator for it.
var evaluator = createPointerEvaluator(target);
// If no p... | [
"function",
"getPointedValue",
"(",
"target",
",",
"pointer",
")",
"{",
"// If not object, an exception will be thrown.",
"if",
"(",
"!",
"_",
".",
"isPlainObject",
"(",
"target",
")",
")",
"{",
"throw",
"new",
"ReferenceError",
"(",
"ErrorMessage",
".",
"INVALID_... | Returns target object's value pointed by pointer, returns undefined
if |pointer| points to non-existing value.
If pointer is not provided, validates first argument and returns
evaluator function that takes pointer as argument.
@param {Object} target
@param {string} [pointer]
@returns {*} pointer JSON Pointer string | [
"Returns",
"target",
"object",
"s",
"value",
"pointed",
"by",
"pointer",
"returns",
"undefined",
"if",
"|pointer|",
"points",
"to",
"non",
"-",
"existing",
"value",
".",
"If",
"pointer",
"is",
"not",
"provided",
"validates",
"first",
"argument",
"and",
"return... | cc3bba87a4990a229cbb2bd52d8159fc0bb4088b | https://github.com/cloudflare/json-schema-example-loader/blob/cc3bba87a4990a229cbb2bd52d8159fc0bb4088b/lib/pointer.js#L204-L219 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.