<commit_before>import { expect } from 'chai';

import React from 'react';
import { Link } from 'react-router';
import DocumentTitle from 'react-document-title';
import { shallow } from 'enzyme';

import MarkdownWrapper from 'wrappers/md';
import Author from 'src/Author';
import ReadMore from 'src/ReadMore';

describe('unit/wrappers/md', () => {
  it('renders', () => {
    const route = {
      page: {
        data: {
          tags: ['one', 'two'],
          title: 'Post title',
          body: 'Body of the post',
          date: new Date('2015-05-17T21:55:17.888Z'),
        },
      },
      pages: [],
    };

    const wrapper = shallow(<MarkdownWrapper route={route} />);

    expect(wrapper.find(DocumentTitle)).to.have.length(1);
    expect(wrapper.find(Link)).to.have.length(2);
    expect(wrapper.find(Author)).to.have.length(1);
    expect(wrapper.find(ReadMore)).to.have.length(1);

    expect(wrapper.contains(
Post title
)).to.equal(true);

    const html = wrapper.html();
    expect(html).to.contain('Tags:');
  });

  it('renders without any provided tags', () => {
    const route = {
      page: {
        data: {
          tags: [],
          title: 'Post title',
          body: 'Body of the post',
          date: new Date('2015-05-17T21:55:17.888Z'),
        },
      },
      pages: [],
    };

    const wrapper = shallow(<MarkdownWrapper route={route} />);

    const html = wrapper.html();
    expect(html).not.to.contain('Tags:');
  });
});
<commit_msg>test(fix): Look for page title in HTML after style tag add<commit_after>import { expect } from 'chai';

import React from 'react';
import { Link } from 'react-router';
import DocumentTitle from 'react-document-title';
import { shallow } from 'enzyme';

import MarkdownWrapper from 'wrappers/md';
import Author from 'src/Author';
import ReadMore from 'src/ReadMore';

describe('unit/wrappers/md', () => {
  it('renders', () => {
    const route = {
      page: {
        data: {
          tags: ['one', 'two'],
          title: 'Post title',
          body: 'Body of the post',
          date: new Date('2015-05-17T21:55:17.888Z'),
        },
      },
      pages: [],
    };

    const wrapper = shallow(<MarkdownWrapper route={route} />);

    expect(wrapper.find(DocumentTitle)).to.have.length(1);
    expect(wrapper.find(Link)).to.have.length(2);
    expect(wrapper.find(Author)).to.have.length(1);
    expect(wrapper.find(ReadMore)).to.have.length(1);

    const html = wrapper.html();
    expect(html).to.contain('Post title');
    expect(html).to.contain('Tags:');
  });

  it('renders without any provided tags', () => {
    const route = {
      page: {
        data: {
          tags: [],
          title: 'Post title',
          body: 'Body of the post',
          date: new Date('2015-05-17T21:55:17.888Z'),
        },
      },
      pages: [],
    };

    const wrapper = shallow(<MarkdownWrapper route={route} />);

    const html = wrapper.html();
    expect(html).not.to.contain('Tags:');
  });
});
<|endoftext|>


<commit_before>;(function(window, undefined) {
	"use strict";
	var ess,emptyArray = [],slice = emptyArray.slice,filter = emptyArray.filter,elementTypes = [1, 9, 11],
		WCJ = (function(){
		var WCJ = function( selector ) {
		    return new WCJ.fn.init(selector);
		};
		WCJ.fn = WCJ.prototype = {
			init:function( selector ){
				var dom ;
    			if (!selector)
    				dom = emptyArray,dom.selector = selector || '',dom.__proto__ = WCJ.fn.init.prototype;
    			else if (WCJ.isFunction(selector)) return WCJ(document).ready(selector)
    			else {
    				if (WCJ.isArray(selector))
    					dom = selector;
				    else if (WCJ.isObject(selector))
				    	dom = [selector], selector = null
	                else if (elementTypes.indexOf(selector.nodeType) >= 0 || selector === window)
	                	dom = [selector], selector = null;
	                else dom = (function(){
				        var found;
				        return (document && /^#([\w-]+)$/.test(selector))?
				        ((found = document.getElementById(RegExp.$1)) ? [found] : emptyArray ):
					    slice.call(
						    /^\.([\w-]+)$/.test(selector) ? document.getElementsByClassName(RegExp.$1) :
						    /^[\w-]+$/.test(selector) ? document.getElementsByTagName(selector) :
						    document.querySelectorAll(selector)
					    );
					})();
					dom = dom || emptyArray;
					dom.__proto__ = WCJ.fn.init.prototype;
					dom.selector = selector || '';
    			}
    			return dom;
			},
			size:function(){return this.length;}
		}
		WCJ.fn.init.prototype = WCJ.fn;
        WCJ.extend = WCJ.fn.extend = function () {
            var options, name, src, copy,
			target = arguments[0],
			i = 1,
			length = arguments.length,
			deep = false;
            //处理深拷贝的情况
            if (typeof (target) === "boolean") {
                deep = target;
                target = arguments[1] || {};
                i = 2;
            }
            //处理时，目标是一个字符串或（深拷贝可能的情况下）的东西
            if (typeof (target) !== "object" && !WCJ.isFunction(target)) {
                target = {};
            }
            //扩展WCJ的本身，如果只有一个参数传递
            if (length === i) {
                target = this;
                --i;
            }
            for (; i < length; i++) {
                if ((options = arguments[i]) != null) {
                    for (name in options) {
                        src = target[name];
                        copy = options[name];
                        if (target === copy) {
                            continue;
                        }
                        if (copy !== undefined) {
                            target[name] = copy;
                        }
                    }
                }
            }
            return target;
        };
		return WCJ;
	})();

	WCJ.fn.extend({
		forEach: emptyArray.forEach,
		concat: emptyArray.concat,
		ready: function(callback){
			if (/complete|loaded|interactive/.test(document.readyState) && document.body) callback(WCJ)
			else document.addEventListener('DOMContentLoaded', function(){callback(WCJ) }, false)
			return this
		},
	    each: function(callback){
	      this.forEach(function(el, idx){ callback.call(el, idx, el) });
	      return this;
	    },
	    map: function(fn){
	    	return WCJ(WCJ.map(this, function(el, i){ return fn.call(el, i, el) }));
	    },
	    get: function(index){
	      return index === undefined ? slice.call(this) : this[index >= 0 ? index : index + this.length];
	    },
	    empty: function(){ return this.each(function(){ this.innerHTML = '' }) },
	    text: function(text){
	      return text === undefined ?
	        (this.length > 0 ? this[0].textContent : null) :
	        this.each(function(){ this.textContent = text });
	    },
        bind: function(type, func) {
			this.each(function(){
				if (this.addEventListener) this.addEventListener(type, func, false);
				else if (this.attachEvent) this.attachEvent("on" + type, func);
				else this["on" + type] = func;
			})
			return this;
		},
		unbind:function(type, func) {
			this.each(function(ele,obj){
				if (this.removeEventListener) this.removeEventListener(type, func, false);
				else if (this[i].detachEvent) this.detachEvent("on" + type, func);
				else this["on" + type] = null;
			})
			return this;
		},
		filter:function(selector){
			return WCJ(filter.call(this, function(element){
        		return WCJ.matches(element, selector)
		    }))
		},
		pluck: function(property){ return WCJ.map(this, function(el){ return el[property] })},
		parent: function(){
			var arr=this.pluck('parentNode');
			return filter.call(arr, function(item, idx){
				return arr.indexOf(item) == idx
			});
		},
		parents: function(selector){
			var ancestors=WCJ.sibling(this,'parentNode');
    		return selector == null ? WCJ(ancestors) : WCJ(ancestors).filter(selector);
		}
	});

	WCJ.extend({
		isDocument:function (obj) { return obj = obj ? obj != null && obj.nodeType ? obj.nodeType == obj.DOCUMENT_NODE : false : undefined;},
		isFunction:function (value) { return ({}).toString.call(value) == "[object Function]" },
		isObject:function (value) { return value instanceof Object },
		isArray:function (value) { return value instanceof Array },
		likeArray:function (obj) { return typeof obj.length == 'number' },
        type: function (obj) {
            switch (obj) {
                case null: return "Null";
                case (void 0): return "Undefined";
            }
            var type = typeof (obj);
            switch (type) {
                case 'boolean': return "Boolean";
                case 'number': return "Number";
                case 'string': return "String";
                case 'function': return "Function";
            }
            return "Object";
        },
        error:function(msg) {throw msg;},
        each:function(elements, callback){
			var i, key
			if (this.likeArray(elements)) {
				for (i = 0; i < elements.length; i++)
					if (callback.call(elements[i], i, elements[i]) === false) return elements
				} else {
				for (key in elements)
					if (callback.call(elements[key], key, elements[key]) === false) return elements
			}
			return elements
		},
		map:function(elements, callback){
			var value, values = [], i, key
			if (this.likeArray(elements))
			for (i = 0; i < elements.length; i++) {
				value = callback(elements[i], i)
				if (value != null) values.push(value)
			}
			else
			for (key in elements) {
				value = callback(elements[key], key)
				if (value != null) values.push(value)
			}
			return values.length > 0 ? WCJ.fn.concat.apply([], values) : values;
		},
		matches:function(element, selector){
			if (!selector || !element || element.nodeType !== 1) return false;
		    var matchesSelector = element.webkitMatchesSelector || element.mozMatchesSelector ||
		                          element.oMatchesSelector || element.msMatchesSelector || element.matchesSelector;
		    if (matchesSelector) return matchesSelector.call(element, selector);
		},
		inArray:function(elem, array, i){
			return emptyArray.indexOf.call(array, elem, i)
		},
	    sibling:function(nodes,ty){
			var ancestors = [];
			while (nodes.length > 0)
			nodes = WCJ.map(nodes, function(node){
				if ((node = node[ty]) && !WCJ.isDocument(node) && ancestors.indexOf(node) < 0)
					ancestors.push(node)
					return node
			});
			return ancestors;
	    }
	});

	//解决低版本浏览器对filter方法的支持
	if (!Array.prototype.filter){
		Array.prototype.filter = function(fun /*, thisArg */){
			"use strict";
			if (this === void 0 || this === null)
				throw new TypeError();
			var t = Object(this);
			var len = t.length >>> 0;
			if (typeof fun !== "function")
				throw new TypeError();
			var res = [];
			var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
			for (var i = 0; i < len; i++){
				if (i in t){
					var val = t[i];
					if (fun.call(thisArg, val, i, t))
					res.push(val);
				}
			}
			return res;
		};
	}
	//低版本IE对indexOf方法的支持
	if(!Array.indexOf){
	    Array.prototype.indexOf = function(obj){
	        for(var i=0; i<this.length; i++){
	            if(this[i]==obj){
	                return i;
	            }
	        }
	        return -1;
	    }
	}
	//低版本IE对forEach方法的支持
	if (!Array.prototype.forEach) {
	    Array.prototype.forEach = function(fun /*, thisp*/){
	        var len = this.length;
	        if (typeof fun != "function")
	            throw new TypeError();
	        var thisp = arguments[1];
	        for (var i = 0; i < len; i++){
	            if (i in this)
	                fun.call(thisp, this[i], i, this);
	        }
	    };
	}

	//字符串处理
    WCJ.extend(String.prototype,{
        trim: function () {return this.replace(/(^\s*)|(\s*$)/g, "");},
        leftTrim: function () {return this.replace(/(^\s*)/g, "");}
    })
	window.WCJ = window.$$ = WCJ;
})(window);<commit_msg>prev:获取对象集合每个元素的所有上一个对象(可以带上滤选择器)<commit_after>;(function(window, undefined) {
	"use strict";
	var ess,emptyArray = [],slice = emptyArray.slice,filter = emptyArray.filter,elementTypes = [1, 9, 11],
		WCJ = (function(){
		var WCJ = function( selector ) {
		    return new WCJ.fn.init(selector);
		};
		WCJ.fn = WCJ.prototype = {
			init:function( selector ){
				var dom ;
    			if (!selector)
    				dom = emptyArray,dom.selector = selector || '',dom.__proto__ = WCJ.fn.init.prototype;
    			else if (WCJ.isFunction(selector)) return WCJ(document).ready(selector)
    			else {
    				if (WCJ.isArray(selector))
    					dom = selector;
				    else if (WCJ.isObject(selector))
				    	dom = [selector], selector = null
	                else if (elementTypes.indexOf(selector.nodeType) >= 0 || selector === window)
	                	dom = [selector], selector = null;
	                else dom = (function(){
				        var found;
				        return (document && /^#([\w-]+)$/.test(selector))?
				        ((found = document.getElementById(RegExp.$1)) ? [found] : emptyArray ):
					    slice.call(
						    /^\.([\w-]+)$/.test(selector) ? document.getElementsByClassName(RegExp.$1) :
						    /^[\w-]+$/.test(selector) ? document.getElementsByTagName(selector) :
						    document.querySelectorAll(selector)
					    );
					})();
					dom = dom || emptyArray;
					dom.__proto__ = WCJ.fn.init.prototype;
					dom.selector = selector || '';
    			}
    			return dom;
			},
			size:function(){return this.length;}
		}
		WCJ.fn.init.prototype = WCJ.fn;
        WCJ.extend = WCJ.fn.extend = function () {
            var options, name, src, copy,
			target = arguments[0],
			i = 1,
			length = arguments.length,
			deep = false;
            //处理深拷贝的情况
            if (typeof (target) === "boolean") {
                deep = target;
                target = arguments[1] || {};
                i = 2;
            }
            //处理时，目标是一个字符串或（深拷贝可能的情况下）的东西
            if (typeof (target) !== "object" && !WCJ.isFunction(target)) {
                target = {};
            }
            //扩展WCJ的本身，如果只有一个参数传递
            if (length === i) {
                target = this;
                --i;
            }
            for (; i < length; i++) {
                if ((options = arguments[i]) != null) {
                    for (name in options) {
                        src = target[name];
                        copy = options[name];
                        if (target === copy) {
                            continue;
                        }
                        if (copy !== undefined) {
                            target[name] = copy;
                        }
                    }
                }
            }
            return target;
        };
		return WCJ;
	})();

	WCJ.fn.extend({
		forEach: emptyArray.forEach,
		concat: emptyArray.concat,
		ready: function(callback){
			if (/complete|loaded|interactive/.test(document.readyState) && document.body) callback(WCJ)
			else document.addEventListener('DOMContentLoaded', function(){callback(WCJ) }, false)
			return this
		},
	    each: function(callback){
	      this.forEach(function(el, idx){ callback.call(el, idx, el) });
	      return this;
	    },
	    map: function(fn){
	    	return WCJ(WCJ.map(this, function(el, i){ return fn.call(el, i, el) }));
	    },
	    get: function(index){
	      return index === undefined ? slice.call(this) : this[index >= 0 ? index : index + this.length];
	    },
	    empty: function(){ return this.each(function(){ this.innerHTML = '' }) },
	    text: function(text){
	      return text === undefined ?
	        (this.length > 0 ? this[0].textContent : null) :
	        this.each(function(){ this.textContent = text });
	    },
        bind: function(type, func) {
			this.each(function(){
				if (this.addEventListener) this.addEventListener(type, func, false);
				else if (this.attachEvent) this.attachEvent("on" + type, func);
				else this["on" + type] = func;
			})
			return this;
		},
		unbind:function(type, func) {
			this.each(function(ele,obj){
				if (this.removeEventListener) this.removeEventListener(type, func, false);
				else if (this[i].detachEvent) this.detachEvent("on" + type, func);
				else this["on" + type] = null;
			})
			return this;
		},
		filter:function(selector){
			return WCJ(filter.call(this, function(element){
        		return WCJ.matches(element, selector)
		    }))
		},
		pluck: function(property){ return WCJ.map(this, function(el){ return el[property] })},
		parent: function(){
			var arr=this.pluck('parentNode');
			return filter.call(arr, function(item, idx){
				return arr.indexOf(item) == idx
			});
		},
		parents: function(selector){
			var ancestors=WCJ.sibling(this,'parentNode');
    		return selector == null ? WCJ(ancestors) : WCJ(ancestors).filter(selector);
		},
		prev: function(selector){
			return WCJ(this.pluck('previousElementSibling')).filter(selector || '*')
		}
	});

	WCJ.extend({
		isDocument:function (obj) { return obj = obj ? obj != null && obj.nodeType ? obj.nodeType == obj.DOCUMENT_NODE : false : undefined;},
		isFunction:function (value) { return ({}).toString.call(value) == "[object Function]" },
		isObject:function (value) { return value instanceof Object },
		isArray:function (value) { return value instanceof Array },
		likeArray:function (obj) { return typeof obj.length == 'number' },
        type: function (obj) {
            switch (obj) {
                case null: return "Null";
                case (void 0): return "Undefined";
            }
            var type = typeof (obj);
            switch (type) {
                case 'boolean': return "Boolean";
                case 'number': return "Number";
                case 'string': return "String";
                case 'function': return "Function";
            }
            return "Object";
        },
        error:function(msg) {throw msg;},
        each:function(elements, callback){
			var i, key
			if (this.likeArray(elements)) {
				for (i = 0; i < elements.length; i++)
					if (callback.call(elements[i], i, elements[i]) === false) return elements
				} else {
				for (key in elements)
					if (callback.call(elements[key], key, elements[key]) === false) return elements
			}
			return elements
		},
		map:function(elements, callback){
			var value, values = [], i, key
			if (this.likeArray(elements))
			for (i = 0; i < elements.length; i++) {
				value = callback(elements[i], i)
				if (value != null) values.push(value)
			}
			else
			for (key in elements) {
				value = callback(elements[key], key)
				if (value != null) values.push(value)
			}
			return values.length > 0 ? WCJ.fn.concat.apply([], values) : values;
		},
		matches:function(element, selector){
			if (!selector || !element || element.nodeType !== 1) return false;
		    var matchesSelector = element.webkitMatchesSelector || element.mozMatchesSelector ||
		                          element.oMatchesSelector || element.msMatchesSelector || element.matchesSelector;
		    if (matchesSelector) return matchesSelector.call(element, selector);
		},
		inArray:function(elem, array, i){
			return emptyArray.indexOf.call(array, elem, i)
		},
	    sibling:function(nodes,ty){
			var ancestors = [];
			while (nodes.length > 0)
			nodes = WCJ.map(nodes, function(node){
				if ((node = node[ty]) && !WCJ.isDocument(node) && ancestors.indexOf(node) < 0)
					ancestors.push(node)
					return node
			});
			return ancestors;
	    }
	});

	//解决低版本浏览器对filter方法的支持
	if (!Array.prototype.filter){
		Array.prototype.filter = function(fun /*, thisArg */){
			"use strict";
			if (this === void 0 || this === null)
				throw new TypeError();
			var t = Object(this);
			var len = t.length >>> 0;
			if (typeof fun !== "function")
				throw new TypeError();
			var res = [];
			var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
			for (var i = 0; i < len; i++){
				if (i in t){
					var val = t[i];
					if (fun.call(thisArg, val, i, t))
					res.push(val);
				}
			}
			return res;
		};
	}
	//低版本IE对indexOf方法的支持
	if(!Array.indexOf){
	    Array.prototype.indexOf = function(obj){
	        for(var i=0; i<this.length; i++){
	            if(this[i]==obj){
	                return i;
	            }
	        }
	        return -1;
	    }
	}
	//低版本IE对forEach方法的支持
	if (!Array.prototype.forEach) {
	    Array.prototype.forEach = function(fun /*, thisp*/){
	        var len = this.length;
	        if (typeof fun != "function")
	            throw new TypeError();
	        var thisp = arguments[1];
	        for (var i = 0; i < len; i++){
	            if (i in this)
	                fun.call(thisp, this[i], i, this);
	        }
	    };
	}

	//字符串处理
    WCJ.extend(String.prototype,{
        trim: function () {return this.replace(/(^\s*)|(\s*$)/g, "");},
        leftTrim: function () {return this.replace(/(^\s*)/g, "");}
    })
	window.WCJ = window.$$ = WCJ;
})(window);<|endoftext|>


<commit_before>define([
	"dojo/keys", // keys.ENTER keys.SPACE
	"dojo/mouse",
	"dojo/on",
	"dojo/touch" // touch support for click is now there
], function(keys, mouse, on, touch){

	// module:
	//		dijit/a11yclick

	/*=====
	return {
		// summary:
		//		Custom press, release, and click synthetic events
		//		which trigger on a left mouse click, touch, or space/enter keyup.

		click: function(node, listener){
			// summary:
			//		Logical click operation for mouse, touch, or keyboard (space/enter key)
		},
		press: function(node, listener){
			// summary:
			//		Mousedown (left button), touchstart, or keydown (space or enter) corresponding to logical click operation.
		},
		release: function(node, listener){
			// summary:
			//		Mouseup (left button), touchend, or keyup (space or enter) corresponding to logical click operation.
		},
		move: function(node, listener){
			// summary:
			//		Mouse cursor or a finger is dragged over the given node.
		}
	};
	=====*/

	function clickKey(/*Event*/ e){
		// Test if this keyboard event should be tracked as the start (if keydown) or end (if keyup) of a click event.
		// Only track for nodes marked to be tracked, and not for buttons or inputs since they handle keyboard click
		// natively.
		if((e.keyCode === keys.ENTER || e.keyCode === keys.SPACE) && !/input|button/i.test(e.target.nodeName)){

			// Test if a node or its ancestor has been marked with the dojoClick property to indicate special processing
			for(var node = e.target; node; node = node.parentNode){
				if(node.dojoClick){ return true; }
			}
		}
	}

	var lastKeyDownNode;

	on(document, "keydown", function(e){
		//console.log("a11yclick: onkeydown, e.target = ", e.target, ", lastKeyDownNode was ", lastKeyDownNode, ", equality is ", (e.target === lastKeyDownNode));
		if(clickKey(e)){
			// needed on IE for when focus changes between keydown and keyup - otherwise dropdown menus do not work
			lastKeyDownNode = e.target;

			// Prevent viewport scrolling on space key in IE<9.
			// (Reproducible on test_Button.html on any of the first dijit/form/Button examples)
			e.preventDefault();
		}else{
			lastKeyDownNode = null;
		}
	});

	on(document, "keyup", function(e){
		//console.log("a11yclick: onkeyup, e.target = ", e.target, ", lastKeyDownNode was ", lastKeyDownNode, ", equality is ", (e.target === lastKeyDownNode));
		if(clickKey(e) && e.target == lastKeyDownNode){	// === breaks greasemonkey
			//need reset here or have problems in FF when focus returns to trigger element after closing popup/alert
			lastKeyDownNode = null;

			on.emit(e.target, "click", {
				cancelable: true,
				bubbles: true,
				ctrlKey: e.ctrlKey,
				shiftKey: e.shiftKey,
				metaKey: e.metaKey,
				altKey: e.altKey,
				_origType: e.type
			});
		}
	});

	// I want to return a hash of the synthetic events, but for backwards compatibility the main return value
	// needs to be the click event.   Change for 2.0.

	var click = function(node, listener){
		// Set flag on node so that keydown/keyup above emits click event
		node.dojoClick = true;

		return on(node, "click", listener);
	};
	click.click = click;	// forward compatibility with 2.0

	click.press =  function(node, listener){
		var touchListener = on(node, touch.press, function(evt){
			if(evt.type == "mousedown" && !mouse.isLeft(evt)){
				// Ignore right click
				return;
			}
			listener(evt);
		}), keyListener = on(node, "keydown", function(evt){
			if(evt.keyCode === keys.ENTER || evt.keyCode === keys.SPACE){
				listener(evt);
			}
		});
		return {
			remove: function(){
				touchListener.remove();
				keyListener.remove();
			}
		};
	};

	click.release =  function(node, listener){
		var touchListener = on(node, touch.release, function(evt){
			if(evt.type == "mouseup" && !mouse.isLeft(evt)){
				// Ignore right click
				return;
			}
			listener(evt);
		}), keyListener = on(node, "keyup", function(evt){
			if(evt.keyCode === keys.ENTER || evt.keyCode === keys.SPACE){
				listener(evt);
			}
		});
		return {
			remove: function(){
				touchListener.remove();
				keyListener.remove();
			}
		};
	};

	click.move = touch.move;	// just for convenience

	return click;
});
<commit_msg>a11yclick should not prevent enter/space keypresses for textareas; fixes #16960 !strict<commit_after>define([
	"dojo/keys", // keys.ENTER keys.SPACE
	"dojo/mouse",
	"dojo/on",
	"dojo/touch" // touch support for click is now there
], function(keys, mouse, on, touch){

	// module:
	//		dijit/a11yclick

	/*=====
	return {
		// summary:
		//		Custom press, release, and click synthetic events
		//		which trigger on a left mouse click, touch, or space/enter keyup.

		click: function(node, listener){
			// summary:
			//		Logical click operation for mouse, touch, or keyboard (space/enter key)
		},
		press: function(node, listener){
			// summary:
			//		Mousedown (left button), touchstart, or keydown (space or enter) corresponding to logical click operation.
		},
		release: function(node, listener){
			// summary:
			//		Mouseup (left button), touchend, or keyup (space or enter) corresponding to logical click operation.
		},
		move: function(node, listener){
			// summary:
			//		Mouse cursor or a finger is dragged over the given node.
		}
	};
	=====*/

	function clickKey(/*Event*/ e){
		// Test if this keyboard event should be tracked as the start (if keydown) or end (if keyup) of a click event.
		// Only track for nodes marked to be tracked, and not for buttons or inputs,
		// since buttons handle keyboard click natively, and text inputs should not
		// prevent typing spaces or newlines.
		if((e.keyCode === keys.ENTER || e.keyCode === keys.SPACE) && !/input|button|textarea/i.test(e.target.nodeName)){

			// Test if a node or its ancestor has been marked with the dojoClick property to indicate special processing
			for(var node = e.target; node; node = node.parentNode){
				if(node.dojoClick){ return true; }
			}
		}
	}

	var lastKeyDownNode;

	on(document, "keydown", function(e){
		//console.log("a11yclick: onkeydown, e.target = ", e.target, ", lastKeyDownNode was ", lastKeyDownNode, ", equality is ", (e.target === lastKeyDownNode));
		if(clickKey(e)){
			// needed on IE for when focus changes between keydown and keyup - otherwise dropdown menus do not work
			lastKeyDownNode = e.target;

			// Prevent viewport scrolling on space key in IE<9.
			// (Reproducible on test_Button.html on any of the first dijit/form/Button examples)
			e.preventDefault();
		}else{
			lastKeyDownNode = null;
		}
	});

	on(document, "keyup", function(e){
		//console.log("a11yclick: onkeyup, e.target = ", e.target, ", lastKeyDownNode was ", lastKeyDownNode, ", equality is ", (e.target === lastKeyDownNode));
		if(clickKey(e) && e.target == lastKeyDownNode){	// === breaks greasemonkey
			//need reset here or have problems in FF when focus returns to trigger element after closing popup/alert
			lastKeyDownNode = null;

			on.emit(e.target, "click", {
				cancelable: true,
				bubbles: true,
				ctrlKey: e.ctrlKey,
				shiftKey: e.shiftKey,
				metaKey: e.metaKey,
				altKey: e.altKey,
				_origType: e.type
			});
		}
	});

	// I want to return a hash of the synthetic events, but for backwards compatibility the main return value
	// needs to be the click event.   Change for 2.0.

	var click = function(node, listener){
		// Set flag on node so that keydown/keyup above emits click event
		node.dojoClick = true;

		return on(node, "click", listener);
	};
	click.click = click;	// forward compatibility with 2.0

	click.press =  function(node, listener){
		var touchListener = on(node, touch.press, function(evt){
			if(evt.type == "mousedown" && !mouse.isLeft(evt)){
				// Ignore right click
				return;
			}
			listener(evt);
		}), keyListener = on(node, "keydown", function(evt){
			if(evt.keyCode === keys.ENTER || evt.keyCode === keys.SPACE){
				listener(evt);
			}
		});
		return {
			remove: function(){
				touchListener.remove();
				keyListener.remove();
			}
		};
	};

	click.release =  function(node, listener){
		var touchListener = on(node, touch.release, function(evt){
			if(evt.type == "mouseup" && !mouse.isLeft(evt)){
				// Ignore right click
				return;
			}
			listener(evt);
		}), keyListener = on(node, "keyup", function(evt){
			if(evt.keyCode === keys.ENTER || evt.keyCode === keys.SPACE){
				listener(evt);
			}
		});
		return {
			remove: function(){
				touchListener.remove();
				keyListener.remove();
			}
		};
	};

	click.move = touch.move;	// just for convenience

	return click;
});
<|endoftext|>


<commit_before>define([
	"dojo/_base/array", // array.forEach
	"dojo/_base/declare", // declare
	"dojo/has", // has("dom-addeventlistener")
	"dojo/keys", // keys.ENTER keys.SPACE
	"dojo/on",
	"dojo/touch" // touch support for click is now there
], function(array, declare, has, keys, on){

	// module:
	//		dijit/a11yclick

	function marked(/*DOMNode*/ node){
		// Test if a node or its ancestor has been marked with the dojoClick property to indicate special processing
		do{
			if(node.dojoClick){ return true; }
		}while(node = node.parentNode);
	}

	function clickKey(/*Event*/ e){
		// Test if this keyboard event should be tracked as the start (if keyup) or end (if keydown) of a click event.
		// Only track for nodes marked to be tracked, and not for buttons or inputs since they handle keyboard click
		// natively.
		return (e.keyCode === keys.ENTER || e.keyCode === keys.SPACE) &&
			!e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey && !/input|button/i.test(e.target.nodeName) &&
			marked(e.target);
	}

	var lastKeyDownNode;

	on(document, "keydown", function(e){
		//console.log(this.id + ": onkeydown, e.target = ", e.target, ", lastKeyDownNode was ", lastKeyDownNode, ", equality is ", (e.target === lastKeyDownNode));
		if(clickKey(e)){
			// needed on IE for when focus changes between keydown and keyup - otherwise dropdown menus do not work
			lastKeyDownNode = e.target;

			// Prevent viewport scrolling on space key in IE<9.
			// (Reproducible on test_Button.html on any of the first dijit/form/Button examples)
			e.preventDefault();
		}
	});

	on(document, "keyup", function(e){
		//console.log(this.id + ": onkeyup, e.target = ", e.target, ", lastKeyDownNode was ", lastKeyDownNode, ", equality is ", (e.target === lastKeyDownNode));
		if(clickKey(e) && e.target == lastKeyDownNode){	// === breaks greasemonkey
			//need reset here or have problems in FF when focus returns to trigger element after closing popup/alert
			lastKeyDownNode = null;

			on.emit(e.target, "click", {
				cancelable: true,
				bubbles: true
			});
		}
	});

	return function(node, listener){
		// summary:
		//		Custom a11yclick (a.k.a. ondijitclick) event
		//		which triggers on a mouse click, touch, or space/enter keyup.

		node.dojoClick = true;

		return on(node, "click", listener);
	};
});
<commit_msg>remove unused dependencies and streamline a11yclick code, refs #15878 !strict<commit_after>define([
	"dojo/keys", // keys.ENTER keys.SPACE
	"dojo/on",
	"dojo/touch" // touch support for click is now there
], function(keys, on){

	// module:
	//		dijit/a11yclick

	function clickKey(/*Event*/ e){
		// Test if this keyboard event should be tracked as the start (if keydown) or end (if keyup) of a click event.
		// Only track for nodes marked to be tracked, and not for buttons or inputs since they handle keyboard click
		// natively.
		if((e.keyCode === keys.ENTER || e.keyCode === keys.SPACE) &&
				!e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey && !/input|button/i.test(e.target.nodeName)){

			// Test if a node or its ancestor has been marked with the dojoClick property to indicate special processing
			for(var node = e.target; node; node = node.parentNode){
				if(node.dojoClick){ return true; }
			}
		}
	}

	var lastKeyDownNode;

	on(document, "keydown", function(e){
		//console.log(this.id + ": onkeydown, e.target = ", e.target, ", lastKeyDownNode was ", lastKeyDownNode, ", equality is ", (e.target === lastKeyDownNode));
		if(clickKey(e)){
			// needed on IE for when focus changes between keydown and keyup - otherwise dropdown menus do not work
			lastKeyDownNode = e.target;

			// Prevent viewport scrolling on space key in IE<9.
			// (Reproducible on test_Button.html on any of the first dijit/form/Button examples)
			e.preventDefault();
		}
	});

	on(document, "keyup", function(e){
		//console.log(this.id + ": onkeyup, e.target = ", e.target, ", lastKeyDownNode was ", lastKeyDownNode, ", equality is ", (e.target === lastKeyDownNode));
		if(clickKey(e) && e.target == lastKeyDownNode){	// === breaks greasemonkey
			//need reset here or have problems in FF when focus returns to trigger element after closing popup/alert
			lastKeyDownNode = null;

			on.emit(e.target, "click", {
				cancelable: true,
				bubbles: true
			});
		}
	});

	return function(node, listener){
		// summary:
		//		Custom a11yclick (a.k.a. ondijitclick) event
		//		which triggers on a mouse click, touch, or space/enter keyup.

		node.dojoClick = true;

		return on(node, "click", listener);
	};
});
<|endoftext|>


<commit_before>//= require ./array

var
    Iterable;

(function($) {
    "use strict";

    try {
        $.defineProperties($, {

            clone: {
                value: function(object, includeNonEnumerable) {
                    if (typeof includeNonEnumerable != "boolean") {
                        includeNonEnumerable = true;
                    }

                    var
                        clone = {},
                        properties = $.getOwnPropertyNames(object);

                    if (!includeNonEnumerable) {
                        return Object.assign(clone, object);
                    }

                    properties.forEach(function(p) {
                        clone[p] = object[p];
                    });

                    return clone;
                }
            },

            classForName: {
                value: function(name) {
                    return window[name];
                }
            },

            hasSameClass: {
                value: function(objects) {
                    var
                        argumentsAsArray = Array.from(arguments),
                        compared = objects,
                        count = 0;

                    argumentsAsArray = argumentsAsArray.slice(1,
                        argumentsAsArray.length);
                    argumentsAsArray.forEach(function(object) {
                        if ($.getPrototypeOf(compared) ==
                            $.getPrototypeOf(object)) {
                            count++;
                        }
                    });

                    return count == argumentsAsArray.length;
                }
            },

            isFromClass: {
                value: function(object, classFunction) {
                    return $.classForName($.className(object)) == classFunction;
                }
            },

            firstKey: {
                value: function(object) {
                    var
                        // Object: javascript literal object
                        keys = Object.keys(object);

                    return keys[0];
                }
            },

            lastKey: {
                value: function(object) {
                    var
                        keys = Object.keys(object);

                    return keys[keys.length - 1];
                }
            },

            normalizedAsLowerCase: {
                value: function(object) {
                    var
                        iterator,
                        attributes = Object.attributes(object),
                        clone = {};

                    Object.assign(clone, object);
                    object.length = attributes.length;
                    iterator = Iterable.Proxy.new(clone);

                    iterator.each(function(v, k) {
                        if (typeof v == "string") {
                            clone[k] = v.toLowerCase();
                        }
                    });

                    return clone;
                }
            },

            firstFromASlice: {
                value: function(object, slice, startingIndex, caseSensitive) {
                    var
                        iterator,
                        key,
                        regexp,
                        attributes = Object.attributes(object);

                    if (!startingIndex || typeof startingIndex != "number") {
                        if (typeof startingIndex == "boolean") {
                            caseSensitive = startingIndex;
                        } else if (!caseSensitive || typeof caseSensitive !=
                                   "boolean") {
                            caseSensitive = false;
                        }

                        startingIndex = 0;
                    }

                    slice = slice.trim();

                    if (!caseSensitive) {
                        regexp = new RegExp(slice, "i");
                    } else {
                        regexp = new RegExp(slice);
                    }

                    iterator = Iterable.Proxy.new(attributes);
                    iterator.each(function(k, i) {
                        if (!isNaN(i)) {
                            if (typeof object[k] == "string" && i
                                >= startingIndex) {
                                if (object[k].search(regexp) != -1) {
                                    key = k;
                                    this.finalize();
                                }
                            }
                        } else if (typeof object[k] == "string") {
                            if (object[k].search(regexp) != -1) {
                                key = k;
                                this.finalize();
                            }
                        }
                    });

                    if (key) {
                        return key;
                    }

                    return undefined;
                }
            },

            // The keys of associative arrays in JS only can be of integer or string kind. The associations that keys are of Integer kind, the items is sorted according the keys (works as HashSet of the Java); the associations that keys are String kind, works as LinkedHashMap, it’s implements a associative array and maintains the order of entrance on iterate.
            // TreeMap implements a structure based red-black tree (binary search).
            asCountableLiteralObject: {
                value: function(collection) {
                    return Iterable.parse(collection);
                }
            },

            indexOf: {
                value: function(object, value) {
                    var
                        key,
                        iterator,
                        properties = $.keys(object);

                    iterator = Iterable.Proxy.new(properties);
                    iterator.each(function(p) {
                        if ($.areEquivalents(object[p], value)) {
                            key = p;
                            this.finalize();
                        }
                    });

                    if (key) {
                        return key;
                    }

                    return undefined;
                }
            },

            count: {
                value: function(object, item) {
                    var
                        count;

                    if (item) {
                        count = $.values(object).count(item);
                    } else {
                        count = $.keys(object).length;
                    }

                    return count;
                }
            },

            some: {
                value: function(object) {
                    return $.count(object) > 0;
                }
            },

            isEmpty: {
                value: function(object) {
                    return !$.some(object);
                }
            },

            delete: {
                value: function(object, index) {
                    if (delete object[index]) {
                        if (object.hasOwnProperty("length")) {
                            object.length -= 1;
                        }

                        return true;
                    }

                    return false;
                }
            },

            reverse: {
                value: function(object) {
                    var
                        newObject = {};

                    $.keys(object).reverse().forEach(function(k) {
                        newObject[k] = object[k];
                    });

                    return newObject;
                }
            },

            attributes: {
                value: function(object, includeNonEnumerable) {
                    if (typeof includeNonEnumerable != "boolean") {
                        includeNonEnumerable = false;
                    }

                    var
                        properties,
                        attributes = [],
                        clone = Object.clone(object, includeNonEnumerable);

                    if (typeof object != "object" &&
                        Object.getPrototypeOf(object)) {
                        clone = Object.getPrototypeOf(object);
                    }

                    properties = $.keys(clone);

                    if (includeNonEnumerable) {
                        properties = $.getOwnPropertyNames(clone);
                    }

                    properties.forEach(function(p) {
                        try {
                            if (typeof object[p] != "function") {
                                attributes.push(p);
                            }
                        } catch(e) {}
                    });

                    return attributes;
                }
            },

            methods: {
                value: function(object, includeNonEnumerable) {
                    if (typeof includeNonEnumerable != "boolean") {
                        includeNonEnumerable = true;
                    }

                    var
                        properties,
                        clone = Object.clone(object, includeNonEnumerable);

                    if (typeof object != "object" &&
                        Object.getPrototypeOf(object)) {
                        clone = Object.getPrototypeOf(object);
                    }

                    properties = $.getOwnPropertyNames(clone);

                    if (!includeNonEnumerable) {
                        properties = $.keys(clone);
                    }

                    return properties.difference($.attributes(object, true));
                }
            },

            hasAttributes: {
                value: function(object, propertyNames) {
                    var
                        argumentsAsArray = Array.from(arguments);

                    propertyNames = argumentsAsArray.slice(1, argumentsAsArray
                                                           .length);

                    return $.attributes(object, true).includes(propertyNames);
                }
            },

            implementsMethods: {
                value: function(object, propertyNames) {
                    var
                        argumentsAsArray = Array.from(arguments);

                    propertyNames = argumentsAsArray.slice(1, argumentsAsArray
                                                           .length);
                    return $.methods(object, true).includes(propertyNames);
                }
            },

            className: {
                value: function(object) {
                    // /[^ ]+(?=\])/g

                    if (typeof object == "object" &&
                        $.implementsMethods(object, "toString")) {
                        // if implements, then calls it
                        // fix here
                        return /[a-zA-Z_]+[^\]]+/g.exec(object.toString())[0]
                        .split(" ")[1];
                    }

                    return /[A-Z_]+[^\]]+/g.exec($.prototype.toString
                                                 .call(object))[0]
                                                 .replace(/ /g, "");
                }
            },

            areEquivalents: {
                value: function(object, comparator) {
                    var
                        attributesCount,
                        objectAttributes,
                        comparatorAttributes,
                        objectMethods,
                        comparatorMethods,
                        objectAttributeValue,
                        comparatorAttributeValue,
                        iterator,
                        count = 0,
                        primitiveTypes =
                            /(number|string|boolean|null|undefined|symbol)/;

                    if (object == comparator) {
                        return true;
                    } else if ($.hasSameClass(object, comparator)) {
                        if (object instanceof $ &&
                            !(object instanceof Function)) {
                            if (object instanceof window.Node) {
                                if (object.isEqualNode(comparator)) {
                                    return true;
                                }
                            } else {
                                objectAttributes = this.attributes(object);
                                comparatorAttributes = this
                                    .attributes(comparator);
                                objectMethods = this.methods(object);
                                comparatorMethods = this.methods(comparator);

                                // if doesn't have attributes
                                if (!objectAttributes.length) {
                                    if (objectMethods.length) {
                                        if (objectMethods.length ==
                                            comparatorMethods.length &&
                                            this.areEquivalents(objectMethods,
                                                comparatorMethods)) {
                                            return true;
                                        }
                                    } else if (objectMethods.length ==
                                               comparatorMethods.length) {
                                        return true;
                                    }
                                }

                                if (objectAttributes.length ==
                                    comparatorAttributes.length) {

                                    iterator = Iterable.Proxy
                                        .new(objectAttributes);

                                    iterator.each(function(attribute) {
                                        objectAttributeValue =
                                            object[attribute];
                                        comparatorAttributeValue =
                                            comparator[attribute];

                                        if (typeof objectAttributeValue ==
                                            "boolean" &&
                                            typeof comparatorAttributeValue ==
                                            "boolean") {
                                            objectAttributeValue =
                                                objectAttributeValue.toString();
                                            comparatorAttributeValue =
                                              comparatorAttributeValue
                                                .toString();
                                        }

                                        if (objectAttributeValue &&
                                            comparatorAttributeValue) {
                                            if ($.hasSameClass(
                                                objectAttributeValue,
                                                comparatorAttributeValue)) {
                                                if (objectAttributeValue instanceof
                                                    $) {

                                                    // recursivity
                                                    if ($.areEquivalents(
                                                        objectAttributeValue,
                                                        comparatorAttributeValue)) {
                                                        count += 1;
                                                    }
                                                } else
                                                    if (objectAttributeValue ==
                                                    comparatorAttributeValue) {
                                                    count += 1;
                                                }
                                            }

                                        } else if (objectAttributeValue ==
                                                   comparatorAttributeValue) {
                                            return true;
                                        }
                                    });

                                    attributesCount = objectAttributes.length;

                                    return count && count == attributesCount;
                                }
                            }

                        } else {
                            if (primitiveTypes.test(typeof object)) {
                                return object == comparator;
                            }
                        }
                    }

                    return false;
                }
            }

        });
    } catch(e) {}

})(Object);
<commit_msg>removes comment<commit_after>//= require ./array

var
    Iterable;

(function($) {
    "use strict";

    try {
        $.defineProperties($, {

            clone: {
                value: function(object, includeNonEnumerable) {
                    if (typeof includeNonEnumerable != "boolean") {
                        includeNonEnumerable = true;
                    }

                    var
                        clone = {},
                        properties = $.getOwnPropertyNames(object);

                    if (!includeNonEnumerable) {
                        return Object.assign(clone, object);
                    }

                    properties.forEach(function(p) {
                        clone[p] = object[p];
                    });

                    return clone;
                }
            },

            classForName: {
                value: function(name) {
                    return window[name];
                }
            },

            hasSameClass: {
                value: function(objects) {
                    var
                        argumentsAsArray = Array.from(arguments),
                        compared = objects,
                        count = 0;

                    argumentsAsArray = argumentsAsArray.slice(1,
                        argumentsAsArray.length);
                    argumentsAsArray.forEach(function(object) {
                        if ($.getPrototypeOf(compared) ==
                            $.getPrototypeOf(object)) {
                            count++;
                        }
                    });

                    return count == argumentsAsArray.length;
                }
            },

            isFromClass: {
                value: function(object, classFunction) {
                    return $.classForName($.className(object)) == classFunction;
                }
            },

            firstKey: {
                value: function(object) {
                    var
                        // Object: javascript literal object
                        keys = Object.keys(object);

                    return keys[0];
                }
            },

            lastKey: {
                value: function(object) {
                    var
                        keys = Object.keys(object);

                    return keys[keys.length - 1];
                }
            },

            normalizedAsLowerCase: {
                value: function(object) {
                    var
                        iterator,
                        attributes = Object.attributes(object),
                        clone = {};

                    Object.assign(clone, object);
                    object.length = attributes.length;
                    iterator = Iterable.Proxy.new(clone);

                    iterator.each(function(v, k) {
                        if (typeof v == "string") {
                            clone[k] = v.toLowerCase();
                        }
                    });

                    return clone;
                }
            },

            firstFromASlice: {
                value: function(object, slice, startingIndex, caseSensitive) {
                    var
                        iterator,
                        key,
                        regexp,
                        attributes = Object.attributes(object);

                    if (!startingIndex || typeof startingIndex != "number") {
                        if (typeof startingIndex == "boolean") {
                            caseSensitive = startingIndex;
                        } else if (!caseSensitive || typeof caseSensitive !=
                                   "boolean") {
                            caseSensitive = false;
                        }

                        startingIndex = 0;
                    }

                    slice = slice.trim();

                    if (!caseSensitive) {
                        regexp = new RegExp(slice, "i");
                    } else {
                        regexp = new RegExp(slice);
                    }

                    iterator = Iterable.Proxy.new(attributes);
                    iterator.each(function(k, i) {
                        if (!isNaN(i)) {
                            if (typeof object[k] == "string" && i
                                >= startingIndex) {
                                if (object[k].search(regexp) != -1) {
                                    key = k;
                                    this.finalize();
                                }
                            }
                        } else if (typeof object[k] == "string") {
                            if (object[k].search(regexp) != -1) {
                                key = k;
                                this.finalize();
                            }
                        }
                    });

                    if (key) {
                        return key;
                    }

                    return undefined;
                }
            },

            // The keys of associative arrays in JS only can be of integer or string kind. The associations that keys are of Integer kind, the items is sorted according the keys (works as HashSet of the Java); the associations that keys are String kind, works as LinkedHashMap, it’s implements a associative array and maintains the order of entrance on iterate.
            // TreeMap implements a structure based red-black tree (binary search).
            asCountableLiteralObject: {
                value: function(collection) {
                    return Iterable.parse(collection);
                }
            },

            indexOf: {
                value: function(object, value) {
                    var
                        key,
                        iterator,
                        properties = $.keys(object);

                    iterator = Iterable.Proxy.new(properties);
                    iterator.each(function(p) {
                        if ($.areEquivalents(object[p], value)) {
                            key = p;
                            this.finalize();
                        }
                    });

                    if (key) {
                        return key;
                    }

                    return undefined;
                }
            },

            count: {
                value: function(object, item) {
                    var
                        count;

                    if (item) {
                        count = $.values(object).count(item);
                    } else {
                        count = $.keys(object).length;
                    }

                    return count;
                }
            },

            some: {
                value: function(object) {
                    return $.count(object) > 0;
                }
            },

            isEmpty: {
                value: function(object) {
                    return !$.some(object);
                }
            },

            delete: {
                value: function(object, index) {
                    if (delete object[index]) {
                        if (object.hasOwnProperty("length")) {
                            object.length -= 1;
                        }

                        return true;
                    }

                    return false;
                }
            },

            reverse: {
                value: function(object) {
                    var
                        newObject = {};

                    $.keys(object).reverse().forEach(function(k) {
                        newObject[k] = object[k];
                    });

                    return newObject;
                }
            },

            attributes: {
                value: function(object, includeNonEnumerable) {
                    if (typeof includeNonEnumerable != "boolean") {
                        includeNonEnumerable = false;
                    }

                    var
                        properties,
                        attributes = [],
                        clone = Object.clone(object, includeNonEnumerable);

                    if (typeof object != "object" &&
                        Object.getPrototypeOf(object)) {
                        clone = Object.getPrototypeOf(object);
                    }

                    properties = $.keys(clone);

                    if (includeNonEnumerable) {
                        properties = $.getOwnPropertyNames(clone);
                    }

                    properties.forEach(function(p) {
                        try {
                            if (typeof object[p] != "function") {
                                attributes.push(p);
                            }
                        } catch(e) {}
                    });

                    return attributes;
                }
            },

            methods: {
                value: function(object, includeNonEnumerable) {
                    if (typeof includeNonEnumerable != "boolean") {
                        includeNonEnumerable = true;
                    }

                    var
                        properties,
                        clone = Object.clone(object, includeNonEnumerable);

                    if (typeof object != "object" &&
                        Object.getPrototypeOf(object)) {
                        clone = Object.getPrototypeOf(object);
                    }

                    properties = $.getOwnPropertyNames(clone);

                    if (!includeNonEnumerable) {
                        properties = $.keys(clone);
                    }

                    return properties.difference($.attributes(object, true));
                }
            },

            hasAttributes: {
                value: function(object, propertyNames) {
                    var
                        argumentsAsArray = Array.from(arguments);

                    propertyNames = argumentsAsArray.slice(1, argumentsAsArray
                                                           .length);

                    return $.attributes(object, true).includes(propertyNames);
                }
            },

            implementsMethods: {
                value: function(object, propertyNames) {
                    var
                        argumentsAsArray = Array.from(arguments);

                    propertyNames = argumentsAsArray.slice(1, argumentsAsArray
                                                           .length);
                    return $.methods(object, true).includes(propertyNames);
                }
            },

            className: {
                value: function(object) {
                    // /[^ ]+(?=\])/g

                    if (typeof object == "object" &&
                        $.implementsMethods(object, "toString")) {
                        // if implements, then calls it
                        return /[a-zA-Z_]+[^\]]+/g.exec(object.toString())[0]
                        .split(" ")[1];
                    }

                    return /[A-Z_]+[^\]]+/g.exec($.prototype.toString
                                                 .call(object))[0]
                                                 .replace(/ /g, "");
                }
            },

            areEquivalents: {
                value: function(object, comparator) {
                    var
                        attributesCount,
                        objectAttributes,
                        comparatorAttributes,
                        objectMethods,
                        comparatorMethods,
                        objectAttributeValue,
                        comparatorAttributeValue,
                        iterator,
                        count = 0,
                        primitiveTypes =
                            /(number|string|boolean|null|undefined|symbol)/;

                    if (object == comparator) {
                        return true;
                    } else if ($.hasSameClass(object, comparator)) {
                        if (object instanceof $ &&
                            !(object instanceof Function)) {
                            if (object instanceof window.Node) {
                                if (object.isEqualNode(comparator)) {
                                    return true;
                                }
                            } else {
                                objectAttributes = this.attributes(object);
                                comparatorAttributes = this
                                    .attributes(comparator);
                                objectMethods = this.methods(object);
                                comparatorMethods = this.methods(comparator);

                                // if doesn't have attributes
                                if (!objectAttributes.length) {
                                    if (objectMethods.length) {
                                        if (objectMethods.length ==
                                            comparatorMethods.length &&
                                            this.areEquivalents(objectMethods,
                                                comparatorMethods)) {
                                            return true;
                                        }
                                    } else if (objectMethods.length ==
                                               comparatorMethods.length) {
                                        return true;
                                    }
                                }

                                if (objectAttributes.length ==
                                    comparatorAttributes.length) {

                                    iterator = Iterable.Proxy
                                        .new(objectAttributes);

                                    iterator.each(function(attribute) {
                                        objectAttributeValue =
                                            object[attribute];
                                        comparatorAttributeValue =
                                            comparator[attribute];

                                        if (typeof objectAttributeValue ==
                                            "boolean" &&
                                            typeof comparatorAttributeValue ==
                                            "boolean") {
                                            objectAttributeValue =
                                                objectAttributeValue.toString();
                                            comparatorAttributeValue =
                                              comparatorAttributeValue
                                                .toString();
                                        }

                                        if (objectAttributeValue &&
                                            comparatorAttributeValue) {
                                            if ($.hasSameClass(
                                                objectAttributeValue,
                                                comparatorAttributeValue)) {
                                                if (objectAttributeValue instanceof
                                                    $) {

                                                    // recursivity
                                                    if ($.areEquivalents(
                                                        objectAttributeValue,
                                                        comparatorAttributeValue)) {
                                                        count += 1;
                                                    }
                                                } else
                                                    if (objectAttributeValue ==
                                                    comparatorAttributeValue) {
                                                    count += 1;
                                                }
                                            }

                                        } else if (objectAttributeValue ==
                                                   comparatorAttributeValue) {
                                            return true;
                                        }
                                    });

                                    attributesCount = objectAttributes.length;

                                    return count && count == attributesCount;
                                }
                            }

                        } else {
                            if (primitiveTypes.test(typeof object)) {
                                return object == comparator;
                            }
                        }
                    }

                    return false;
                }
            }

        });
    } catch(e) {}

})(Object);
<|endoftext|>


<commit_before>import webpack       from 'webpack';
import config        from '../../config';
import webpackConfig from './development';

webpackConfig.entry.app.push(
  `webpack-dev-server/client?${config.get('webpack_public_path')}`,
  `webpack/hot/dev-server`
);

webpackConfig.plugins.push(
  new webpack.HotModuleReplacementPlugin(),
  new webpack.NoErrorsPlugin()
);

// We need to apply the react-transform HMR plugin to the Babel configuration,
// but _only_ when HMR is enabled. Putting this in the default development
// configuration will break other tasks such as test:unit because Webpack
// HMR is not enabled there, and these transforms require it.
webpackConfig.module.loaders = webpackConfig.module.loaders.map(loader => {
  if (/js/.test(loader.test)) {
    loader.query.env.development.extra['react-transform'].transforms.push({
      transform : 'react-transform-hmr',
      imports   : ['react'],
      locals    : ['module']
    });
  }

  return loader;
});

export default webpackConfig;
<commit_msg>Ability to add json-loader<commit_after>import webpack       from 'webpack';
import config        from '../../config';
import webpackConfig from './development';

webpackConfig.entry.app.push(
  `webpack-dev-server/client?${config.get('webpack_public_path')}`,
  `webpack/hot/dev-server`
);

webpackConfig.plugins.push(
  new webpack.HotModuleReplacementPlugin(),
  new webpack.NoErrorsPlugin()
);

// We need to apply the react-transform HMR plugin to the Babel configuration,
// but _only_ when HMR is enabled. Putting this in the default development
// configuration will break other tasks such as test:unit because Webpack
// HMR is not enabled there, and these transforms require it.
webpackConfig.module.loaders = webpackConfig.module.loaders.map(loader => {
  if (/js(?!on)/.test(loader.test)) {
    loader.query.env.development.extra['react-transform'].transforms.push({
      transform : 'react-transform-hmr',
      imports   : ['react'],
      locals    : ['module']
    });
  }

  return loader;
});

export default webpackConfig;
<|endoftext|>


<commit_before>var queue = require('queue-async');
var _ = require('underscore');

var camshaft = require('camshaft');
var dot = require('dot');
dot.templateSettings.strip = false;

function MapConfigAnalysisLayersAdapter(templateMaps) {
    this.templateMaps = templateMaps;
}

module.exports = MapConfigAnalysisLayersAdapter;

var SKIP_COLUMNS = {
    'the_geom': true,
    'the_geom_webmercator': true
};

function skipColumns(columnNames) {
    return columnNames
        .filter(function(columnName) { return !SKIP_COLUMNS[columnName]; });
}

var multitypeStyleTemplate = dot.template([
    "#points['mapnik::geometry_type'=1] {",
    "  marker-fill-opacity: {{=it._opacity}};",
    "  marker-line-color: #FFF;",
    "  marker-line-width: 0.5;",
    "  marker-line-opacity: {{=it._opacity}};",
    "  marker-placement: point;",
    "  marker-type: ellipse;",
    "  marker-width: 4;",
    "  marker-fill: {{=it._color}};",
    "  marker-allow-overlap: true;",
    "}",
    "#lines['mapnik::geometry_type'=2] {",
    "  line-color: {{=it._color}};",
    "  line-width: 2;",
    "  line-opacity: {{=it._opacity}};",
    "}",
    "#polygons['mapnik::geometry_type'=3] {",
    "  polygon-fill: {{=it._color}};",
    "  polygon-opacity: {{=it._opacity}};",
    "  line-color: #FFF;",
    "  line-width: 0.5;",
    "  line-opacity: {{=it._opacity}};",
    "}"
].join('\n'));

function multiTypeStyle(color, opacity) {
    return multitypeStyleTemplate({
        _opacity: opacity || 1.0,
        _color: color || 'red'
    });
}

var layerQueryTemplate = dot.template([
    'SELECT ST_Transform(the_geom, 3857) the_geom_webmercator, {{=it._columns}}',
    'FROM ({{=it._query}}) _cdb_analysis_query'
].join('\n'));

function layerQuery(query, columnNames) {
    return layerQueryTemplate({ _query: query, _columns: skipColumns(columnNames).join(', ') });
}

function getLayer(query, columnNames, color, opacity) {
    return {
        type: 'mapnik',
        options: {
            sql: layerQuery(query, columnNames),
            cartocss: multiTypeStyle(color, opacity),
            cartocss_version: '2.3.0'
        }
    };
}

function getLayerWithStyle(query, columnNames, cartocss) {
    return {
        type: 'mapnik',
        options: {
            sql: layerQuery(query, columnNames),
            cartocss: cartocss,
            cartocss_version: '2.3.0'
        }
    };
}

MapConfigAnalysisLayersAdapter.prototype.getLayers = function(analysisConfiguration, requestMapConfig, callback) {

    if (!Array.isArray(requestMapConfig.layers)) {
        return callback(null, requestMapConfig);
    }

    function adaptLayer(layer, done) {
        if (isAnalysisTypeLayer(layer)) {

            var analysisDefinition = JSON.parse(layer.options.def);

            camshaft.create(analysisConfiguration, analysisDefinition, function(err, analysis) {
                if (err) {
                    return done(err);
                }

                var layers = [];

                analysis.getSortedNodes().reverse().forEach(function(node, i) {
                    var layer = getLayer(node.getQuery(), node.getColumns(), '#333', 0.1 * i);
                    if (!!node.params && !!node.params.cartocss) {
                        layer = getLayerWithStyle(node.getQuery(), node.getColumns(), node.params.cartocss);
                    }
                    layers.push(layer);
                });

                layers.push(getLayerWithStyle(
                    analysis.getQuery(),
                    analysis.getRoot().getColumns(),
                    layer.options.cartocss
                ));

                return done(null, { layers: layers });
            });
        } else {
            return done(null, { layers: [layer] });
        }
    }

    function layersAdaptQueueFinish(err, layersResults) {
        if (err) {
            return callback(err);
        }

        if (!layersResults || layersResults.length === 0) {
            return callback(new Error('Missing layers array from layergroup config'));
        }

        var layers = [];
        layersResults.forEach(function(layersResult) {
            layers = layers.concat(layersResult.layers);
        });

        requestMapConfig.layers = layers;

        return callback(null, requestMapConfig);
    }

    var adaptLayersQueue = queue(requestMapConfig.layers.length);

    if (_.some(requestMapConfig.layers, isAnalysisTypeLayer)) {
        requestMapConfig.layers.forEach(function(layer) {
            adaptLayersQueue.defer(adaptLayer, layer);
        });
        adaptLayersQueue.awaitAll(layersAdaptQueueFinish);
    } else {
        return callback(null, requestMapConfig);
    }
};

function isAnalysisTypeLayer(layer) {
    return layer.type === 'analysis';
}
<commit_msg>Debug option for internal nodes: it allows to display and customize cartocss<commit_after>var queue = require('queue-async');
var _ = require('underscore');

var camshaft = require('camshaft');
var dot = require('dot');
dot.templateSettings.strip = false;

function MapConfigAnalysisLayersAdapter(templateMaps) {
    this.templateMaps = templateMaps;
}

module.exports = MapConfigAnalysisLayersAdapter;

var SKIP_COLUMNS = {
    'the_geom': true,
    'the_geom_webmercator': true
};

function skipColumns(columnNames) {
    return columnNames
        .filter(function(columnName) { return !SKIP_COLUMNS[columnName]; });
}

var multitypeStyleTemplate = dot.template([
    "#points['mapnik::geometry_type'=1] {",
    "  marker-fill-opacity: {{=it._opacity}};",
    "  marker-line-color: #FFF;",
    "  marker-line-width: 0.5;",
    "  marker-line-opacity: {{=it._opacity}};",
    "  marker-placement: point;",
    "  marker-type: ellipse;",
    "  marker-width: 4;",
    "  marker-fill: {{=it._color}};",
    "  marker-allow-overlap: true;",
    "}",
    "#lines['mapnik::geometry_type'=2] {",
    "  line-color: {{=it._color}};",
    "  line-width: 2;",
    "  line-opacity: {{=it._opacity}};",
    "}",
    "#polygons['mapnik::geometry_type'=3] {",
    "  polygon-fill: {{=it._color}};",
    "  polygon-opacity: {{=it._opacity}};",
    "  line-color: #FFF;",
    "  line-width: 0.5;",
    "  line-opacity: {{=it._opacity}};",
    "}"
].join('\n'));

function multiTypeStyle(color, opacity) {
    return multitypeStyleTemplate({
        _opacity: opacity || 1.0,
        _color: color || 'red'
    });
}

var layerQueryTemplate = dot.template([
    'SELECT ST_Transform(the_geom, 3857) the_geom_webmercator, {{=it._columns}}',
    'FROM ({{=it._query}}) _cdb_analysis_query'
].join('\n'));

function layerQuery(query, columnNames) {
    return layerQueryTemplate({ _query: query, _columns: skipColumns(columnNames).join(', ') });
}

function getLayer(query, columnNames, color, opacity) {
    return {
        type: 'mapnik',
        options: {
            sql: layerQuery(query, columnNames),
            cartocss: multiTypeStyle(color, opacity),
            cartocss_version: '2.3.0'
        }
    };
}

function getLayerWithStyle(query, columnNames, cartocss) {
    return {
        type: 'mapnik',
        options: {
            sql: layerQuery(query, columnNames),
            cartocss: cartocss,
            cartocss_version: '2.3.0'
        }
    };
}

MapConfigAnalysisLayersAdapter.prototype.getLayers = function(analysisConfiguration, requestMapConfig, callback) {

    if (!Array.isArray(requestMapConfig.layers)) {
        return callback(null, requestMapConfig);
    }

    function adaptLayer(layer, done) {
        if (isAnalysisTypeLayer(layer)) {

            var analysisDefinition = JSON.parse(layer.options.def);

            camshaft.create(analysisConfiguration, analysisDefinition, function(err, analysis) {
                if (err) {
                    return done(err);
                }

                var layers = [];

                analysis.getSortedNodes().reverse().forEach(function(node, i) {
                    if (node.params && node.params.debug) {
                        var layer = getLayer(node.getQuery(), node.getColumns(), '#333', 0.1 * i);
                        if (!!node.params && !!node.params.cartocss) {
                            layer = getLayerWithStyle(node.getQuery(), node.getColumns(), node.params.cartocss);
                        }
                        layers.push(layer);
                    }
                });

                layers.push(getLayerWithStyle(
                    analysis.getQuery(),
                    analysis.getRoot().getColumns(),
                    layer.options.cartocss
                ));

                return done(null, { layers: layers });
            });
        } else {
            return done(null, { layers: [layer] });
        }
    }

    function layersAdaptQueueFinish(err, layersResults) {
        if (err) {
            return callback(err);
        }

        if (!layersResults || layersResults.length === 0) {
            return callback(new Error('Missing layers array from layergroup config'));
        }

        var layers = [];
        layersResults.forEach(function(layersResult) {
            layers = layers.concat(layersResult.layers);
        });

        requestMapConfig.layers = layers;

        return callback(null, requestMapConfig);
    }

    var adaptLayersQueue = queue(requestMapConfig.layers.length);

    if (_.some(requestMapConfig.layers, isAnalysisTypeLayer)) {
        requestMapConfig.layers.forEach(function(layer) {
            adaptLayersQueue.defer(adaptLayer, layer);
        });
        adaptLayersQueue.awaitAll(layersAdaptQueueFinish);
    } else {
        return callback(null, requestMapConfig);
    }
};

function isAnalysisTypeLayer(layer) {
    return layer.type === 'analysis';
}
<|endoftext|>


<commit_before>/**
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

/*
* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.
*/

// MODULES //

var setReadOnly = require( '@stdlib/utils/define-read-only-property' );

// MAIN //

/**
* Top-level namespace.
*
* @namespace ns
*/
var ns = {};

/**
* @name iterAbs
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/abs}
*/
setReadOnly( ns, 'iterAbs', require( '@stdlib/math/iter/special/abs' ) );

/**
* @name iterAbs2
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/abs2}
*/
setReadOnly( ns, 'iterAbs2', require( '@stdlib/math/iter/special/abs2' ) );

/**
* @name iterAcos
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/acos}
*/
setReadOnly( ns, 'iterAcos', require( '@stdlib/math/iter/special/acos' ) );

/**
* @name iterAcosh
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/acosh}
*/
setReadOnly( ns, 'iterAcosh', require( '@stdlib/math/iter/special/acosh' ) );

/**
* @name iterAcoth
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/acoth}
*/
setReadOnly( ns, 'iterAcoth', require( '@stdlib/math/iter/special/acoth' ) );

/**
* @name iterAdd
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/add}
*/
setReadOnly( ns, 'iterAdd', require( '@stdlib/math/iter/special/add' ) );

/**
* @name iterAsin
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/asin}
*/
setReadOnly( ns, 'iterAsin', require( '@stdlib/math/iter/special/asin' ) );

/**
* @name iterAsinh
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/asinh}
*/
setReadOnly( ns, 'iterAsinh', require( '@stdlib/math/iter/special/asinh' ) );

/**
* @name iterAtan
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/atan}
*/
setReadOnly( ns, 'iterAtan', require( '@stdlib/math/iter/special/atan' ) );

/**
* @name iterAtanh
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/atanh}
*/
setReadOnly( ns, 'iterAtanh', require( '@stdlib/math/iter/special/atanh' ) );

/**
* @name iterCos
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/cos}
*/
setReadOnly( ns, 'iterCos', require( '@stdlib/math/iter/special/cos' ) );

/**
* @name iterDivide
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/divide}
*/
setReadOnly( ns, 'iterDivide', require( '@stdlib/math/iter/special/divide' ) );

/**
* @name iterMod
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/mod}
*/
setReadOnly( ns, 'iterMod', require( '@stdlib/math/iter/special/mod' ) );

/**
* @name iterMultiply
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/multiply}
*/
setReadOnly( ns, 'iterMultiply', require( '@stdlib/math/iter/special/multiply' ) );

/**
* @name iterSin
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/sin}
*/
setReadOnly( ns, 'iterSin', require( '@stdlib/math/iter/special/sin' ) );

/**
* @name iterSubtract
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/subtract}
*/
setReadOnly( ns, 'iterSubtract', require( '@stdlib/math/iter/special/subtract' ) );

// EXPORTS //

module.exports = ns;
<commit_msg>Update namespace<commit_after>/**
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

/*
* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.
*/

// MODULES //

var setReadOnly = require( '@stdlib/utils/define-read-only-property' );

// MAIN //

/**
* Top-level namespace.
*
* @namespace ns
*/
var ns = {};

/**
* @name iterAbs
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/abs}
*/
setReadOnly( ns, 'iterAbs', require( '@stdlib/math/iter/special/abs' ) );

/**
* @name iterAbs2
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/abs2}
*/
setReadOnly( ns, 'iterAbs2', require( '@stdlib/math/iter/special/abs2' ) );

/**
* @name iterAcos
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/acos}
*/
setReadOnly( ns, 'iterAcos', require( '@stdlib/math/iter/special/acos' ) );

/**
* @name iterAcosh
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/acosh}
*/
setReadOnly( ns, 'iterAcosh', require( '@stdlib/math/iter/special/acosh' ) );

/**
* @name iterAcoth
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/acoth}
*/
setReadOnly( ns, 'iterAcoth', require( '@stdlib/math/iter/special/acoth' ) );

/**
* @name iterAdd
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/add}
*/
setReadOnly( ns, 'iterAdd', require( '@stdlib/math/iter/special/add' ) );

/**
* @name iterAsin
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/asin}
*/
setReadOnly( ns, 'iterAsin', require( '@stdlib/math/iter/special/asin' ) );

/**
* @name iterAsinh
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/asinh}
*/
setReadOnly( ns, 'iterAsinh', require( '@stdlib/math/iter/special/asinh' ) );

/**
* @name iterAtan
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/atan}
*/
setReadOnly( ns, 'iterAtan', require( '@stdlib/math/iter/special/atan' ) );

/**
* @name iterAtanh
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/atanh}
*/
setReadOnly( ns, 'iterAtanh', require( '@stdlib/math/iter/special/atanh' ) );

/**
* @name iterCos
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/cos}
*/
setReadOnly( ns, 'iterCos', require( '@stdlib/math/iter/special/cos' ) );

/**
* @name iterCospi
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/cospi}
*/
setReadOnly( ns, 'iterCospi', require( '@stdlib/math/iter/special/cospi' ) );

/**
* @name iterDivide
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/divide}
*/
setReadOnly( ns, 'iterDivide', require( '@stdlib/math/iter/special/divide' ) );

/**
* @name iterMod
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/mod}
*/
setReadOnly( ns, 'iterMod', require( '@stdlib/math/iter/special/mod' ) );

/**
* @name iterMultiply
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/multiply}
*/
setReadOnly( ns, 'iterMultiply', require( '@stdlib/math/iter/special/multiply' ) );

/**
* @name iterSin
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/sin}
*/
setReadOnly( ns, 'iterSin', require( '@stdlib/math/iter/special/sin' ) );

/**
* @name iterSubtract
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/math/iter/special/subtract}
*/
setReadOnly( ns, 'iterSubtract', require( '@stdlib/math/iter/special/subtract' ) );

// EXPORTS //

module.exports = ns;
<|endoftext|>


<commit_before>'use strict';

var isnan = require( './../lib' );

console.log( isnan( NaN ) );
// returns true

console.log( isnan( new Number( NaN ) ) );
// returns true

console.log( isnan( 5 ) );
// returns false

console.log( isnan( '5' ) );
// returns false

console.log( isnan( null ) );
// returns false

console.log( isnan( Symbol( 'NaN' ) ) );
// returns false
<commit_msg>Use utility to detect Symbol support<commit_after>'use strict';

var hasSymbolSupport = require( '@stdlib/utils/detect-symbol-support' )();
var isnan = require( './../lib' );

console.log( isnan( NaN ) );
// returns true

console.log( isnan( new Number( NaN ) ) );
// returns true

console.log( isnan( 5 ) );
// returns false

console.log( isnan( '5' ) );
// returns false

console.log( isnan( null ) );
// returns false

if ( hasSymbolSupport ) {
	console.log( isnan( Symbol( 'NaN' ) ) );
	// returns false
}
<|endoftext|>