コード例 #1
0
d.gs = function (dscr, get, set/*, options*/) {
	var c, e, options, desc;
	if (typeof dscr !== 'string') {
		options = set;
		set = get;
		get = dscr;
		dscr = null;
	} else {
		options = arguments[3];
	}
	if (get == null) {
		get = undefined;
	} else if (!isCallable(get)) {
		options = get;
		get = set = undefined;
	} else if (set == null) {
		set = undefined;
	} else if (!isCallable(set)) {
		options = set;
		set = undefined;
	}
	if (dscr == null) {
		c = true;
		e = false;
	} else {
		c = contains.call(dscr, 'c');
		e = contains.call(dscr, 'e');
	}

	desc = { get: get, set: set, configurable: c, enumerable: e };
	return !options ? desc : assign(normalizeOpts(options), desc);
};
コード例 #2
0
ファイル: data.js プロジェクト: medikoo/github-news-reader
const handleOpenIssue = function (article, match) {
	let itemData;
	fixLinks(article);
	titleFromBlockquote(article);
	if (
		contains.call(article.title, "opened issue") ||
		contains.call(article.title, "opened pull request")
	) {
		itemData = match[1].split("/");
		github.issues.getForRepo(
			{
				user: itemData[0],
				repo: itemData[1],
				number: match[2]
			},
			bodyFromAPI(article)
		);
	} else if (
		contains.call(article.title, "closed issue") ||
		contains.call(article.title, "closed pull request")
	) {
		article.description = article.description
			.replace(/<blockquote>([\0-\uffff]+)<\/blockquote>/, "")
			.replace(" class=\"details\">", " class=\"details\" style=\"display:none\">");
	}
};
ArrayIterator = module.exports = function (arr, kind) {
	if (!(this instanceof ArrayIterator)) throw new TypeError("Constructor requires 'new'");
	Iterator.call(this, arr);
	if (!kind) kind = "value";
	else if (contains.call(kind, "key+value")) kind = "key+value";
	else if (contains.call(kind, "key")) kind = "key";
	else kind = "value";
	defineProperty(this, "__kind__", d("", kind));
};
コード例 #4
0
ファイル: array.js プロジェクト: tracyapps/chad
ArrayIterator = module.exports = function( arr, kind ) {
	if( !(this instanceof ArrayIterator) ) return new ArrayIterator( arr, kind );
	Iterator.call( this, arr );
	if( !kind ) kind = 'value';
	else if( contains.call( kind, 'key+value' ) ) kind = 'key+value';
	else if( contains.call( kind, 'key' ) ) kind = 'key';
	else kind = 'value';
	defineProperty( this, '__kind__', d( '', kind ) );
};
コード例 #5
0
ファイル: parse.js プロジェクト: medikoo/xlint
	data.forEach(function (line) {
		var name, value, match, nuPath;

		if (newFileStartRe.test(line)) {
			nuPath = resolve(path, line);
			if (!startsWith.call(nuPath, path)) {
				console.error("Cannot set options for outer path: '" + line + "' in " +
					resolve(path, '.lint') + " (section ignored)");
				ignore = true;
			} else {
				ignore = false;
			}
			if (lastPathLine) workingPath += '\x08' + nuPath;
			else workingPath = nuPath;
			lastPathLine = true;
			return;
		}

		lastPathLine = false;
		if (!line || ignore) return;

		match = line.match(nameRe);
		if (!match) {
			console.error("Unrecognized option: '" + line + "' in " +
				resolve(path, '.lint') + " (rule ignored)");
			return;
		}

		name = match[2];
		value = line.slice(match[0].length).trim() || true;

		if (match[1]) {
			if (value !== true) {
				console.error("Negation of not boolean option: '" + name + "' in " +
					resolve(path, '.lint') + " (rule ignored)");
				return;
			}
			value = false;
		}

		if (match[3] && isBoolean(value)) {
			console.error("+/- instruction for non list option: '" + name +
				"' in " + resolve(path, '.lint') + " (rule ignored)");
			return;
		}

		if (workingPath !== currentPath) {
			optsList.push({ path: workingPath, opts: currentOpts = {} });
			currentPath = workingPath;
		}

		if (match[3]) {
			value = toList(value);
			value = [{ action: (match[3] === '+') ? 'add' : 'remove', value: value }];
			value.mod = true;
		} else if (contains.call(value, ',')) {
			value = toList(value);
		}
		extendOption(currentOpts, hyphenToCamel.call(name), value);
	});
コード例 #6
0
ファイル: iterator.js プロジェクト: tracyapps/chad
SetIterator = module.exports = function( set, kind ) {
	if( !(this instanceof SetIterator) ) return new SetIterator( set, kind );
	Iterator.call( this, set.__setData__, set );
	if( !kind ) kind = 'value';
	else if( contains.call( kind, 'key+value' ) ) kind = 'key+value';
	else kind = 'value';
	defineProperty( this, '__kind__', d( '', kind ) );
};
コード例 #7
0
ファイル: data.js プロジェクト: medikoo/github-news-reader
	return function (err, obj) {
		if (err) {
			if (contains.call(err.message, "Issues are disabled for this repo")) {
				return;
			}
			if (contains.call(err.message, "Not Found")) return;
			if (contains.call(err.message, "Server Error")) return;
			logAPIError(err.message, article, err);
			return;
		}
		article.description = article.description.replace(
			/<blockquote([\0-\uffff]+)<\/blockquote>/,
			`<blockquote>${ toHTML(obj.body) }</blockquote>`
		);
		log("Updated description from API");
		if (!config.dev) {
			require("./webmake")(true);
		}
	};
コード例 #8
0
module.exports = function (t, a) {
	var el;
	if (typeof document === "undefined") return;

	el = t.call(document, function (foo) {
 return foo;
}, "raz");

	a(el.nodeName.toLowerCase(), "script", "Name");
	a(contains.call(el.firstChild.data, "return foo;"), true, "Content");
};
コード例 #9
0
ファイル: primitive-iterator.js プロジェクト: tracyapps/chad
PrimitiveSetIterator = module.exports = function( set, kind ) {
	if( !(this instanceof PrimitiveSetIterator) ) {
		return new PrimitiveSetIterator( set, kind );
	}
	Iterator.call( this, keys( set.__setData__ ), set );
	kind = (!kind || !contains.call( kind, 'key+value' )) ? 'value' : 'key+value';
	defineProperties( this, {
		__kind__: d( '', kind ),
		__data__: d( 'w', set.__setData__ )
	} );
};
コード例 #10
0
ファイル: lint-file.js プロジェクト: medikoo/xlint
	forEach(goptions, function (value, name) {
		var oid;
		if (contains.call(name, '.')) {
			oid = name.split('.', 1)[0];
			if (oid !== id) {
				return;
			}
			name = name.slice(oid.length + 1);
		}
		options[name] = value;
	});
コード例 #11
0
d = module.exports = function (dscr, value/*, options*/) {
	var c, e, w, options, desc;
	if ((arguments.length < 2) || (typeof dscr !== 'string')) {
		options = value;
		value = dscr;
		dscr = null;
	} else {
		options = arguments[2];
	}
	if (dscr == null) {
		c = w = true;
		e = false;
	} else {
		c = contains.call(dscr, 'c');
		e = contains.call(dscr, 'e');
		w = contains.call(dscr, 'w');
	}

	desc = { value: value, configurable: c, enumerable: e, writable: w };
	return !options ? desc : assign(normalizeOpts(options), desc);
};
コード例 #12
0
ファイル: data.js プロジェクト: medikoo/github-news-reader
		(article, orgmatch) => {
			let dataItem;
			fixLinks(article);
			if (contains.call(article.description, "…</p>")) {
				dataItem = orgmatch[1].split("/");
				github.pullRequests.getComment(
					{
						user: dataItem[0],
						repo: dataItem[1],
						number: orgmatch[3]
					},
					bodyFromAPI(article)
				);
			}
		}
コード例 #13
0
ファイル: data.js プロジェクト: medikoo/github-news-reader
		(article, orgmatch) => {
			let data;
			fixLinks(article);
			titleFromAttr(article);
			if (contains.call(article.description, "…</p>")) {
				data = orgmatch[1].split("/");
				github.issues.getComment(
					{
						user: data[0],
						repo: data[1],
						id: orgmatch[3]
					},
					bodyFromAPI(article)
				);
			}
		}
コード例 #14
0
ファイル: iterator.js プロジェクト: ahdinosaur/dbjs
MultiplePropertyIterator = module.exports = function (set, kind) {
	var sKey, sKeys, data;
	if (!(this instanceof MultiplePropertyIterator)) {
		return new MultiplePropertyIterator(set, kind);
	}
	sKeys = [];
	data = set.__setData__;
	for (sKey in data) {
		if ((typeof data[sKey] !== 'number') && !data[sKey]._value_) continue;
		sKeys.push(sKey);
	}
	Iterator.call(this, sKeys.sort(byLastModified.bind(data)));
	kind = (!kind || !contains.call(kind, 'key+value')) ? 'value' : 'key+value';
	defineProperties(this, {
		__kind__: d('', kind),
		__set__: d('w', set)
	});
	set.object._getMultipleIterators_(set.__pSKey__).push(this);
};
コード例 #15
0
ファイル: lazy.js プロジェクト: 0065paula/green-seeds
define = function (name, options) {
	var value, dgs, cacheName, desc, writable = false, resolvable
	  , flat;
	options = Object(validValue(options));
	cacheName = options.cacheName;
	flat = options.flat;
	if (cacheName == null) cacheName = name;
	delete options.cacheName;
	value = options.value;
	resolvable = isCallable(value);
	delete options.value;
	dgs = { configurable: Boolean(options.configurable),
		enumerable: Boolean(options.enumerable) };
	if (name !== cacheName) {
		dgs.get = function () {
			if (hasOwnProperty.call(this, cacheName)) return this[cacheName];
			cacheDesc.value = resolvable ? call.call(value, this, options) : value;
			cacheDesc.writable = writable;
			defineProperty(this, cacheName, cacheDesc);
			cacheDesc.value = null;
			if (desc) defineProperty(this, name, desc);
			return this[cacheName];
		};
	} else if (!flat) {
		dgs.get = function self() {
			var ownDesc;
			if (hasOwnProperty.call(this, name)) {
				ownDesc = getOwnPropertyDescriptor(this, name);
				// It happens in Safari, that getter is still called after property
				// was defined with a value, following workarounds that
				if (ownDesc.hasOwnProperty('value')) return ownDesc.value;
				if ((typeof ownDesc.get === 'function') && (ownDesc.get !== self)) {
					return ownDesc.get.call(this);
				}
				return value;
			}
			desc.value = resolvable ? call.call(value, this, options) : value;
			defineProperty(this, name, desc);
			desc.value = null;
			return this[name];
		};
	} else {
		dgs.get = function self() {
			var base = this, ownDesc;
			if (hasOwnProperty.call(this, name)) {
				// It happens in Safari, that getter is still called after property
				// was defined with a value, following workarounds that
				ownDesc = getOwnPropertyDescriptor(this, name);
				if (ownDesc.hasOwnProperty('value')) return ownDesc.value;
				if ((typeof ownDesc.get === 'function') && (ownDesc.get !== self)) {
					return ownDesc.get.call(this);
				}
			}
			while (!hasOwnProperty.call(base, name)) base = getPrototypeOf(base);
			desc.value = resolvable ? call.call(value, base, options) : value;
			defineProperty(base, name, desc);
			desc.value = null;
			return base[name];
		};
	}
	dgs.set = function (value) {
		dgs.get.call(this);
		this[cacheName] = value;
	};
	if (options.desc) {
		desc = {
			configurable: contains.call(options.desc, 'c'),
			enumerable: contains.call(options.desc, 'e')
		};
		if (cacheName === name) {
			desc.writable = contains.call(options.desc, 'w');
			desc.value = null;
		} else {
			writable = contains.call(options.desc, 'w');
			desc.get = dgs.get;
			desc.set = dgs.set;
		}
		delete options.desc;
	} else if (cacheName === name) {
		desc = {
			configurable: Boolean(options.configurable),
			enumerable: Boolean(options.enumerable),
			writable: Boolean(options.writable),
			value: null
		};
	}
	delete options.configurable;
	delete options.enumerable;
	delete options.writable;
	return dgs;
};
コード例 #16
0
if(listeners=data[type],"object"==typeof listeners)for(i=0;candidate=listeners[i];++i)(candidate===listener||candidate.__eeOnceListener__===listener)&&(2===listeners.length?data[type]=listeners[i?0:1]:listeners.splice(i,1));else(listeners===listener||listeners.__eeOnceListener__===listener)&&delete data[type];return this},emit=function(type){var i,l,listener,listeners,args;if(hasOwnProperty.call(this,"__ee__")&&(listeners=this.__ee__[type]))if("object"==typeof listeners){for(l=arguments.length,args=new Array(l-1),i=1;l>i;++i)args[i-1]=arguments[i];for(listeners=listeners.slice(),i=0;listener=listeners[i];++i)apply.call(listener,this,args)}else switch(arguments.length){case 1:call.call(listeners,this);break;case 2:call.call(listeners,this,arguments[1]);break;case 3:call.call(listeners,this,arguments[1],arguments[2]);break;default:for(l=arguments.length,args=new Array(l-1),i=1;l>i;++i)args[i-1]=arguments[i];apply.call(listeners,this,args)}},methods={on:on,once:once,off:off,emit:emit},descriptors={on:d(on),once:d(once),off:d(off),emit:d(emit)},base=defineProperties({},descriptors),module.exports=exports=function(o){return null==o?create(base):defineProperties(Object(o),descriptors)},exports.methods=methods},{d:32,"es5-ext/object/valid-callable":41}],32:[function(require,module){"use strict";var d,assign=require("es5-ext/object/assign"),normalizeOpts=require("es5-ext/object/normalize-options"),isCallable=require("es5-ext/object/is-callable"),contains=require("es5-ext/string/#/contains");d=module.exports=function(dscr,value){var c,e,w,options,desc;return arguments.length<2||"string"!=typeof dscr?(options=value,value=dscr,dscr=null):options=arguments[2],null==dscr?(c=w=!0,e=!1):(c=contains.call(dscr,"c"),e=contains.call(dscr,"e"),w=contains.call(dscr,"w")),desc={value:value,configurable:c,enumerable:e,writable:w},options?assign(normalizeOpts(options),desc):desc},d.gs=function(dscr,get,set){var c,e,options,desc;return"string"!=typeof dscr?(options=set,set=get,get=dscr,dscr=null):options=arguments[3],null==get?get=void 0:isCallable(get)?null==set?set=void 0:isCallable(set)||(options=set,set=void 0):(options=get,get=set=void 0),null==dscr?(c=!0,e=!1):(c=contains.call(dscr,"c"),e=contains.call(dscr,"e")),desc={get:get,set:set,configurable:c,enumerable:e},options?assign(normalizeOpts(options),desc):desc}},{"es5-ext/object/assign":33,"es5-ext/object/is-callable":36,"es5-ext/object/normalize-options":40,"es5-ext/string/#/contains":43}],33:[function(require,module){"use strict";module.exports=require("./is-implemented")()?Object.assign:require("./shim")},{"./is-implemented":34,"./shim":35}],34:[function(require,module){"use strict";module.exports=function(){var obj,assign=Object.assign;return"function"!=typeof assign?!1:(obj={foo:"raz"},assign(obj,{bar:"dwa"},{trzy:"trzy"}),obj.foo+obj.bar+obj.trzy==="razdwatrzy")}},{}],35:[function(require,module){"use strict";var keys=require("../keys"),value=require("../valid-value"),max=Math.max;module.exports=function(dest,src){var error,i,assign,l=max(arguments.length,2);for(dest=Object(value(dest)),assign=function(key){try{dest[key]=src[key]}catch(e){error||(error=e)}},i=1;l>i;++i)src=arguments[i],keys(src).forEach(assign);if(void 0!==error)throw error;return dest}},{"../keys":37,"../valid-value":42}],36:[function(require,module){"use strict";module.exports=function(obj){return"function"==typeof obj}},{}],37:[function(require,module){"use strict";module.exports=require("./is-implemented")()?Object.keys:require("./shim")},{"./is-implemented":38,"./shim":39}],38:[function(require,module){"use strict";module.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},{}],39:[function(require,module){"use strict";var keys=Object.keys;module.exports=function(object){return keys(null==object?object:Object(object))}},{}],40:[function(require,module){"use strict";var process,assign=require("./assign"),forEach=Array.prototype.forEach,create=Object.create,getPrototypeOf=Object.getPrototypeOf;process=function(src,obj){var proto=getPrototypeOf(src);return assign(proto?process(proto,obj):obj,src)},module.exports=function(){var result=create(null);return forEach.call(arguments,function(options){null!=options&&process(Object(options),result)}),result}},{"./assign":33}],41:[function(require,module){"use strict";module.exports=function(fn){if("function"!=typeof fn)throw new TypeError(fn+" is not a function");return fn}},{}],42:[function(require,module){"use strict";module.exports=function(value){if(null==value)throw new TypeError("Cannot use null or undefined");return value}},{}],43:[function(require,module){"use strict";module.exports=require("./is-implemented")()?String.prototype.contains:require("./shim")},{"./is-implemented":44,"./shim":45}],44:[function(require,module){"use strict";var str="razdwatrzy";module.exports=function(){return"function"!=typeof str.contains?!1:str.contains("dwa")===!0&&str.contains("foo")===!1}},{}],45:[function(require,module){"use strict";var indexOf=String.prototype.indexOf;module.exports=function(searchString){return indexOf.call(this,searchString,arguments[1])>-1}},{}],46:[function(require,module){"use strict";var canUseDOM="undefined"!=typeof window,ExecutionEnvironment={canUseDOM:canUseDOM,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:canUseDOM&&(window.addEventListener||window.attachEvent),isInWorker:!canUseDOM};module.exports=ExecutionEnvironment},{}],47:[function(require,module){function copyProperties(obj,a,b,c,d,e,f){obj=obj||{};for(var v,args=[a,b,c,d,e],ii=0;args[ii];){v=args[ii++];for(var k in v)obj[k]=v[k];v.hasOwnProperty&&v.hasOwnProperty("toString")&&"undefined"!=typeof v.toString&&obj.toString!==v.toString&&(obj.toString=v.toString)}return obj}module.exports=copyProperties},{}],48:[function(require,module){function makeEmptyFunction(arg){return function(){return arg}}function emptyFunction(){}var copyProperties=require("./copyProperties");copyProperties(emptyFunction,{thatReturns:makeEmptyFunction,thatReturnsFalse:makeEmptyFunction(!1),thatReturnsTrue:makeEmptyFunction(!0),thatReturnsNull:makeEmptyFunction(null),thatReturnsThis:function(){return this},thatReturnsArgument:function(arg){return arg}}),module.exports=emptyFunction},{"./copyProperties":47}],49:[function(require,module){"use strict";var invariant=function(condition){if(!condition){var error=new Error("Minified exception occured; use the non-minified dev environment for the full error message and additional helpful warnings.");throw error.framesToPop=1,error}};module.exports=invariant},{}],50:[function(require,module){"use strict";var invariant=require("./invariant"),keyMirror=function(obj){var key,ret={};invariant(obj instanceof Object&&!Array.isArray(obj));for(key in obj)obj.hasOwnProperty(key)&&(ret[key]=key);return ret};module.exports=keyMirror},{"./invariant":49}],51:[function(require,module){"use strict";var mergeInto=require("./mergeInto"),merge=function(one,two){var result={};return mergeInto(result,one),mergeInto(result,two),result};module.exports=merge},{"./mergeInto":53}],52:[function(require,module){"use strict";var invariant=require("./invariant"),keyMirror=require("./keyMirror"),MAX_MERGE_DEPTH=36,isTerminal=function(o){return"object"!=typeof o||null===o},mergeHelpers={MAX_MERGE_DEPTH:MAX_MERGE_DEPTH,isTerminal:isTerminal,normalizeMergeArg:function(arg){return void 0===arg||null===arg?{}:arg},checkMergeArrayArgs:function(one,two){invariant(Array.isArray(one)&&Array.isArray(two))},checkMergeObjectArgs:function(one,two){mergeHelpers.checkMergeObjectArg(one),mergeHelpers.checkMergeObjectArg(two)},checkMergeObjectArg:function(arg){invariant(!isTerminal(arg)&&!Array.isArray(arg))},checkMergeLevel:function(level){invariant(MAX_MERGE_DEPTH>level)},checkArrayStrategy:function(strategy){invariant(void 0===strategy||strategy in mergeHelpers.ArrayStrategies)},ArrayStrategies:keyMirror({Clobber:!0,IndexByIndex:!0})};module.exports=mergeHelpers},{"./invariant":49,"./keyMirror":50}],53:[function(require,module){"use strict";function mergeInto(one,two){if(checkMergeObjectArg(one),null!=two){checkMergeObjectArg(two);for(var key in two)two.hasOwnProperty(key)&&(one[key]=two[key])}}var mergeHelpers=require("./mergeHelpers"),checkMergeObjectArg=mergeHelpers.checkMergeObjectArg;module.exports=mergeInto},{"./mergeHelpers":52}],54:[function(require,module){"use strict";var emptyFunction=require("./emptyFunction"),warning=emptyFunction;module.exports=warning},{"./emptyFunction":48}]},{},[13]);