code
stringlengths
2
1.05M
version https://git-lfs.github.com/spec/v1 oid sha256:4a7ac474b309c38ff06bfda7c928b8b864f6f8da9b489ab5eb9f5fb44edcb2e7 size 28041
//Author: Sam var parkIds = []; $(document).ready(function() { $('#toMap').on('click', function() { if (typeof map == 'undefined') { initialize(); } }); $('.park').on('click', '.select', function(e) { e.preventDefault(); var parkId = $(this).attr('data-id'); if ($(this).hasClass('btn-success')) { unselectPark(parkId); } else { if (parkIds.length != 2) { $(this).addClass('btn-success'); $(this).text('Selected'); $('#compare-parks-body').append('<button data-park="' + parkId + '" id="compare-park-' + parkId +'" class="btn btn-warning selected-park" aria-label="Right Align">' + $(this).data('name') + '<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>' + '</button>') parkIds.push(parkId); } } handleCompareButton(); }); $('#compare-parks-body').on('click', '.selected-park', function() { var parkId = $(this).data('park'); unselectPark(parkId, this); handleCompareButton(); }); }); function handleCompareButton() { if (parkIds.length == 2) { $('#compare').attr('disabled', false); var url = '../compare?park1=' + parkIds[0] + '&park2=' + parkIds[1]; $('#compare').attr('href', url); } else { $('#compare').attr('disabled', true); } } function unselectPark(parkId) { $('#park-' + parkId).find('.select').removeClass('btn-success').text('compare'); parkIds.splice(parkIds.indexOf(parkId), 1); $('#compare-park-' + parkId).remove(); }
({ ["__proto__"]: 0, ["__proto__"]: 0 });
'use strict'; module.exports = function htmlescape(html) { if (!html) { return ''; } return html.replace(/&/g, '&amp;') .replace(/"/g, '&quot;') .replace(/'/g, '&#039;') .replace(/>/g, '&gt;') .replace(/</g, '&lt;'); };
function Enemy() {} Enemy.prototype = new Actor(); // tick method Enemy.prototype.onTick = function() { if (this.dead) { if (this.currentFrame == this.deadFrame) game.enemies.removeChild(this); return; } if (this.top() > game.canvas.height) this.die(); this.move(); return this; }; // take damage when hit Enemy.prototype.takeDamage = function() { this.health--; game.playSound('hit'); if(this.health < 1) { this.die(); game.score += this.points.kill; } else { this.gotoAndPlay(this.health_animations[this.health]); game.score += this.points.hit; } }; // die method Enemy.prototype.die = function() { game.playSound('explosion'); this.gotoAndPlay('dead'); this.dead = true; };
module.exports = function (NodeTeaparty) { NodeTeaparty.Status = function(widgetKey) { var UP = 'up', DOWN = 'down'; this.send = function(status, callback) { if (typeof status === 'undefined') status = DOWN; else if (typeof status !== 'string') status = !!status ? UP : DOWN; else status = status.toLowerCase() === UP ? UP : DOWN; NodeTeaparty.send(widgetKey, {status: status}, callback); } }; };
/** * @private * @param {Node} node Node. * @param {Array.<*>} objectStack Object stack. * @return {ol.Extent|undefined} Bounding box object. */ ol.format.WMSCapabilities.readLatLonBoundingBox_ = function (node, objectStack) { goog.asserts.assert(node.nodeType == Node.ELEMENT_NODE, 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'LatLonBoundingBox', 'localName should be LatLonBoundingBox'); return [ ol.format.XSD.readDecimalString(node.getAttribute('minx')), ol.format.XSD.readDecimalString(node.getAttribute('miny')), ol.format.XSD.readDecimalString(node.getAttribute('maxx')), ol.format.XSD.readDecimalString(node.getAttribute('maxy')) ]; }; for(var a in ol.xml.makeStructureNS( ol.format.WMSCapabilities.NAMESPACE_URIS_, { 'SRS': ol.xml.makeObjectPropertyPusher(ol.format.XSD.readString), 'LatLonBoundingBox': ol.xml.makeObjectPropertySetter( ol.format.WMSCapabilities.readLatLonBoundingBox_), })){ goog.object.extend(ol.format.WMSCapabilities.LAYER_PARSERS_[a],{ 'SRS': ol.xml.makeObjectPropertyPusher(ol.format.XSD.readString), 'LatLonBoundingBox': ol.xml.makeObjectPropertySetter( ol.format.WMSCapabilities.readLatLonBoundingBox_), }) }
'use strict' const { STATES, timeout, default: Channel } = require('../src/channel') const { List, FixedQueue, DroppingBuffer, SlidingBuffer, } = require('../src/data-structures') const { assert } = require('chai') const log = console.log.bind(console) // eslint-disable-line describe('Channel', function() { this.timeout(100) describe('constructor', () => { it('should initialize properly', async () => { const ch = new Channel() assert.isOk(ch.empty()) assert.instanceOf(ch, Channel) assert.deepEqual(ch.state, STATES.OPEN) assert.isOk(ch.puts) assert.instanceOf(ch.puts, List) assert.isOk(ch.puts.empty()) assert.isOk(ch.takes) assert.instanceOf(ch.takes, List) assert.isOk(ch.takes.empty()) assert.isOk(ch.pipeline) assert.strictEqual(ch.pipeline.length, 0) assert.instanceOf(ch.pipeline, Array) assert.isOk(ch.waiting) assert.strictEqual(ch.waiting.length, 0) assert.instanceOf(ch.waiting, Array) }) it('should initialize with a buffer size', async () => { const ch = new Channel(92) assert.isOk(ch.empty()) assert.isOk(ch.buf) assert.instanceOf(ch.buf, FixedQueue) assert.isOk(ch.buf.empty()) assert.deepEqual(ch.buf.size, 92) }) it('should initialize with a transform', async () => { const fn = x => x ** 2 const ch = new Channel(fn) assert.deepEqual(ch.transform, fn) }) it('should initialize with a buffer size and a transform', async () => { const fn = x => ({ x }) const size = 3 const ch = new Channel(size, fn) assert.isOk(ch.buf) assert.isOk(ch.buf.empty()) assert.isNotOk(ch.buf.full()) assert.deepEqual(ch.buf.size, size) assert.deepEqual(ch.transform, fn) }) it('should accept data structures as first parameter', async () => { const size = 8 const buf = new FixedQueue(size) const ch = new Channel(buf) assert.isOk(ch.buf) assert.isOk(ch.buf.empty()) assert.isNotOk(ch.buf.full()) assert.deepEqual(ch.buf.size, size) }) }) describe('.from()', () => { it('can initialize a channel from an array', async () => { const arr = [1, 2, 3, 4, 5] const ch = Channel.from(arr) assert.deepEqual(arr.length, ch.buf.length) for (const val of arr) assert.deepEqual(await ch.take(), val) assert.isOk(ch.empty()) await ch.done() assert.deepEqual(ch.state, STATES.ENDED) }) it('can initialize a channel from a generator', async () => { const gen = function*() { yield 1 yield 2 yield 3 } const ch = Channel.from(gen()) assert.deepEqual(ch.buf.length, 3) let val = null let i = 1 while ((val = await ch.take()) !== Channel.DONE) assert.deepEqual(val, i++) }) it('can initialize a channel from any iterable', async () => { const obj = { *[Symbol.iterator]() { yield 4 yield 5 yield 6 }, } const ch = Channel.from(obj) assert.deepEqual(ch.buf.length, 3) let val = null let i = 4 while ((val = await ch.take()) !== Channel.DONE) assert.deepEqual(val, i++) }) it('should initialize the channel as closed', async () => { const ch = Channel.from([1, 2, 3]) assert.deepEqual(ch.state, STATES.CLOSED) }) it('can leave the channel open by flag', async () => { const ch = Channel.from([1, 2, 3], true) assert.deepEqual(ch.state, STATES.OPEN) }) }) describe('#size', () => { it('should be undefined when no buffer is used', () => { const ch = new Channel() assert.deepEqual(ch.size, undefined) }) it('should be the size of the buffer when a buffer is used', () => { const ch = new Channel(96) assert.deepEqual(ch.size, 96) }) }) describe('#length', () => { it('should equal puts length', async () => { const ch = new Channel() assert.deepEqual(ch.length, 0) assert.deepEqual(ch.length, ch.puts.length) ch.put(1) assert.deepEqual(ch.length, 1) assert.deepEqual(ch.length, ch.puts.length) ch.put(2) assert.deepEqual(ch.length, 2) assert.deepEqual(ch.length, ch.puts.length) await ch.take() assert.deepEqual(ch.length, 1) assert.deepEqual(ch.length, ch.puts.length) }) it('should equal puts length plus buffer length', async () => { const ch = new Channel(2) assert.deepEqual(ch.length, 0) assert.deepEqual(ch.buf.length, 0) assert.deepEqual(ch.puts.length, 0) await ch.put(1) assert.deepEqual(ch.length, 1) assert.deepEqual(ch.buf.length, 1) assert.deepEqual(ch.puts.length, 0) await ch.put(2) assert.deepEqual(ch.length, 2) assert.deepEqual(ch.buf.length, 2) assert.deepEqual(ch.puts.length, 0) ch.put(3) assert.deepEqual(ch.length, 3) assert.deepEqual(ch.buf.length, 2) assert.deepEqual(ch.puts.length, 1) }) }) describe('#empty()', () => { it('should be true when puts queue is empty', async () => { const ch = new Channel() assert.isOk(ch.puts.empty()) assert.isOk(ch.empty()) }) it('should be true when buffer and puts queue are empty', async () => { const ch = new Channel(1) assert.isOk(ch.puts.empty()) assert.isOk(ch.buf.empty()) assert.isOk(ch.empty()) }) it('should be false when puts queue is non empty', async () => { const ch = new Channel() ch.put(1) assert.isNotOk(ch.puts.empty()) assert.isNotOk(ch.empty()) }) it('should be false when buffer is non empty', async () => { const ch = Channel.from([1, 2, 3]) assert.isOk(ch.puts.empty()) assert.isNotOk(ch.buf.empty()) assert.isNotOk(ch.empty()) }) it('should be true even if takes queue is non empty', async () => { const ch = new Channel() ch.take() assert.isOk(ch.puts.empty()) assert.isNotOk(ch.takes.empty()) assert.isOk(ch.empty()) }) it('can be empty when open', async () => { const ch = new Channel() assert.deepEqual(ch.state, STATES.OPEN) assert.isOk(ch.empty()) }) it('can be non-empty when open', async () => { const ch = new Channel() ch.put(1) assert.deepEqual(ch.state, STATES.OPEN) assert.isNotOk(ch.empty()) }) it('can be non-empty when closed', async () => { const ch = new Channel(1) ch.put(1) ch.close() assert.deepEqual(ch.state, STATES.CLOSED) assert.isNotOk(ch.empty()) }) it('should be empty when ended', async () => { const ch = new Channel() ch.put(1) ch.close() await ch.take() await ch.done() assert.deepEqual(ch.state, STATES.ENDED) assert.isOk(ch.empty()) }) }) describe('#put()', () => { it('should return a promise', async () => { const ch = new Channel() const put = ch.put(1) assert.instanceOf(put, Promise) }) it('should put a value', async () => { const ch = new Channel() assert.isOk(ch.empty()) ch.put(1) assert.isNotOk(ch.empty()) assert.isNotOk(ch.puts.empty()) }) it('should put values in order', async () => { const ch = new Channel() for (const val of [1, 2, 3, 4, 5]) ch.put(val) assert.deepEqual(await ch.take(), 1) assert.deepEqual(await ch.take(), 2) assert.deepEqual(await ch.take(), 3) assert.deepEqual(await ch.take(), 4) assert.deepEqual(await ch.take(), 5) }) it('should queue puts when buffer is full', async () => { const ch = new Channel(1) await ch.put(1) ch.put(2) assert.isNotOk(ch.empty()) assert.isOk(ch.buf.full()) assert.isNotOk(ch.puts.empty()) assert.deepEqual(ch.puts.length, 1) }) it('should resolve puts when buffer becomes not full', async () => { const ch = new Channel(1) await ch.put(1) const put = ch.put(2) assert.isOk(ch.buf.full()) assert.isNotOk(ch.puts.empty()) await ch.take() await put assert.isOk(ch.puts.empty()) assert.isOk(ch.buf.full()) }) }) describe('#take()', () => { it('should return a promise', async () => { const ch = new Channel() const take = ch.take() assert.instanceOf(take, Promise) }) it('should take values', async () => { const ch = new Channel() ch.put(1) assert.deepEqual(await ch.take(), 1) assert.isOk(ch.empty()) assert.isOk(ch.takes.empty()) }) it('should take values in order', async () => { const ch = new Channel() let counter = 0 for (let i = 0; i < 10; i++) ch.put((counter += Math.random())) const arr = [] for (let i = 0; i < 10; i++) arr.push(await ch.take()) for (let i = 0; i < arr.length - 1; i++) assert.isOk(arr[i] <= arr[i + 1]) }) it('should queue takes when buffer is empty', async () => { const ch = new Channel() assert.isOk(ch.takes.empty()) ch.take() assert.isNotOk(ch.takes.empty()) }) it('should resolve takes when buffer becomes non empty', async () => { const ch = new Channel() assert.isOk(ch.takes.empty()) const take = ch.take() assert.isNotOk(ch.takes.empty()) ch.put(1) assert.deepEqual(await take, 1) }) it('should execute any available transform', async () => { const ch = new Channel(x => x ** 2) for (const val of [1, 2, 3, 4, 5]) ch.put(val) assert.deepEqual(await ch.take(), 1) assert.deepEqual(await ch.take(), 4) assert.deepEqual(await ch.take(), 9) assert.deepEqual(await ch.take(), 16) assert.deepEqual(await ch.take(), 25) }) }) describe('#tail()', () => { // revisit later, less important it('should return a promise', () => { const ch = new Channel() const tail = ch.tail() assert.instanceOf(tail, Promise) }) it('should append values to the end of the channel', async () => { const ch = new Channel() ch.tail(4) ch.put(1) ch.tail(5) ch.put(2) ch.put(3) ch.close() for (let i = 0; i < 5; i++) assert.deepEqual(await ch.take(), i + 1) }) it('should keep state at closed until tail is emptied', async () => { const ch = new Channel() ch.tail(1) ch.close() assert.deepEqual(ch.state, STATES.CLOSED) await ch.take() await ch.done() assert.deepEqual(ch.state, STATES.ENDED) }) it('should use transforms', async () => { const ch = new Channel(async x => x + 2) ch.tail(1) ch.tail(2) ch.tail(3) ch.close() for (let i = 0; i < ch.tail.length; i++) assert.deepEqual(await ch.take(), i + 3) }) it('should flush the channel once all values are taken', async () => { const ch = new Channel() ch.tail(1) ch.tail(2) const take1 = ch.take() const take2 = ch.take() const take3 = ch.take() ch.close() await ch.done() const [val1, val2, val3] = await Promise.all([take1, take2, take3]) assert.deepEqual(ch.state, STATES.ENDED) assert.deepEqual(val1, 1) assert.deepEqual(val2, 2) assert.deepEqual(val3, Channel.DONE) }) }) describe('#close()', () => { it('should close a non-empty channel', async () => { const ch = new Channel() ch.put(1) assert.deepEqual(ch.state, STATES.OPEN) ch.close() assert.deepEqual(ch.state, STATES.CLOSED) }) it('should end an empty channel', async () => { const ch = new Channel() assert.deepEqual(ch.state, STATES.OPEN) ch.close() await ch.done() assert.deepEqual(ch.state, STATES.ENDED) }) it('should swap from closed to ended on closed channel emptied', async () => { const ch = new Channel() assert.deepEqual(ch.state, STATES.OPEN) ch.put(1) assert.deepEqual(ch.state, STATES.OPEN) ch.close() assert.deepEqual(ch.state, STATES.CLOSED) await ch.take() await ch.done() assert.deepEqual(ch.state, STATES.ENDED) }) }) describe('#done()', () => { it('should return a promise', async () => { const ch = new Channel() const d = ch.done() assert.instanceOf(d, Promise) }) it('should resolve when the channel is ended', async () => { const ch = new Channel() const d = ch.done() assert.deepEqual(ch.state, STATES.OPEN) ch.close() await d assert.deepEqual(ch.state, STATES.ENDED) }) it('should resolve all promises when the channel is ended', async () => { const ch = new Channel() const [d1, d2, d3] = [ch.done(), ch.done(), ch.done()] assert.deepEqual(ch.state, STATES.OPEN) ch.close() await Promise.all([d1, d2, d3]) assert.deepEqual(ch.state, STATES.ENDED) }) }) describe('#pipe()', () => { it('should pipe values from one channel to another channel', async () => { const ch1 = new Channel() const ch2 = new Channel() ch1.pipe(ch2) await ch1.put(1) assert.deepEqual(await ch2.take(), 1) assert.deepEqual(ch1.pipeline, [ch2]) assert.strictEqual(ch2.pipeline.length, 0) assert.isOk(ch1.empty()) assert.isOk(ch2.empty()) }) it('should pipe values through multiple chained pipes', async () => { const ch1 = new Channel() const ch2 = new Channel() const ch3 = new Channel() ch1.pipe(ch2).pipe(ch3) ch1.put(1) ch1.put(2) const take1 = await ch3.take() const take2 = await ch3.take() assert.deepEqual(take1, 1) assert.deepEqual(take2, 2) assert.isOk(ch1.empty()) assert.isOk(ch2.empty()) assert.isOk(ch3.empty()) }) it('can pipe from one channel split to multiple channels', async () => { const ch1 = new Channel() const ch2 = new Channel() const ch3 = new Channel() ch1.pipe(ch2, ch3) ch1.put(1) ch1.put(2) const take1From2 = await ch2.take() assert.deepEqual(1, take1From2) const take1From3 = await ch3.take() assert.deepEqual(1, take1From3) const take2From2 = await ch2.take() assert.deepEqual(2, take2From2) const take2From3 = await ch3.take() assert.deepEqual(2, take2From3) assert.isOk(ch1.empty()) assert.isOk(ch2.empty()) assert.isOk(ch3.empty()) }) it('should return a reference to the last channel in the pipe', async () => { const ch1 = new Channel() const ch2 = new Channel() const ref = ch1.pipe(ch2) assert.deepEqual(ref, ch2) }) it('should execute any available transforms in the pipeline', async () => { const ch1 = new Channel(8, x => x + 2) const ch2 = new Channel(8, x => ({ x })) const ch3 = new Channel(8, x => ({ y: x.x })) ch1.pipe(ch2).pipe(ch3) for (let i = 0; i < 5; i++) ch1.put(i) for (let i = 0; i < 5; i++) assert.deepEqual(await ch3.take(), { y: i + 2 }) }) it('should accept transforms and turn them into channels', async () => { const ch1 = new Channel(x => x + 2) const ch3 = ch1.pipe(x => ({ x })).pipe(x => ({ y: x.x })) for (let i = 0; i < 5; i++) ch1.put(i) for (let i = 0; i < 5; i++) assert.deepEqual(await ch3.take(), { y: i + 2 }) }) it('should be able to put values onto any channel in the pipeline', async () => { const ch1 = new Channel() const ch2 = new Channel() const ch3 = new Channel() ch1.pipe(ch2).pipe(ch3) await ch2.put(2) assert.deepEqual(await ch3.take(), 2) ch3.put(3) assert.deepEqual(await ch3.take(), 3) assert.isOk(ch1.empty()) assert.isOk(ch2.empty()) assert.isOk(ch3.empty()) }) it('should pipe values which were already buffered', async () => { const ch1 = new Channel(4) const ch2 = new Channel(4) for (let i = 0; i < 4; i++) await ch1.put(i) ch1.pipe(ch2) for (let i = 0; i < 4; i++) assert.deepEqual(await ch2.take(), i) }) it('should block pipes when backed up', async () => { const ch1 = new Channel(2) const ch2 = new Channel(2) const ch3 = new Channel(4) ch1.pipe(ch2, ch3) await ch1.put(1) await ch1.put(2) ch1.put(3) ch1.put(4) // give the pipe time to transfer values from ch1 to ch2 and ch3 await timeout() // ch1 should not be empty already, but the 3rd value will be taken off the buffer // and will be hanging out in a hidden context waiting to be resolved on all pipes // the 4th value should remain on the buffer until the pipe is unblocked assert.isNotOk(ch1.empty()) assert.deepEqual(ch1.buf.length, 1) assert.strictEqual(ch1.puts.length, 0) assert.strictEqual(ch1.takes.length, 0) // the 3rd value will not be placed on the 2nd channel, since the max size of ch2 is 2 assert.isNotOk(ch2.empty()) assert.deepEqual(ch2.buf.length, 2) assert.deepEqual(ch2.puts.length, 1) assert.strictEqual(ch2.takes.length, 0) // the 3rd value will be placed on the 3rd channel, since the max size of ch3 is 4 assert.isNotOk(ch3.empty()) assert.deepEqual(ch3.buf.length, 3) assert.strictEqual(ch3.puts.length, 0) assert.strictEqual(ch3.takes.length, 0) let take3 = await ch3.take() // ch1 should be unchanged, since the pipe is still blocked assert.isNotOk(ch1.empty()) assert.deepEqual(ch1.buf.length, 1) assert.strictEqual(ch1.puts.length, 0) assert.strictEqual(ch1.takes.length, 0) // ch2 should be unchanged, still blocking the pipe assert.isNotOk(ch2.empty()) assert.deepEqual(ch2.buf.length, 2) assert.deepEqual(ch2.puts.length, 1) assert.strictEqual(ch2.takes.length, 0) // ch3 should have a value removed from its buffer assert.isNotOk(ch3.empty()) assert.deepEqual(ch3.buf.length, 2) assert.strictEqual(ch3.puts.length, 0) assert.strictEqual(ch3.takes.length, 0) assert.deepEqual(take3, 1) let take2 = await ch2.take() await timeout() // to ensure the next value is fully pulled from the ch1 before we continue, now that takes will resolve interleaved with async puts // ch1 should have had its last value taken assert.isOk(ch1.empty()) assert.strictEqual(ch1.buf.length, 0) assert.strictEqual(ch1.puts.length, 0) assert.strictEqual(ch1.takes.length, 0) // ch2 should have unblocked space for 1 value, then reblocked ch1 from putting again assert.isNotOk(ch2.empty()) assert.deepEqual(take2, 1) assert.deepEqual(ch2.buf.length, 2) assert.deepEqual(ch2.puts.length, 1) assert.strictEqual(ch2.takes.length, 0) // ch3 should have the next value from ch1 placed on its buffer assert.isNotOk(ch3.empty()) assert.deepEqual(ch3.buf.length, 3) assert.strictEqual(ch3.puts.length, 0) assert.strictEqual(ch3.takes.length, 0) ;[take2, take3] = await Promise.all([ch2.take(), ch3.take()]) await timeout() // same as above. ensure that the async put has time to place values from ch1 onto ch2 and ch3 after the takes are successful // ch2 should have accepted the last value from ch1 assert.deepEqual(take2, 2) assert.isNotOk(ch2.empty()) assert.deepEqual(ch2.buf.length, 2) assert.strictEqual(ch2.puts.length, 0) assert.strictEqual(ch2.takes.length, 0) // ch3 should have another value taken assert.deepEqual(take3, 2) assert.isNotOk(ch3.empty()) assert.deepEqual(ch3.buf.length, 2) assert.strictEqual(ch3.puts.length, 0) assert.strictEqual(ch3.takes.length, 0) }) it('should be able to close single channels', async () => { const ch1 = new Channel(4) const ch2 = new Channel(4) for (let i = 0; i < 4; i++) await ch1.put(i) ch1.close() ch1.pipe(ch2) await ch1.done() assert.deepEqual(ch1.state, STATES.ENDED) assert.deepEqual(ch2.state, STATES.OPEN) }) it('should be able to close the entire pipeline by flag', async () => { const ch1 = new Channel() const ch2 = new Channel() const ch3 = new Channel() const ch4 = new Channel() ch1 .pipe(ch2) .pipe(ch3) .pipe(ch4) for (let i = 0; i < 8; i++) { ch1.put(i) // if we await this and the cap is >= 4, then we freeze? wtf? } ch1.close(true) for (let i = 0; i < 8; i++) assert.deepEqual(await ch4.take(), i) await ch4.done() assert.deepEqual(ch1.state, STATES.ENDED) assert.deepEqual(ch2.state, STATES.ENDED) assert.deepEqual(ch3.state, STATES.ENDED) assert.deepEqual(ch4.state, STATES.ENDED) }) }) describe('.pipeline()', () => { it('should create a pipeline from an iterable of callbacks', async () => { const [ch1, ch3] = Channel.pipeline(x => x + 2, x => x ** 2, x => x / 2) assert.deepEqual(ch1.pipeline.length, 1) // since ch1 -> ch2 only const ch2 = ch1.pipeline[0] assert.deepEqual(ch2.pipeline.length, 1) assert.deepEqual(ch2.pipeline[0], ch3) ch1.put(1) ch1.put(2) ch1.put(3) ch1.close(true) assert.deepEqual(await ch3.take(), 4.5) assert.deepEqual(await ch3.take(), 8) assert.deepEqual(await ch3.take(), 12.5) await ch1.done() await ch2.done() await ch3.done() assert.deepEqual(ch1.state, STATES.ENDED) assert.deepEqual(ch2.state, STATES.ENDED) assert.deepEqual(ch3.state, STATES.ENDED) }) it('should accept a mix of channels and callbacks', async () => { const [ch1, ch3] = Channel.pipeline( x => x + 2, new Channel(x => x ** 2), x => x / 2, ) assert.deepEqual(ch1.pipeline.length, 1) // since ch1 -> ch2 only const ch2 = ch1.pipeline[0] assert.deepEqual(ch2.pipeline.length, 1) assert.deepEqual(ch2.pipeline[0], ch3) ch1.put(1) ch1.put(2) ch1.put(3) ch1.close(true) assert.deepEqual(await ch3.take(), 4.5) assert.deepEqual(await ch3.take(), 8) assert.deepEqual(await ch3.take(), 12.5) await ch1.done() await ch2.done() await ch3.done() assert.deepEqual(ch1.state, STATES.ENDED) assert.deepEqual(ch2.state, STATES.ENDED) assert.deepEqual(ch3.state, STATES.ENDED) }) }) describe('#unpipe()', () => { it('should remove a channel from a pipeline', async () => { const ch1 = new Channel(2) const ch2 = new Channel(2) ch1.pipe(ch2) assert.deepEqual(ch1.pipeline, [ch2]) ch1.unpipe(ch2) assert.deepEqual(ch1.pipeline, []) }) it('should return a reference to an existing channel', async () => { const ch1 = new Channel() const ch2 = new Channel() ch1.pipe(ch2) const unpiped = ch1.unpipe(ch2) assert.deepEqual(ch1, unpiped) }) it('should stop the automated flow of data', async () => { const ch1 = new Channel(2) const ch2 = ch1.pipe(new Channel(2)) await ch1.put(1) await ch1.put(2) ch1.put(3) ch1.put(4) await timeout() ch1.unpipe(ch2) assert.deepEqual(await ch2.take(), 1) assert.deepEqual(await ch2.take(), 2) assert.isNotOk(ch2.empty()) // note this - since 3 is already queued up in ch2.puts, // it will STILL be received inside channel 2 // is this intended behavior? unexpected? bug to be fixed? // as of right now, i feel this is intended and OK. assert.deepEqual(await ch2.take(), 3) assert.isOk(ch2.empty()) assert.strictEqual(ch2.takes.length, 0) assert.isNotOk(ch1.empty()) assert.deepEqual(await ch1.take(), 4) assert.isOk(ch1.empty()) assert.strictEqual(ch1.takes.length, 0) }) it('should keep child pipes intact', async () => { const ch1 = new Channel(2) const ch2 = new Channel(2) const ch3 = new Channel(2) ch1.pipe(ch2).pipe(ch3) assert.deepEqual(ch1.pipeline, [ch2]) assert.deepEqual(ch2.pipeline, [ch3]) await ch1.put(1) await ch1.put(2) assert.deepEqual(await ch3.take(), 1) assert.deepEqual(await ch3.take(), 2) ch1.unpipe(ch2) assert.deepEqual(ch1.pipeline, []) assert.deepEqual(ch2.pipeline, [ch3]) await ch2.put(3) await ch2.put(4) assert.deepEqual(await ch3.take(), 3) assert.deepEqual(await ch3.take(), 4) }) it('should keep sibling pipes intact', async () => { const ch1 = new Channel(4) const ch2 = new Channel(2) const ch3 = new Channel(2) ch1.pipe(ch2, ch3) assert.deepEqual(ch1.pipeline, [ch2, ch3]) await ch1.put(1) await ch1.put(2) await timeout() // make sure the puts are through before unpipe ch1.unpipe(ch2) assert.deepEqual(ch1.pipeline, [ch3]) await ch1.put(3) await ch1.put(4) assert.deepEqual(await ch2.take(), 1) assert.deepEqual(await ch2.take(), 2) assert.isOk(ch2.empty()) assert.strictEqual(ch2.takes.length, 0) assert.deepEqual(await ch3.take(), 1) assert.deepEqual(await ch3.take(), 2) assert.deepEqual(await ch3.take(), 3) assert.deepEqual(await ch3.take(), 4) assert.isOk(ch3.empty()) assert.strictEqual(ch3.takes.length, 0) assert.isOk(ch1.empty()) assert.deepEqual(ch1.takes.length, 1) // ch3 should still have a take registered with c1 }) }) describe('#merge()', () => { it('should put values from multiple channels onto a new channel', async () => { const ch1 = new Channel() const ch2 = new Channel() const ch3 = ch1.merge(ch2) // or Channel.merge(ch1, ch2) await ch1.put(1) await ch2.put(2) assert.deepEqual(await ch3.take(), 1) assert.deepEqual(await ch3.take(), 2) }) }) describe('#produce()', () => { it('should automatically produce values when space is available', async () => { const ch = new Channel() let counter = 0 ch.produce(() => counter++) for (let i = 0; i < 10; i++) assert.deepEqual(await ch.take(), i) ch.close() await ch.done() }) it('can produce values synchronously', async () => { const ch = new Channel() ch.produce(Math.random) for (let i = 0; i < 10; i++) { const val = await ch.take() assert.isOk(val >= 0 && val < 1) } ch.close() await ch.done() }) it('can produce values asynchronously', async () => { const ch = new Channel() let counter = 0 ch.produce(async () => { await timeout() return counter++ }) for (let i = 0; i < 10; i++) assert.deepEqual(await ch.take(), i) ch.close() await ch.done() }) }) describe('#consume()', () => { it('can consume values synchronously', async () => { const ch = new Channel() let counter = 0 ch.consume(x => { counter += x }) await ch.put(1) await ch.put(2) await ch.put(3) await ch.put(4) await ch.put(5) ch.close() await ch.done() assert.deepEqual(counter, 15) }) it('can consume values asynchronously', async () => { const ch = new Channel(async x => x) let counter = 0 ch.consume(async x => { await timeout() counter += x }) await ch.put(1) await ch.put(2) await ch.put(3) await ch.put(4) await ch.put(5) ch.close() await ch.done() assert.deepEqual(counter, 15) }) it('should consume all values even if put without waiting', async () => { const ch = new Channel(async x => { await timeout() return x }) const arr = [] ch.consume(x => { arr.push(x) }) ch.put(1) ch.put(2) ch.put(3) ch.put(4) ch.put(5) ch.put(6) ch.put(7) ch.put(8) ch.close() await ch.done() assert.deepEqual(arr, [1, 2, 3, 4, 5, 6, 7, 8]) }) }) describe('transform', () => { it('should transform values', async () => { const ch = new Channel(x => x ** 2) for (let i = 1; i <= 4; i++) ch.put(i) for (let i = 0; i < 4; i++) assert.deepEqual(await ch.take(), (i + 1) ** 2) }) it('should drop undefined values', async () => { const ch = new Channel(x => { if (x > 2) return x }) ch.put(1) ch.put(2) ch.put(3) ch.put(4) assert.deepEqual(await ch.take(), 3) assert.deepEqual(await ch.take(), 4) assert.strictEqual(ch.length, 0) }) it('should transform values by callback', async () => { const ch = new Channel((x, push) => { if (x > 2) push(x) }) ch.put(1) ch.put(2) ch.put(3) ch.put(4) assert.deepEqual(await ch.take(), 3) assert.deepEqual(await ch.take(), 4) assert.strictEqual(ch.length, 0) }) it('should expand values by multiple callback executions', async () => { const ch = new Channel((x, push) => { if (x > 2) { push(x) push(x) } }) ch.put(1) ch.put(2) ch.put(3) ch.put(4) assert.deepEqual(await ch.take(), 3) assert.deepEqual(await ch.take(), 3) assert.deepEqual(await ch.take(), 4) assert.deepEqual(await ch.take(), 4) assert.strictEqual(ch.length, 0) }) it('should maintain order with multiple callback transforms', async () => { const ch = new Channel(8, (x, push) => { if (x < 3) { push(x) push(x * 2) push(x * 3) } else push(x) }) const arr = [] ch.consume(async x => { arr.push(x) }) await ch.put(1) await ch.put(2) await ch.put(3) await ch.put(4) await ch.put(5) await ch.put(6) ch.close() await ch.done() assert.deepEqual(arr, [1, 2, 3, 2, 4, 6, 3, 4, 5, 6]) }) it('should transform values asynchronously when promise is returned', async () => { const ch = new Channel(async (val, push) => { await timeout(5) push(val) await timeout(5) push(val + 2) }) const arr = [] ch.consume(x => arr.push(x)) await ch.put(1) await ch.put(2) ch.close() await ch.done() assert.deepEqual(arr, [1, 3, 2, 4]) }) it('should transform values asynchronously when 3 parameters are used', async () => { const ch = new Channel((val, push, done) => { setTimeout(() => { push(val) setTimeout(() => { push(val + 2) done() }, 5) }, 5) }) const arr = [] ch.consume(x => arr.push(x)) await ch.put(1) await ch.put(2) ch.close() await ch.done() assert.deepEqual(arr, [1, 3, 2, 4]) }) }) describe('general use', () => { it('should not block indefinitely with synchronous produce + consume', async () => { const ch = new Channel() ch.produce(Math.random) ch.consume(x => x ** 2) await timeout(50) // let it spin for a while ch.close() // close, and continue spinning until empty await ch.done() assert.isOk(ch.empty()) assert.deepEqual(ch.state, STATES.ENDED) }) it('should work with DroppingBuffer', async () => { const buf = new DroppingBuffer() const transformer = (x, push) => { push(x) push(x + 1) } const ch = new Channel(buf, transformer) const values = [1, 2, 3, 4, 5] for (const val of values) await ch.put(val) // note that we aren't blocked, even while awaiting. assert.deepEqual(buf.full(), false) await timeout(10) const val = await ch.take() assert.deepEqual(val, 1) assert.deepEqual(buf.full(), false) }) it('should work with a SlidingBuffer', async () => { const buf1 = new SlidingBuffer(1) const ch1 = new Channel(buf1) const vals = [1, 2, 3, 4] for (const val of vals) await ch1.put(val) assert.deepEqual(await ch1.take(), 4) const buf2 = new SlidingBuffer(2) const ch2 = new Channel(buf2) await ch2.put(1) await ch2.put(2) await ch2.put(3) await ch2.put(4) assert.deepEqual(await ch2.take(), 3) await ch2.put(5) assert.deepEqual(await ch2.take(), 4) assert.deepEqual(await ch2.take(), 5) await ch2.put(6) await ch2.put(7) await ch2.put(8) assert.deepEqual(await ch2.take(), 7) assert.deepEqual(await ch2.take(), 8) }) }) })
import FizzBuzzPopCalculator from '../src/index.js'; import { expect } from 'chai'; describe('fizz-buzz-pop-js tests', () => { let results = []; beforeEach(() => { let calculator = new FizzBuzzPopCalculator(); results = calculator.generateValues(); }); describe('When is not multiple 1 and 7', () => it('should be 1 and 7', () => { expect(results[0]).to.equal("1"); expect(results[6]).to.equal("7"); }) ); describe('When multiple of 3 and 5', () => it('should be FizzBuzz', () => expect(results[14]).to.equal("FizzBuzz")) ); describe('When multiple of 3', () => it('should be Fizz', function () { expect(results[2]).to.equal("Fizz"); expect(results[8]).to.equal("Fizz"); }) ); describe('When multiple of 5', () => it('should be Buzz', () => expect(results[4]).to.equal("Buzz")) ); describe('When multiple of 2 and 3', () => it('should be Pop', function () { expect(results[1]).to.equal("Pop"); expect(results[3]).to.equal("Pop"); }) ); describe('When multiple of 9', () => it('should be BuzzPop', () => expect(results[9]).to.equal("BuzzPop")) ); describe('When multiple of 2, 3 and 5', () => it('should be FizzBuzzPop', () => expect(results[29]).to.equal("FizzBuzzPop")) ); describe('When multiple of 2 and 3', () => it('should be FizzPop', () => expect(results[5]).to.equal("FizzPop")) ); });
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import Stack from '@mui/material/Stack'; export default function Playground() { const defaultProps = { options: top100Films, getOptionLabel: (option) => option.title, }; const flatProps = { options: top100Films.map((option) => option.title), }; const [value, setValue] = React.useState(null); return ( <Stack spacing={1} sx={{ width: 300 }}> <Autocomplete {...defaultProps} id="disable-close-on-select" disableCloseOnSelect renderInput={(params) => ( <TextField {...params} label="disableCloseOnSelect" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="clear-on-escape" clearOnEscape renderInput={(params) => ( <TextField {...params} label="clearOnEscape" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="disable-clearable" disableClearable renderInput={(params) => ( <TextField {...params} label="disableClearable" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="include-input-in-list" includeInputInList renderInput={(params) => ( <TextField {...params} label="includeInputInList" variant="standard" /> )} /> <Autocomplete {...flatProps} id="flat-demo" renderInput={(params) => ( <TextField {...params} label="flat" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="controlled-demo" value={value} onChange={(event, newValue) => { setValue(newValue); }} renderInput={(params) => ( <TextField {...params} label="controlled" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="auto-complete" autoComplete includeInputInList renderInput={(params) => ( <TextField {...params} label="autoComplete" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="disable-list-wrap" disableListWrap renderInput={(params) => ( <TextField {...params} label="disableListWrap" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="open-on-focus" openOnFocus renderInput={(params) => ( <TextField {...params} label="openOnFocus" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="auto-highlight" autoHighlight renderInput={(params) => ( <TextField {...params} label="autoHighlight" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="auto-select" autoSelect renderInput={(params) => ( <TextField {...params} label="autoSelect" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="disabled" disabled renderInput={(params) => ( <TextField {...params} label="disabled" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="disable-portal" disablePortal renderInput={(params) => ( <TextField {...params} label="disablePortal" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="blur-on-select" blurOnSelect renderInput={(params) => ( <TextField {...params} label="blurOnSelect" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="clear-on-blur" clearOnBlur renderInput={(params) => ( <TextField {...params} label="clearOnBlur" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="select-on-focus" selectOnFocus renderInput={(params) => ( <TextField {...params} label="selectOnFocus" variant="standard" /> )} /> <Autocomplete {...flatProps} id="readOnly" readOnly defaultValue={flatProps.options[13]} renderInput={(params) => ( <TextField {...params} label="readOnly" variant="standard" /> )} /> </Stack> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
module.exports = function(grunt) { grunt.initConfig({ elm: { compile: { files: { "bingo.js": ["Bingo.elm"] } } }, watch: { elm: { files: ["Bingo.elm", "BingoUtils.elm"], tasks: ["elm"] } }, clean: ["elm-stuff/build-artifacts"] }); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-elm'); grunt.registerTask('default', ['elm']); };
/* * File created by Amitesh Chauhan * <ami070ipec@gmail.com> * Main Javascript file to make plugins initialize and write functions to manipulate view. */ (function($) { 'use strict'; var ShowApp = { // Initialization the functions init: function() { ShowApp.Preloader(); ShowApp.AffixMenu(); ShowApp.MobileMenu(); ShowApp.ScrollSpy(); ShowApp.SmoothScroll(); ShowApp.FitVids(); ShowApp.PlaceHolder(); ShowApp.Carousel(); ShowApp.Lightbox(); ShowApp.Subscribe(); }, // Page loading process Preloader: function() { $(window).load(function() { $('#preloader .spinner').delay(100).fadeOut(300, function() { $('#header, .row-section').animate({ opacity: 1 }, 300); $(this).parent().delay(300).fadeOut(500, function() { ShowApp.Animated(); }); }); }); }, // Navigation menu affix AffixMenu: function() { var navMenu = '<nav id="navigation_affix">'; navMenu += $('#navigation').html(); navMenu += '</nav>'; $('#header').before(navMenu); $('#navigation').waypoint(function() { $('#navigation_affix').removeClass('show'); }, { offset: -89 }); $('#navigation').waypoint(function() { $('#navigation_affix').addClass('show'); }, { offset: -90 }); }, // Add mobile navigation MobileMenu: function() { var navMenu = '<nav class="nav-menu-mobile">'; navMenu += '<div class="nav-menu-links">'; navMenu += '<ul>'; navMenu += $('#navigation .nav').html(); navMenu += '</ul>'; navMenu += '</div>'; navMenu += '<div class="nav-menu-button">'; navMenu += '<button class="nav-menu-toggle"><i class="fa fa-navicon"></i></button>'; navMenu += '</div>'; navMenu += '</nav>'; $('#header').prepend(navMenu); $('.nav-menu-toggle').on('click', function() { $(this).parent('.nav-menu-button').prev('.nav-menu-links').slideToggle(300); }); }, // Navigation menu scrollspy to anchor section ScrollSpy: function() { $('body').scrollspy({ target: '#navigation_affix', offset: parseInt($('#navigation_affix').height(), 0) }); }, // Smooth scrolling to anchor section SmoothScroll: function() { $('a.smooth-scroll').on('click', function(event) { var $anchor = $(this); var offsetTop = ''; var elemHeight = parseInt($('#navigation_affix').height() - 1, 0); if (window.Response.band(768)) { offsetTop = parseInt($($anchor.attr('href')).offset().top - elemHeight, 0); } else { offsetTop = parseInt($($anchor.attr('href')).offset().top, 0); } $('html, body').stop().animate({ scrollTop: offsetTop }, 1500,'easeInOutExpo'); event.preventDefault(); }); }, // Responsive video size FitVids: function() { $('body').fitVids(); }, // Placeholder compatibility for IE8 PlaceHolder: function() { $('input, textarea').placeholder(); }, // Slider with Slick carousel Carousel: function() { // Gallery slider $('.carousel-slider.gallery-slider').each(function() { $(this).slick({ dots: true, slidesToShow: 4, slidesToScroll: 1, draggable: false, responsive: [ { breakpoint: 768, settings: { slidesToShow: 2, draggable: true } }, { breakpoint: 480, settings: { slidesToShow: 1, draggable: true } } ] }); }); // General slider $('.carousel-slider.general-slider').each(function() { $(this).slick({ dots: true, adaptiveHeight: true, draggable: false, responsive: [{ breakpoint: 768, settings: { draggable: true } }] }); }); }, // Preview images popup gallery with Fancybox Lightbox: function() { $('.fancybox').fancybox({ loop: false }); }, // Email subscribe process with AJAX Subscribe: function() { // Checking subcribe form when focus event $('.affa-form-subscribe input[type="text"], .affa-form-subscribe input[type="email"]').live('focus keypress', function() { var $email = $(this); if ($email.hasClass('error')) { $email.val('').removeClass('error'); } if ($email.hasClass('success')) { $email.val('').removeClass('success'); } }); // Subscribe form when submit to database $('.affa-form-subscribe').submit(function() { var $email = $(this).find('input[name="email"]'); var $submit = $(this).find('input[name="submit"]'); var email_pattern = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i; if (email_pattern.test($email.val()) === false) { $email.val('Please enter a valid email address!').addClass('error'); } else { var submitData = $(this).serialize(); $email.attr('disabled','disabled'); $submit.attr('disabled','disabled'); $.ajax({ // Subcribe process with AJAX type: 'POST', url: 'process-subscribe.php', data: submitData + '&action=add', dataType: 'html', success: function(msg) { if (parseInt(msg, 0) !== 0) { var msg_split = msg.split('|'); if (msg_split[0] === 'success') { $submit.removeAttr('disabled'); $email.removeAttr('disabled').val(msg_split[1]).addClass('success'); } else { $submit.removeAttr('disabled'); $email.removeAttr('disabled').val(msg_split[1]).addClass('error'); } } } }); } return false; }); }, // Embed animation effects to HTML elements with CSS3 Animated: function() { $('.animation, .animation-visible').each(function() { var $element = $(this); $element.waypoint(function() { var delay = 0; if ($element.attr('data-delay')) delay = parseInt($element.attr('data-delay'), 0); if (!$element.hasClass('animated')) { setTimeout(function() { $element.addClass('animated ' + $element.attr('data-animation')); }, delay); } delay = 0; }, { offset: '70%' }); }); } }; // Run the main function $(function() { ShowApp.init(); }); })(window.jQuery);
import Vue from 'vue' import Vuelidate from 'vuelidate' import { shallowMount } from '@vue/test-utils' import useI18nGlobally from '../../__utils__/i18n' import ModalExportWallets from '@/components/Modal/ModalExportWallets' import StringMixin from '@/mixins/strings' import WalletMixin from '@/mixins/wallet' Vue.use(Vuelidate) const i18n = useI18nGlobally() describe('ModalExportWallets', () => { const mountComponent = () => { const wallets = [ { address: 'A1', name: null, balance: 0 }, { address: 'A2', name: '', balance: 1 }, { address: 'A3', name: 'wallet_a3', balance: 0 }, { address: 'A4', name: 'wallet_a4', balance: 1 } ] const ledgerWallets = [ { address: 'A5', name: null, balance: 0 }, { address: 'A6', name: 'ledger_a6', balance: 1 } ] return shallowMount(ModalExportWallets, { i18n, mixins: [StringMixin, WalletMixin], mocks: { session_network: { knownWallets: {} }, $store: { getters: { 'delegate/byAddress': jest.fn(), 'wallet/contactsByProfileId': () => [], 'wallet/byProfileId': () => wallets, 'ledger/wallets': () => ledgerWallets } } } }) } it('should render modal', () => { const wrapper = mountComponent() expect(wrapper.isVueInstance()).toBeTrue() }) describe('toggleOption', () => { it('should exclude empty wallets', () => { const wrapper = mountComponent() wrapper.vm.toggleOption('excludeEmpty') const walletsWithBalance = [ { address: 'A2', name: '', balance: 1 }, { address: 'A4', name: 'wallet_a4', balance: 1 } ] expect(wrapper.vm.wallets).toEqual(walletsWithBalance) }) it('should exclude wallets with no name', () => { const wrapper = mountComponent() wrapper.vm.toggleOption('excludeUnnamed') const walletsWithName = [ { address: 'A3', name: 'wallet_a3', balance: 0 }, { address: 'A4', name: 'wallet_a4', balance: 1 } ] expect(wrapper.vm.wallets).toEqual(walletsWithName) }) }) })
let result = (() => { let Suits = { CLUBS: "\u2663", // ♣ DIAMONDS: "\u2666", // ♦ HEARTS: "\u2665", // ♥ SPADES: "\u2660" // ♠ }; let Faces = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']; class Card { constructor(face, suit) { this.face = face; this.suit = suit; } get face() { return this._face; } set face(face) { if (!Faces.includes(face)) { throw new Error('Invalid card face: ' + face); } this._face = face; } get suit() { return this._suit; } set suit(suit) { if (!Object.keys(Suits).map(k => Suits[k]).includes(suit)) { throw new Error('Invalid suit'); } this._suit = suit; } toString() { return `${this.face}${this.suit}`; } } return {Suits, Card } })(); let Suits = result.Suits; let Card = result.Card; let card = new Card("2",Suits.SPADES); console.log(card); card = new Card("2",Suits.CLUBS); console.log(card); card = new Card("2",Suits.DIAMONDS); console.log(card); card = new Card("2",Suits.HEARTS); console.log(card);
var led_8h = [ [ "Led_Init", "led_8h.html#af1aee968a5ceeb7915921aa6d78aca23", null ], [ "Led_Off", "led_8h.html#a274dbef77287444be852fe96969b3c55", null ], [ "Led_On", "led_8h.html#a39675df62ae72fa5af35fc7ec2e8c950", null ], [ "Led_Toggle", "led_8h.html#a5ebbd778fb3444fbfbded2130e08b33d", null ] ];
import {sleepUntilReactAvailable} from "test/e2e/utils/index.js"; const {maxTimeout, originUrl} = browser.params; // Private variables const dom = Symbol("dom"); class HelmetPageObject { static location = `${originUrl}/helmet-example`; _dom = { container: $("#helmet"), link: $("#helmet-link") }; get [dom]() { return this._dom; } getLocation() { return browser.get(HelmetPageObject.location); } getNavigationLink() { return this[dom].link; } sleepUntilPageAvailable() { return Promise.all([ sleepUntilReactAvailable(), browser.wait( protractor.ExpectedConditions.visibilityOf(this[dom].container), maxTimeout ) ]); } } export default HelmetPageObject;
function login(e) { e.preventDefault(); var email = document.getElementById("email").value; var password = document.getElementById("password").value; var data = {}; data.email = email; data.password = password; var xhttp = new XMLHttpRequest(); xhttp.open("POST", "/skinstore/loginuser", true); xhttp.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == 200) { // console.log(xhttp.responseText); // alert(xhttp.responseText); var textnode = document.createTextNode(xhttp.responseText); // var node = document.getElementById("loginform"); // node.appendChild(textnode); document.getElementById("loginform").appendChild(textnode); alert(textnode); } }; //JSON.stringify turns a Javascript object into JSON text and stores that JSON text in a string. //JSON.parse turns a string of JSON text into a Javascript object. xhttp.send(JSON.stringify(data)); }
{ "status" : "active" }
export const throttle = (func, limit) => { let inThrottle return function () { const args = arguments const context = this if (!inThrottle) { func.apply(context, args) inThrottle = true setTimeout(() => { inThrottle = false }, limit) } } } export const debounce = (func, delay) => { let inDebounce return function () { const context = this const args = arguments clearTimeout(inDebounce) inDebounce = setTimeout(() => func.apply(context, args), delay) } }
/*! * UI development toolkit for HTML5 (OpenUI5) * (c) Copyright 2009-2016 SAP SE or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ // Provides control sap.ui.commons.layout.MatrixLayout. sap.ui.define(['jquery.sap.global', './MatrixLayoutCell', './MatrixLayoutRow', 'sap/ui/commons/library', 'sap/ui/core/Control', 'sap/ui/core/EnabledPropagator'], function(jQuery, MatrixLayoutCell, MatrixLayoutRow, library, Control, EnabledPropagator) { "use strict"; /** * Constructor for a new layout/MatrixLayout. * * @param {string} [sId] id for the new control, generated automatically if no id is given * @param {object} [mSettings] initial settings for the new control * * @class * * <p> * A matrix layout arranges controls in a grid structure, using rows which * need not have the same number of cells. * </p> * * <p> * It uses predefined cell classes that guarantee appropriate distances * between cells in the grid. The cell's <code>vGutter</code> property lets * you specify additional horizontal distances easily. You can set these * additional distances (known as gutters) with or without separators. * The distance for each cell is specified by assigning a specific * enumeration value of the class <code>LayoutCellSeparator</code> of the * matrix data object. * </p> * * <p> * You should <b>avoid nesting</b> matrix layouts. You should only use a * matrix layout if you need to align controls horizontally across rows. * </p> * @extends sap.ui.core.Control * * @author SAP SE * @version 1.38.4 * * @constructor * @public * @deprecated Since version 1.38. Instead, use the <code>sap.ui.layout.Grid</code> control. * @alias sap.ui.commons.layout.MatrixLayout * @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel */ var MatrixLayout = Control.extend("sap.ui.commons.layout.MatrixLayout", /** @lends sap.ui.commons.layout.MatrixLayout.prototype */ { metadata : { library : "sap.ui.commons", properties : { /** * CSS width of the matrix layout. * If the LayoutFixed = true a adequate width should be provided. */ width : {type : "sap.ui.core.CSSSize", group : "Dimension", defaultValue : null}, /** * * CSS height of the matrix layout. */ height : {type : "sap.ui.core.CSSSize", group : "Dimension", defaultValue : null}, /** * Sets the table layout. If fixed the width parameter of a column has priority, if not the width of the content of the colums has priority. * The default is "fixed". * If the fixed layout is used a adequate width of the MatrixLayout should be provided. Otherwise the column width displayed could be different than the given ones because of browser dependend optimazations. */ layoutFixed : {type : "boolean", group : "Appearance", defaultValue : true}, /** * Number of columns. If not specified, the number of columns will be determined from the given cells. */ columns : {type : "int", group : "Appearance", defaultValue : null}, /** * Widths of the columns. Use an array to define the widths of the columns. * If a column shall have an automatical sizing enter "auto" for this column width. */ widths : {type : "sap.ui.core.CSSSize[]", group : "Appearance", defaultValue : null} }, defaultAggregation : "rows", aggregations : { /** * * The matrix layout's individual rows. */ rows : {type : "sap.ui.commons.layout.MatrixLayoutRow", multiple : true, singularName : "row"} } }}); EnabledPropagator.call(MatrixLayout.prototype, true, /* legacy mode */ true); /** * Creates a new matrix layout row and appends it to this matrix layout. * * Each argument must be either a matrix layout cell, which is added to the row * "as is", or an arbitrary content control, which is wrapped with a new * (default) matrix layout cell first and then added to the row. * * @param {sap.ui.core.Control|sap.ui.commons.layout.MatrixLayoutCell|string} rowContent to add * @return {sap.ui.commons.layout.MatrixLayout} <code>this</code> to allow method chaining * @public * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel */ MatrixLayout.prototype.createRow = function() { var oRow = new MatrixLayoutRow(); this.addRow(oRow); for (var i = 0; i < arguments.length; i++) { var oContent = arguments[i]; var oCell; if (oContent instanceof MatrixLayoutCell) { // matrix layout cell given, use as is oCell = oContent; } else if (oContent instanceof Control) { // any control given, wrap with matrix layout cell first oCell = new MatrixLayoutCell({content : oContent}); } else if (oContent instanceof Object && oContent.height) { oRow.setHeight(oContent.height); } else { // any string(?) given, display it var sText = oContent ? oContent.toString() : ""; oCell = new MatrixLayoutCell({ content : new sap.ui.commons.TextView({text : sText})}); } oRow.addCell(oCell); } return this; }; /* * Overwrites Setter for property <code>widths</code>. * Sets the widths of the columns. The values must be stored in an array to be used in renderer. * to be compatible with previous version also allow list of values. * @param {sap.ui.core.CSSSize[]} aWidths new value for property <code>widths</code> * @return {sap.ui.commons.layout.MatrixLayout} <code>this</code> to allow method chaining * @public */ MatrixLayout.prototype.setWidths = function( aWidths ) { var aSetWidths; if (!jQuery.isArray(aWidths)) { // a list of values is used instead of an array -> use this as array aSetWidths = jQuery.makeArray(arguments); } else { aSetWidths = aWidths; } // set "auto" for empty values for ( var i = 0; i < aSetWidths.length; i++) { if (aSetWidths[i] == "" || !aSetWidths[i]) { aSetWidths[i] = "auto"; } } this.setProperty("widths", aSetWidths); return this; }; return MatrixLayout; }, /* bExport= */ true);
function refresh_highlighter() { SyntaxHighlighter.highlight(); var sh = $("#high_text .syntaxhighlighter"); if (sh.length == 0) { sh.floatingScroll("destroy"); $(".fl-scrolls").remove(); } else { sh.floatingScroll("init"); sh.floatingScroll("update"); } } var ajax_request; var Storage = { init: function (storage_name) { this.storage_name = storage_name; return this; }, put:function(key,value){ localStorage.setItem(key, value); }, get:function(key){ return localStorage.getItem(key); } }; var History = { key:'ip_address', get: function () { return JSON.parse(Storage.get(this.key) || '[]'); }, put: function (value) { var data = this.get(); if(!Array.isArray(data)){ data = []; } var index = data.indexOf(value); if (index !== -1) { data.splice(index,1) } data.unshift(value); if(data.length>15){ data.pop(); } return Storage.put(this.key,JSON.stringify(data)); } }; function reload() { window.location.reload() } $(document).ready(function () { $("#device_info").on('mouseover', function () { $(this).attr('data-original-title', $('#device_info_tooltip').html()); }); $("#device_info").tooltip({placement: 'bottom', container: 'body'}); refresh_page(); createHistory(); SyntaxHighlighter.defaults['quick-code'] = false; SyntaxHighlighter.all(); $('#device_ip').mask('099.099.099.099'); $('.orig_btn').on('click', function () { $('button[value=show]').toggle(); $('button[value=hide]').toggle(); $("#orig_text").slideToggle("slow"); }); // click event listener $('.ajax-link').click(function (event) { console.log('ajax-link clicked'); console.log($(this).parent().attr('class')); if ($(this).parent().attr('class').indexOf('disabled') == -1) { var clickedLink = $(this).attr('id'); console.log(clickedLink); if (clickedLink == 'groupCommand') { callGroupCommand(); document.location.hash = clickedLink; $('#navbar li').removeClass('active'); $(this).closest('li').addClass('active'); } else { var ip = $('#device_ip').val().trim(); if (event.ctrlKey) { var url = window.location.href.split('#')[0]; if (ip_check(ip)) { window.open(url + '#' + clickedLink + '_' + ip); } else { end_loading(); alertify.error('Невірний IP!'); } } else { if (ip_check(ip)) { console.log(clickedLink + '_' + ip); document.location.hash = clickedLink + '_' + ip; $('#navbar li').removeClass('active'); $(this).closest('li').addClass('active'); load_page(clickedLink); } else { end_loading(); alertify.error('Невірний IP!'); } event.preventDefault(); } } } }); // click event listener //-------крутилка function start_loading() { $('#loading_global').show(); } function end_loading() { $('#loading_global').hide(100); } $('#device_ip').on('keyup change', function (e) { var flag = ip_check($(this).val()); if (flag == true) { if (e.keyCode == 13) { refresh_page(); } } else if (e.keyCode == 13) { end_loading(); alertify.error('Невірний IP!'); } return false; }); $('#device_connect').on('click', function () { device_connect(); }); $('#device_info').on('click', function () { $('#myModal').modal('show'); }); //Вкладка Дії }); function callGroupCommand() { start_loading(); $.ajax({ type: 'post', url: 'main/get_GroupCommand', data: {}, success: function (data) { $(document).prop('title', 'Групові команди'); $('#container').html(data); $('.cont').css('display', 'block'); refresh_highlighter(); rebind(); end_loading(); }, error: function (data) { $('.cont').css('display', 'block'); set_error(data.responseText); end_loading(); alertify.error('Помилка запиту!'); } }); } function ip_check(ip) { if (typeof(ip) == "undefined") { flag = false; } else { ip = ip.trim(); var ip_array = ip.split('.'); var flag = true; if (ip_array.length != 4) { flag = false; } else { $.each(ip_array, function (key, val) { if (parseInt(val) < 0 || parseInt(val) > 255 || val == null || isNaN(val) || val.trim() == '') { flag = false; } }); } } return flag; } function load_page(clickedLink) { console.log('load_page'); start_loading(); var ip = $('#device_ip').val().trim(); if (ip_check(ip)) { //добавление в историю History.put(ip); createHistory(); //флаг отмены предыдущего запроса var abort = false; //отменяем запрос if(ajax_request!==undefined){ ajax_request.abort(); abort = true; } ajax_request = $.ajax({ type: 'post', url: 'main/get_data', data: {method: clickedLink, ip: ip}, success: function (data) { $(document).prop('title', $('#'+clickedLink).html()); $('#container').html(data); $('.cont').css('display', 'block'); refresh_highlighter(); rebind(); end_loading(); }, error: function (data) { if(!abort){ $('.cont').css('display', 'block'); set_error(data.responseText); end_loading(); alertify.error('Помилка запиту!'); } } }); } else { end_loading(); alertify.error('Невірний IP!'); } } function send_action(url, variable, parametr) { console.log('send_action:' + url); console.log('variable:' + variable); var ip = $('#device_ip').val().trim(); if (ip_check(ip)) { start_loading(); $.ajax({ type: 'post', url: 'main/send_action', data: {url: url, variable: variable, additional_param: parametr, ip: $('#device_ip').val().trim()}, success: function (data) { if (get_method() != 'actions') { refresh_page(500); } end_loading(); }, error: function (data) { set_error(data.responseText); end_loading(); alertify.error('Помилка запиту!'); } }); } else { end_loading(); alertify.error('Невірний IP!'); } } function set_parameters(action, parameters) { var ip = $('#device_ip').val().trim(); if (ip_check(ip)) { console.log('set_parameters:' + parameters); start_loading(); $.ajax({ type: 'post', url: 'main/set_parameters/' + action, data: {parameters: parameters, ip: ip}, success: function (data) { if (get_method() != 'actions') { refresh_page(500); } end_loading(); }, error: function (data) { set_error(data.responseText); end_loading(); alertify.error('Помилка запиту!'); } }); } else { end_loading(); alertify.error('Невірний IP!'); } } function set_error(error) { $('.error_block').html("<div class=''><span class='alert alert-danger'><img src='../lib/other/img/alert.png' width='35px' height='35px'>" + "&nbsp&nbsp " + error + "</div><br><br>"); } function saveTrace() { var ip_form = $('#device_ip').val().trim(); if (ip_check(ip_form) == true) { window.location.replace('main/saveTrace/' + ip_form); } else { end_loading(); alertify.error('Невірний IP!'); } } function get_method() { return document.location.hash.split('_')[0].replace("#", ""); } function rebind() { $('.orig_btn').unbind('click'); $('.orig_btn').bind('click', function () { $('button[value=show]').toggle(); $('button[value=hide]').toggle(); $("#orig_text").slideToggle("slow"); }); $('.addScreen').click(function () { var form = $(this).closest('form').attr('id'); var area = $('#' + form + ' textarea[name=actionValue]'); area.val('<screen>\n' + area.val().trim() + '\n</screen>'); }); $('#sourceSwitcher').bootstrapSwitch().on('switchChange.bootstrapSwitch', function (event, state) { console.log($('#sourceSwitcher').bootstrapSwitch('state')); // true | false $('.actionName').toggleClass('hidden') }); $('input[name=actionValueFile]').change(function () { var form = $(this).closest('form').attr('id'); var ext = $(this).val().split('.').pop().toLowerCase(); var allowed = ['txt', 'xml', 'xslt', 'html', 'log']; var options = { url: '/main/getFileContent', type: 'post', success: function (data) { $('#' + form + ' textarea[name=actionValue]').val(data); end_loading(); } }; console.log($(this)); if (allowed.indexOf(ext) == -1) { alertify.error("Тип файла заборонений! Дозволено " + allowed.toString() + '.'); } else { start_loading(); $("#" + form).ajaxSubmit(options); } }); $('#moneyData').bind('change keyup mouseleave',function(e){ console.log('event'); var money_val = parseFloat($(this).val()); console.log(money_val); if(isNaN(money_val) || money_val == undefined){ $(this).val(0) }else{ $(this).val(money_val); } }); } function refresh_page(ms) { console.log('refresh_page'); ms = typeof ms !== 'undefined' ? ms : 0; setTimeout(function () { var hash = document.location.hash; console.log('hash' + hash); if (hash == '') { document.location.hash = 'screen'; } var method = get_method(); console.log('method: ' + method); $('#navbar li').removeClass('active'); $('#' + method).closest('li').addClass('active'); if (method == 'groupCommand') { callGroupCommand(); document.location.hash = method; } else { var ip = hash.split('_')[1]; var ip_form = $('#device_ip').val().trim(); if (ip_check(ip_form) == true) { console.log('ip checked form'); console.log(method + '_' + ip_form); document.location.hash = method + '_' + ip_form; console.log(document.location.hash); load_page(method); } else if (ip_check(ip) == true) { console.log('ip checked'); $('#device_ip').val(hash.split('_')[1]); load_page(method); } } }, ms); } //-------крутилка //-------крутилка function start_loading() { $('#loading_global').show(); } function end_loading() { $('#loading_global').hide(100); } function setTitle() { $(".title").on('mouseover', function () { $(this).tooltip({placement: 'bottom', container: 'body'}); }); } function callAdmin() { start_loading(); $.ajax({ type: 'post', url: 'main/get_page_access', data: {}, success: function (data) { $('#AccessModal-body').html(data); $('#userSwitcher').bootstrapSwitch().on('switchChange.bootstrapSwitch', function (event, state) { console.log($('#userSwitcher').bootstrapSwitch('state')); // true | false }); $('#AccessModal').modal('show'); end_loading(); $(".prof").popover({ html: true, placement:'left', trigger: 'hover', content: function () { return '<img class="middle_photo" src="'+$(this).attr('src') + '" /><div class="popover_div">'+$(this).attr('data-add-reason') + "</div>"; } }); }, error: function (data) { end_loading(); alertify.error('Помилка запиту!'); } }); } function addUser() { var new_ldap = $('input[name=new_ldap]').val().trim(); var add_reason = $('input[name=add_reason]').val().trim(); if (new_ldap != '') { var is_admin = 0; if (!$('#userSwitcher').bootstrapSwitch('state')) { is_admin = 1; } start_loading(); $.ajax({ type: 'post', url: 'main/add_user', data: {user: new_ldap,add_reason:add_reason,is_admin:is_admin}, success: function (data) { callAdmin(); }, error: function (data) { end_loading(); alertify.error(data.responseText); } }); } } function changeUserAccess(ldap, access) { var checked = $("input[name=" + ldap + '_' + access + "]").prop("checked"); start_loading(); $.ajax({ type: 'post', url: 'main/edit_user', data: {ldap: ldap, access: access, checked: checked}, success: function (data) { if($('#' + ldap +"_row input[type='checkbox']:checked").length===0){ $('#' + ldap +"_row").remove(); } end_loading(); }, error: function (data) { end_loading(); alertify.error(data.responseText); } }); } function download_screenshot(filename) { var link = document.createElement('a'); document.body.appendChild(link); link.download = filename + '.jpg'; link.href = document.getElementById('check_image').getAttribute('src'); link.click(); link.remove(); } //--------actions function send_command() { var name; if ($('#sourceSwitcher').bootstrapSwitch('state')) { name = $('#actionName').val(); } else { name = $('#actionNameCustom').val(); } set_parameters('action', 'name=' + name + '&value=' + $('textarea[name=actionValue]').val()); } //--------history созадаем меню истории function createHistory(){ var history = History.get(); var output = '<li><input class="form-control" maxlength="8" placeholder="Номер терміналу" type="text" name = "terminal_name"></li>'; $.each(history,function(key,val){ output += '<li><a onclick="set_terminal_ip(\''+val+'\')">'+val+'</a></li>'; }); $('#history').html(output); get_term_ip(); } //получаем ип введенного терминала function get_term_ip(){ $("input[name=terminal_name]").bind('change keyup' ,function () { console.log('aaaaaa'); if ($(this).val().length == 8) { $.ajax({ type: 'post', url: 'main/get_term_ip', data: {compassname: $(this).val()}, success: function (data) { set_terminal_ip(data.trim()) }, error: function (data) { end_loading(); alertify.error(data.responseText); } }); } } ) } //устанавливаем ип терминала с истории function set_terminal_ip(ip){ $('#device_ip').val(ip); refresh_page(); }
import glob from 'glob'; import { CLIEngine } from 'eslint'; import { assert } from 'chai'; const paths = glob.sync('./src/**/!(*.spec).js'); const engine = new CLIEngine({ envs: ['node', 'mocha'], useEslintrc: true }); const results = engine.executeOnFiles(paths).results; describe('ESLint', function() { results.forEach((result) => generateTest(result)); }); function generateTest(result) { const { filePath, messages, errorCount } = result; it(`validates ${filePath}`, function() { if (messages.length > 0 && errorCount > 0) { assert.fail(false, true, formatMessages(messages)); } }); } function formatMessages(messages) { const errors = messages.map((message) => { return `${message.line}:${message.column} ${message.message.slice(0, -1)} - ${message.ruleId}\n`; }); return `\n${errors.join('')}`; }
module.exports = { options: { width: 300, height: 300, overwrite: true }, resize: { files: { 'public/assets/projects/thumbnails/*': 'public/assets/projects/*' } } };
import React from "react"; import PropTypes from "prop-types"; import LightComponent from "ui-lib/light_component"; import Input from "react-toolbox/lib/input"; import Autocomplete from "react-toolbox/lib/autocomplete"; import Dropdown from "react-toolbox/lib/dropdown"; import { Form as TAForm, Section as TASection, utils as tautils } from "ui-components/type_admin"; class JobSpecEdit extends LightComponent { constructor(props) { super(props); this.itemProperties = { "_id": { editable: false, required: () => props.item, defaultValue: props.item ? props.item._id : "" }, "name": { editable: true, required: () => true, defaultValue: "" }, "criteria": { editable: true, required: () => this.state.script.value !== "", defaultValue: "" }, "script": { editable: true, required: () => false, defaultValue: "" }, "workspaceName": { editable: true, required: () => false, defaultValue: "" }, "workspaceCleanup": { editable: true, required: () => true, defaultValue: "remove_on_finish" }, "initialJobTags": { editable: true, required: () => false, defaultValue: [] }, "tags": { editable: true, required: () => false, defaultValue: [] } }; this.state = tautils.createStateProperties(this, this.itemProperties, this.props.item); } async onConfirm() { const data = tautils.serialize(this.state, this.itemProperties, this.props.item); const create = !this.props.item; if (create) { delete data._id; } await this.props.onSave("exec.jobspec", data, { create }); } _validate() { return tautils.isValid(this.state, this.itemProperties); } render() { this.log("render", this.props, this.state); const confirmAllowed = this._validate(); const cleanupPolicies = [ { value: "keep", label: "Do not remove" }, { value: "remove_on_finish", label: "Remove on finish" }, { value: "remove_on_success", label: "Remove on success" }, { value: "remove_when_needed", label: "Remove when needed" } ]; return ( <TASection breadcrumbs={this.props.breadcrumbs} controls={this.props.controls} menuItems={this.props.menuItems} > <TAForm confirmAllowed={confirmAllowed} confirmText={this.props.item ? "Save" : "Create"} primaryText={`${this.props.item ? "Edit" : "Create"} job specification`} secondaryText="A job specification specifies how to run a job" onConfirm={() => this.onConfirm()} onCancel={() => this.props.onCancel()} > <If condition={ this.props.item }> <Input type="text" label="ID" name="_id" floating={true} required={this.itemProperties._id.required()} disabled={!this.itemProperties._id.editable} value={this.state._id.value} onChange={this.state._id.set} /> </If> <Input type="text" label="Job name" name="name" floating={true} required={this.itemProperties.name.required()} disabled={this.props.item && !this.itemProperties.name.editable} value={this.state.name.value} onChange={this.state.name.set} /> <Input type="text" label="Slave Criteria" hint="Tag criteria to match slave" name="criteria" floating={true} required={this.itemProperties.criteria.required()} disabled={this.props.item && !this.itemProperties.criteria.editable} value={this.state.criteria.value} onChange={this.state.criteria.set} /> <Input theme={this.props.theme} className={this.props.theme.monospaceInput} type="text" label="Script" name="script" floating={true} multiline={true} required={this.itemProperties.script.required()} disabled={this.props.item && !this.itemProperties.script.editable} value={this.state.script.value} onChange={this.state.script.set} /> <Autocomplete selectedPosition="below" allowCreate={true} label="Tags to add to jobs" disabled={this.props.item && !this.itemProperties.initialJobTags.editable} onChange={this.state.initialJobTags.set} source={this.state.initialJobTags.value} value={this.state.initialJobTags.value} /> <Input type="text" label="Workspace Name" name="workspaceName" floating={true} required={this.itemProperties.workspaceName.required()} disabled={this.props.item && !this.itemProperties.workspaceName.editable} value={this.state.workspaceName.value} onChange={this.state.workspaceName.set} /> <Dropdown label="Workspace Cleanup Policy" required={this.itemProperties.workspaceCleanup.required()} disabled={this.props.item && !this.itemProperties.workspaceCleanup.editable} onChange={this.state.workspaceCleanup.set} source={cleanupPolicies} value={this.state.workspaceCleanup.value} /> <Autocomplete selectedPosition="below" allowCreate={true} label="Tags" disabled={this.props.item && !this.itemProperties.tags.editable} onChange={this.state.tags.set} source={this.state.tags.value} value={this.state.tags.value} /> </TAForm> </TASection> ); } } JobSpecEdit.propTypes = { theme: PropTypes.object, item: PropTypes.object, pathname: PropTypes.string.isRequired, breadcrumbs: PropTypes.array.isRequired, controls: PropTypes.array.isRequired, menuItems: PropTypes.array.isRequired, onSave: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired }; export default JobSpecEdit;
// set timeouts for feedback messages $(document).ready(function () { $('.feedback .alert-success').delay(2000).fadeOut(500); $('.feedback .alert-info').delay(2500).fadeOut(500); $('.feedback .alert-warning').delay(3000).fadeOut(500); $('.feedback .alert-danger').delay(4500).fadeOut(500); $('.timeshift-blink').each(function() { var elem = $(this); setInterval(function() { if (elem.css('visibility') == 'hidden') { elem.css('visibility', 'visible'); } else { elem.css('visibility', 'hidden'); } }, 500); }); });
var $ = global.jQuery = require('jquery'); var add = require('lodash/math/add'); var flow = require('lodash/function/flow'); require('bootstrap/js/button'); function square(n) { return n * n; } var addSquare = flow(add, square); $('#myButton').on('click', function() { var $btn = $(this); var loading = $btn.data('myButton-loading'); if (!loading) { $btn.data('myButton-loading', true); $btn.button('loading'); setTimeout(function(){ $btn.removeData('myButton-loading'); $btn.button('reset'); }, 1000); } });
import { ConnectDataClass, UserClass, UserDataClass } from './class_models' import { ivanka } from './base64img' const createConnectData = (description, text) => { return new ConnectDataClass(description,text) } const createUser = () => { let userData_personalData_name = createConnectData('Name','Trump') let userData_personalData_surname = createConnectData('Vorname','Ivanka') let userData_personalData_phone = createConnectData('Handy','2341234 12341234') let userData_personalData_image = createConnectData('Image',ivanka) let userData_hashTagData_color = createConnectData('Lieblingsstyle','Bizz') let userData_hashTagData_hobby = createConnectData('Interessen','Mode, Beauty') let userData_socialData_facebook = createConnectData('Facebook','https://web.facebook.com/DonaldTrump/?_rdc=1&_rdr') let userData_socialData_linkedIn = createConnectData('LinkedIn','https://www.linkedin.com/in/donald-trump-jr-4454b862/?locale=de_DE') let userData_socialData_twitter = createConnectData('Twitter','https://twitter.com/realdonaldtrump?lang=de') let publicSharedData_personalData = [] publicSharedData_personalData.push(userData_personalData_name) publicSharedData_personalData.push(userData_personalData_phone) let publicSharedData_socialData = [] publicSharedData_socialData.push(userData_socialData_facebook) publicSharedData_socialData.push(userData_socialData_twitter) let publicSharedData_hashTagData = [] publicSharedData_hashTagData.push(userData_hashTagData_hobby) publicSharedData_hashTagData.push(userData_hashTagData_color) let userData_personalData = [] userData_personalData.push(userData_personalData_surname) userData_personalData.push(userData_personalData_name) userData_personalData.push(userData_personalData_phone) userData_personalData.push(userData_personalData_image) let userData_socialData = [] userData_socialData.push(userData_socialData_facebook) userData_socialData.push(userData_socialData_linkedIn) userData_socialData.push(userData_socialData_twitter) let userData_hashTagData = [] userData_hashTagData.push(userData_hashTagData_hobby) userData_hashTagData.push(userData_hashTagData_color) let userDataClass = new UserDataClass(userData_personalData, userData_socialData, userData_hashTagData) let publicSharedDataClass = new UserDataClass(publicSharedData_personalData, publicSharedData_socialData, publicSharedData_hashTagData) let ivanka_user = new UserClass('a2',userDataClass,publicSharedDataClass,[]) return ivanka_user } const ivanka_user = createUser() export default ivanka_user
var bell_sounds = function () { var ctx = new AudioContext(); var ring_bell = function (freq, length) { var osc = ctx.createOscillator(); var gain = ctx.createGain(); osc.frequency.value = freq; osc.connect(gain); gain.connect(ctx.destination); osc.start(); gain.gain.linearRampToValueAtTime(1.0, ctx.currentTime + 0.01); gain.gain.linearRampToValueAtTime(0, ctx.currentTime + length / 1000 * 4); var stop = function () { osc.stop(ctx.currentTime + length / 1000 * 4 + 0.02); }; setTimeout(stop.bind(window), length); }; return { ring_bell: ring_bell, }; }(); bell_sounds.ring_bell(); module.exports = bell_sounds;
import React, { Component } from 'react'; import {sub} from 'elegant-react'; import Counters from './Counters'; import {on, stream} from 'flyd'; import counterPlugin from './counter-plugin'; export default class App extends Component { constructor(props) { super(props); const {atom} = this.props; this.edit = ::atom.updateState; this.state = {state: atom.getState()}; } componentWillMount() { const {atom} = this.props; const state = atom.getState(); this.incrementActionStreams = state.get('counts').map((_,i) => counterPlugin(sub(this.edit, 'counts', i)).incrementAction$ ).toArray(); // connect atom updates to component's state on(state => this.setState({state}), atom.didSetState$); } render() { const {state} = this.state; const {edit} = this; const sort = state.get('sort'); const sortOrder = state.get('sortOrder'); const compact = state.get('compact'); const toggleSort = sub(edit, 'sort'); const toggleSortOrder = sub(edit, 'sortOrder'); const toggleCompact = sub(edit, 'compact'); return <div> <label style={{ position: 'absolute', top: 5, right: 50}}> <input type="checkbox" checked={sort} onChange={event => toggleSort(v => !v)}/> sort </label> <label style={{ position: 'absolute', top: 5, right: 100}}> <input type="checkbox" checked={sortOrder===1} onChange={event => { toggleSort(v => true); toggleSortOrder(v => -v)}}/> sort asc </label> <label style={{ position: 'absolute', top: 5, right: 180}}> <input type="checkbox" checked={compact} onChange={event => toggleCompact(c => !c)}/> compact </label> <Counters lineHeight={compact ? 30 : 40} sortOrder={sortOrder * ~~sort} counts={state.get('counts')} incrementActionStreams={this.incrementActionStreams} /> </div> } }
'use strict'; /** * @ngdoc function * @name com.module.users.controller:LoginCtrl * @description Login Controller * @requires $scope * @requires $routeParams * @requires $location * Contrller for Login Page **/ angular.module('com.module.users') .controller('LoginCtrl', function($scope, $routeParams, $location, CoreService, User, AppAuth, AuthProvider, gettextCatalog) { var TWO_WEEKS = 1000 * 60 * 60 * 24 * 7 * 2; $scope.credentials = { ttl: TWO_WEEKS, rememberMe: true }; if (CoreService.env.name === 'development') { $scope.credentials.email = 'boris@g.com'; $scope.credentials.password = '1234'; } $scope.schema = [{ label: '', property: 'email', placeholder: gettextCatalog.getString('Email'), type: 'email', attr: { required: true, ngMinlength: 4 }, msgs: { required: gettextCatalog.getString('You need an email address'), email: gettextCatalog.getString('Email address needs to be valid'), valid: gettextCatalog.getString('Nice email address!') } }, { label: '', property: 'password', placehodler: gettextCatalog.getString('Password'), type: 'password', attr: { required: true } }, { property: 'rememberMe', label: gettextCatalog.getString('Stay signed in'), type: 'checkbox' }]; $scope.options = { validation: { enabled: true, showMessages: false }, layout: { type: 'basic', labelSize: 3, inputSize: 9 } }; $scope.socialLogin = function(provider) { window.location = CoreService.env.siteUrl + provider.authPath; }; AuthProvider.count(function(result) { if (result.count > 0) { AuthProvider.find(function(result) { $scope.authProviders = result; }); } }); $scope.login = function() { $scope.loginResult = User.login({ include: 'user', rememberMe: $scope.credentials.rememberMe }, $scope.credentials, function(user) { console.log(user.id); // => acess token console.log(user.ttl); // => 1209600 time to live console.log(user.created); // => 2013-12-20T21:10:20.377Z console.log(user.userId); // => 1 var next = $location.nextAfterLogin || '/'; $location.nextAfterLogin = null; AppAuth.currentUser = $scope.loginResult.user; CoreService.toastSuccess(gettextCatalog.getString('Logged in'), gettextCatalog.getString('You are logged in!')); if (next === '/login') { next = '/'; } $location.path(next); }, function(res) { $scope.loginError = res.data.error; }); }; });
'use strict'; // Returns a random whole number between the min (inclusive) and max (exclusive). function randomize(min, max){ return Math.floor(Math.random() * (max - min) + min); } // Selects a random question. function selectQuestion(questionType){ var attackQuestions = JSON.parse(localStorage.getItem('attackQuestions')); var defenseQuestions = JSON.parse(localStorage.getItem('defenseQuestions')); if(questionType === 'attack'){ var questionIndex = Math.floor(Math.random() * attackQuestions.length); var currentAttackQuestion = attackQuestions[questionIndex]; attackQuestions.splice(questionIndex, 1); localStorage.setItem('attackQuestions', JSON.stringify(attackQuestions)); return currentAttackQuestion; }else if(questionType === 'defense'){ var questionIndex = Math.floor(Math.random() * defenseQuestions.length); var currentDefenseQuestion = defenseQuestions[questionIndex]; defenseQuestions.splice(questionIndex, 1); localStorage.setItem('defenseQuestions', JSON.stringify(defenseQuestions)); return currentDefenseQuestion; }else if(questionType === 'final'){ roundsPerEncounter = 1; return finalQuestion; } } function saveQuestionsToLocalStorage(){ // Add attackQuestions to localStorage if it doesn't already exist. if(localStorage.getItem('attackQuestions') === null){ localStorage.setItem('attackQuestions', JSON.stringify(attackQuestions)); } // Add defenseQuestions to localStorage if it doesn't already exist. if(localStorage.getItem('defenseQuestions') === null){ localStorage.setItem('defenseQuestions', JSON.stringify(defenseQuestions)); } } // Selects a random enemy. function selectEnemy(){ // If it's the final round, choose a specific boss enemy. if(finalQuestionOfGame === 'true'){ enemy = dalek; localStorage.setItem('enemy', JSON.stringify(enemy)); }else{ // Not the final round, so choose a random enemy. if(localStorage.getItem('remainingEnemies') !== null){ // This is NOT the first time on this page this play-through. remainingEnemies = JSON.parse(localStorage.getItem('remainingEnemies')); enemy = JSON.parse(localStorage.getItem('enemy')); // Check all remaining enemies from before the encounter, and remove the one that // the player has just defeated from the array. for(var i = 0; i < remainingEnemies.length; i++){ if(remainingEnemies[i].name === enemy.name){ remainingEnemies.splice([i], 1); // Remove = (index, array[1]) localStorage.setItem('remainingEnemies', JSON.stringify(remainingEnemies)); // Found the enemy previously shown, exit the loop. break; } } // Select a new enemy for this encounter out of the edited remaining enemies' array. enemy = remainingEnemies[randomize(0, remainingEnemies.length)]; localStorage.setItem('enemy', JSON.stringify(enemy)); }else{ // This is the first time getting to this page for this play-through. // The player will be given access to ALL possible enemies to start with. remainingEnemies = enemies; localStorage.setItem('remainingEnemies', JSON.stringify(remainingEnemies)); // Generate the FIRST enemy. enemy = enemies[randomize(0, enemies.length)]; localStorage.setItem('enemy', JSON.stringify(enemy)); } } } // Handles the submit button being clicked in the form. function handleSubmit(event){ event.preventDefault(); event.stopPropagation(); // If player doesn't submit an answer, alert user to submit an answer. if(isNaN(parseInt(event.target.choices.value)) === true) { alert('Please select an answer before submitting.'); } // Only allows the logic to proceed if the player already submitted an answer. if(!validSubmit && isNaN(parseInt(event.target.choices.value)) !== true){ validSubmit = true; // If the player just answered the final question of the game. if(finalQuestionOfGame === 'true'){ // Check if answer is correct. if(parseInt(event.target.choices.value) === selectedQuestion.correctAnswer){ answerResponseEl.textContent = 'That is correct! You fixed the robot!'; player.score += 1; player.win = true; saveLocalStorage(); document.location.href = 'results.html'; }else { player.win = false; saveLocalStorage(); document.location.href = 'results.html'; } } if(currentRound <= roundsPerEncounter){ // Check if answer is correct. if(parseInt(event.target.choices.value) === selectedQuestion.correctAnswer){ answerResponseEl.textContent = 'That is correct! Nice job!'; player.score += 1; }else { answerResponseEl.textContent = selectedQuestion.incorrectAnswerResponse; } // The last round. if(currentRound === roundsPerEncounter){ // Change text of button. submitButtonEl.textContent = 'Proceed'; // The player can now leave the encounter. exitEncounter = true; validSubmit = false; currentRound += 1; } }else{ // Ensure button will send player to select level. if(exitEncounter){ // The player loses if they didn't gain any points this encounter. if(scoreAtEncounterStart === player.score){ // The player loses. player.win = false; saveLocalStorage(); document.location.href = 'results.html'; }else{ // The player moves onward. saveLocalStorage(); document.location.href = 'select-level.html'; } } } } } // Handles the "Go to Next Question" button being clicked in the form. function handleNextQuestionClick(event){ if (validSubmit){ // Remove this button on the second to last round being completed. if(currentRound === roundsPerEncounter - 1){ event.target.remove(); } // Increment currentRound. currentRound += 1; // Create the next round. encounterRound(); // Reset validSumbit for next round. validSubmit = false; var radioButtons = document.getElementsByClassName('answer-radio-button'); for(var i = 0; i < radioButtons.length; i++) { radioButtons[i].checked = false; } answerResponseEl.textContent = ''; } } // Creates a new round. function encounterRound(){ // Determine which type of question to ask this round. if(finalQuestionOfGame !== 'true'){ if(attackQuestion){ // Attack. selectedQuestion = selectQuestion('attack'); attackQuestion = !attackQuestion; }else{ // Defense selectedQuestion = selectQuestion('defense'); attackQuestion = !attackQuestion; } }else{ selectedQuestion = selectQuestion('final'); document.getElementById('next-question').remove(); } // Set the text pertaining to the question for the player to see. questionEl.textContent = selectedQuestion.question; answerChoiceOne.textContent = selectedQuestion.answerChoices[0]; answerChoiceTwo.textContent = selectedQuestion.answerChoices[1]; answerChoiceThree.textContent = selectedQuestion.answerChoices[2]; answerChoiceFour.textContent = selectedQuestion.answerChoices[3]; } // Loads the information needed for the combat phase of the game. function loadLocalStorage(){ // Load scene. scene = JSON.parse(localStorage.getItem('scene')); // Load player. player = JSON.parse(localStorage.getItem('player')); scoreAtEncounterStart = player.score; // Load historical figure. historicalFigure = JSON.parse(localStorage.getItem('historicalFigure')); finalQuestionOfGame = localStorage.getItem('finalQuestionOfGame'); } // Saves the information needed for the select-level and results page. function saveLocalStorage(){ // Save player. localStorage.setItem('player', JSON.stringify(player)); var tempEncountersCompleted = parseInt(localStorage.getItem('encountersCompleted')); tempEncountersCompleted += 1; localStorage.setItem('encountersCompleted', tempEncountersCompleted); } // Will be true when the submit button changes into a proceed button. var exitEncounter = false; // Will be true if this current round will be an attack. var attackQuestion = true; // Will be true if the player is on the "fix the robot" question. var finalQuestionOfGame = 'false'; // How many rounds are per an encounter. var roundsPerEncounter = 3; // The round the player is currently on. var currentRound = 1; // The score the player starts with at the beginning of the encounter. var scoreAtEncounterStart; // The question for this round. var selectedQuestion; // Will be true if the player has made a submission during that round. var validSubmit = false; // The current instances the encounter will be dealing with. var scene; var player; var historicalFigure; var enemy; var remainingEnemies; // Element containing the text of the question being asked. var questionEl = document.getElementById('question'); // Elements containing the text of the answer choices given for the question. var answerChoiceOne = document.getElementById('answer-choice-1'); var answerChoiceTwo = document.getElementById('answer-choice-2'); var answerChoiceThree = document.getElementById('answer-choice-3'); var answerChoiceFour = document.getElementById('answer-choice-4'); // The form containing the radio and submit buttons. var answerFormEl = document.getElementById('answer-choices'); answerFormEl.addEventListener('submit', handleSubmit); // Element containing the text of the answer response. var answerResponseEl = document.getElementById('answer-response'); // The button for the submission. var submitButtonEl = document.getElementById('submit-answer'); // The button for the next question. var nextButtonEl = document.getElementById('next-question'); nextButtonEl.addEventListener('click', handleNextQuestionClick); // The first round starts automatically. saveQuestionsToLocalStorage(); loadLocalStorage(); selectEnemy(); encounterRound(); //DOM functionality for scene var sceneImageEl = document.getElementById('scene-image'); if(finalQuestionOfGame === 'false'){ sceneImageEl.setAttribute('src', scene.image); }else{ // The last question of the game's image is special. sceneImageEl.setAttribute('src', 'images/finallevel.png'); } //DOM functionality for player var playerNameEl = document.getElementById('player-name'); playerNameEl.textContent = (player.name); var playerImageEl = document.getElementById('player-image'); playerImageEl.setAttribute('src', player.image); var playerSpeechEl = document.getElementById('player-speech'); playerSpeechEl.textContent = (player.speech); //DOM functionality for historical figure var historicalFigureNameEl = document.getElementById('historical-figure-name'); historicalFigureNameEl.textContent = (historicalFigure.name); var historicalFigureSpeechEl = document.getElementById('historical-figure-speech'); historicalFigureSpeechEl.textContent = (historicalFigure.comments); var historicalFigureImageEl = document.getElementById('historical-figure-image'); historicalFigureImageEl.setAttribute('src', historicalFigure.image); //DOM functionality for enemy var enemyNameEl = document.getElementById('enemy-name'); enemyNameEl.textContent = (enemy.name); var enemyImageEl = document.getElementById('enemy-image'); enemyImageEl.setAttribute('src', enemy.image); var enemySpeechEl = document.getElementById('enemy-speech'); enemySpeechEl.textContent = (enemy.speech);
var mariadb = require('../database/mariadb'); module.exports = function (email, callback) { mariadb.get(function (err, con) { if (err) { if (con) { con.release(); } console.log("Failed to get mariadb."); return callback(err); } var sql = "SELECT email FROM account WHERE email=?"; var data = [email]; var exec = con.query(sql, data, function (err, result) { if (con) { con.release(); } console.log("[findEmail] SQL : " + exec.sql); if (err) { callback(err); } else { callback(null, (result.length > 0)); } }); }); };
/* Handles converting the app's concept of a 'project' * to/from the GitHub API's concept of an 'issue' */ const commentExtractionRegex = /<!-- ([.\d]+),([.\d]+) -->/ function parseCoordinatesFromComment (commentLines) { var lastLine = commentLines.slice(-1)[0] var matches = commentExtractionRegex.exec(lastLine) return matches ? { x: matches[1], y: matches[2] } : { x: 0, y: 0 } } export default { deserializeCommentToProject: function (comment) { var textLines = comment.body.split('\r\n') var coords = parseCoordinatesFromComment(textLines) return { id: comment.id, title: textLines[0], description: textLines[1], username: comment.user.login, userId: comment.user.id, avatar_thumbnail: comment.user.avatar_url + '&s=' + 40, avatar: comment.user.avatar_url + '&s=' + 120, x: coords.x, y: coords.y, editMode: false } }, serializeProjectToComment: function (project) { let body = project.title + '\r\n' + (project.description || '') + '\r\n' + `<!-- ${project.x},${project.y} -->` return body } }
var searchData= [ ['lecture_5fdata',['lecture_data',['../projet__MAUSSION__RIOU_8cpp.html#a667003cfd6f66a62d7f583af4a61459b',1,'projet_MAUSSION_RIOU.cpp']]] ];
// All code points in the `Inscriptional_Pahlavi` script as per Unicode v9.0.0: [ 0x10B60, 0x10B61, 0x10B62, 0x10B63, 0x10B64, 0x10B65, 0x10B66, 0x10B67, 0x10B68, 0x10B69, 0x10B6A, 0x10B6B, 0x10B6C, 0x10B6D, 0x10B6E, 0x10B6F, 0x10B70, 0x10B71, 0x10B72, 0x10B78, 0x10B79, 0x10B7A, 0x10B7B, 0x10B7C, 0x10B7D, 0x10B7E, 0x10B7F ];
//tv.js Page({ data: { listArray:[ {date:"2016年11月20日 星期五 今天", items:[ {name:"战神",imageUrl:"http://www.hzeduask.com/edit5.0/uploadfile/201009/20100918133824708.jpg" ,scores:"9.0",id:"123123" } ] } ], }, onLoad: function () { }, didSelected:function(event) { console.log(event) } })
import React, { Component } from 'react'; /** * Button that counts how many times it was pressed and exposes a `@public` method to reset itself. */ export default class CounterButton extends Component { constructor() { super(); this.state = { value: 0, }; } /** * Sets the counter to a particular value. * * @public * @version 1.0.5 * @param {Number} [newValue=0] New value for the counter * @returns {string} Test */ set(newValue = 0) { this.setState({ value: parseInt(newValue, 10), }); } /** * Increments the counter. This method is not marked @public and is not visible in the styleguide. */ increment() { this.setState({ value: this.state.value + 1, }); } render() { return ( <button className="button" onClick={this.increment.bind(this)}> {this.state.value} </button> ); } }
/** CSRF Provides Cross-Site Request Forgery protection for applications. » Configuration Options {string} tokenSuffix: Suffix to append to csrf tokens {int} onFailure: HTTP Error code to respond on token validation failure » Usage example The ideal usage is to create the csrf token before rendering the view, this allows the token to be present in logicless templates (e.g. mustachioed template engines, such as hogan): res.render('form', { myToken: req.csrfToken('protect') }); You can also use the csrf middleware directly: res.render('form', { myToken: app.csrf.getToken(req, 'protect') }); Additionally, you can create the token from inside any template engine that supports logic. The following example uses the liquor engine: <input type="hidden" name="protect_key" value="#{req.csrfToken('protect')}" /> */ var app = protos.app; require('./request.js'); function Csrf(config, middleware) { // Dependency check if (!app.supports.session) { throw new Error("The 'csrf' middleware requires 'session'"); } else if (!app.supports.body_parser) { throw new Error("The 'csrf' middleware requires 'body_parser'"); } // Attach instance to app singleton app[middleware] = this; // Middleware configuration config = protos.extend({ tokenSuffix: '_key', }, config); // Add non-enumerable config Object.defineProperty(this, 'config',{ value: config, writable: true, enumerable: false, configurable: true }); } /** Checks the CSRF Token for a given form @param {object} req @param {string} token @param {object} fields @returns {boolean} Whether or not the token is valid @public */ Csrf.prototype.checkToken = function(req, token, fields) { // Accessing `this` is faster than accessing `app` in outer closure token += this.config.tokenSuffix; // These conditions must be satisfied: // a) Token is available in received fields // b) Token is available in session // c) If fields token matches session token var isValid = (token in fields) && (token in req.session) && (fields[token] === req.session[token]); // Return valid value return isValid; } /** Retrieves and/or sets a csrf token @param {object} req @param {string} token @returns {string} hash @public */ Csrf.prototype.getToken = function(req, token) { token += this.config.tokenSuffix; if (! req.session[token]) req.session[token] = this.createHash(); return req.session[token]; } /** Creates a hash to be used as a token @returns {string} hash @public */ Csrf.prototype.createHash = function() { return app.md5(Math.random().toString()); } module.exports = Csrf;
var breadcrumbs=[['-1',"",""],['2',"SOLUTION-WIDE PROPERTIES Reference","topic_0000000000000C16.html"],['1984',"Tlece.Recruitment.Models.Company Namespace","topic_0000000000000699.html"],['1998',"CompanyDto Class","topic_00000000000006A8.html"],['2000',"Properties","topic_00000000000006A8_props--.html"],['2009',"CompanyAdministratorIdPhoto Property","topic_00000000000006CB.html"]];
const mongoose = require("mongoose"); const db = require("../../models"); mongoose.Promise = global.Promise; //This file seeds the database mongoose.connect( process.env.MONGODB_URI || "mongodb://localhost/petrescuers", { useMongoClient: true } ); //Seeding the breed collection with the breed recommendation (breed) for each search combination (breedId) const breedLookupSeed = [ { breedId: 'smallhomelightcalm', breed: 'Chihuahua' }, { breedId: 'smallhomeanycalm', breed: 'Pug' }, { breedId: 'smallhomelighthighenergy', breed: 'Beagle' }, { breedId: 'smallhomeanyhighenergy', breed: 'Jack Russell Terrier' }, { breedId: 'smallapartmentlightcalm', breed: 'Shih Tzu' }, { breedId: 'smallapartmentanycalm', breed: 'Dachshund' }, { breedId: 'smallapartmentlighthighenergy', breed: 'Poodle' }, { breedId: 'smallapartmentanyhighenergy', breed: 'Corgi' }, { breedId: 'mediumhomelightcalm', breed: 'Chow Chow' }, { breedId: 'mediumhomeanycalm', breed: 'Hound' }, { breedId: 'mediumhomelighthighenergy', breed: 'Pit Bull' }, { breedId: 'mediumhomeanyhighenergy', breed: 'Labrador Retriever' }, { breedId: 'mediumapartmentlightcalm', breed: 'Bulldog' }, { breedId: 'mediumapartmentanycalm', breed: 'Shar Pei' }, { breedId: 'mediumapartmentlighthighenergy', breed: 'Border Collie' }, { breedId: 'mediumapartmentanyhighenergy', breed: 'Boxer' }, { breedId: 'largehomelightcalm', breed: 'Mastiff' }, { breedId: 'largehomeanycalm', breed: 'Great Dane' }, { breedId: 'largehomelighthighenergy', breed: 'Pit Bull' }, { breedId: 'largehomeanyhighenergy', breed: 'German Shepherd' }, { breedId: 'largeapartmentlightcalm', breed: 'American Bulldog' }, { breedId: 'largeapartmentanycalm', breed: 'Shar Pei' }, { breedId: 'largeapartmentlighthighenergy', breed: 'Border Collie' }, { breedId: 'largeapartmentanyhighenergy', breed: 'Greyhound' }, { breedId: 'smallyesyes', breed: 'Bombay' }, { breedId: 'smallyesno', breed: 'Russian Blue' }, { breedId: 'smallnono', breed: 'Persian' }, { breedId: 'smallnoyes', breed: 'Oriental' }, { breedId: 'mediumyesyes', breed: 'Siamese' }, { breedId: 'mediumyesno', breed: 'Russian Blue' }, { breedId: 'mediumnono', breed: 'Persian' }, { breedId: 'mediumnoyes', breed: 'Turkish Van' }, { breedId: 'largeyesyes', breed: 'Maine Coon' }, { breedId: 'largeyesno', breed: 'Russian Blue' }, { breedId: 'largenono', breed: 'American Shorthair' }, { breedId: 'largenoyes', breed: 'Manx' }, ]; db.BreedLookup .remove({}) .then(() => db.BreedLookup.collection.insertMany(breedLookupSeed)) .then(data => { console.log(data.insertedIds.length + " records inserted!"); process.exit(0); }) .catch(err => { console.error(err); process.exit(1); });
/** * This module formats precise time differences as a vague/fuzzy * time, e.g. '3 weeks ago', 'just now' or 'in 2 hours'. */ /*globals define, module */ (function (globals) { 'use strict'; var times = { year: 31557600000, // 1000 ms * 60 s * 60 m * 24 h * 365.25 d month: 2629800000, // 31557600000 ms / 12 m week: 604800000, // 1000 ms * 60 s * 60 m * 24 h * 7 d day: 86400000, // 1000 ms * 60 s * 60 m * 24 h hour: 3600000, // 1000 ms * 60 s * 60 m minute: 60000 // 1000 ms * 60 s }, languages = { en: { year: [ 'year', 'years' ], month: [ 'month', 'months' ], week: [ 'week', 'weeks' ], day: [ 'day', 'days' ], hour: [ 'hour', 'hours' ], minute: [ 'minute', 'minutes' ], past: function (vagueTime, unit) { return vagueTime + ' ' + unit + ' ago'; }, future: function (vagueTime, unit) { return 'in ' + vagueTime + ' ' + unit; }, defaults: { past: 'just now', future: 'soon' } }, fr: { year: [ 'an', 'ans' ], month: [ 'mois', 'mois' ], week: [ 'semaine', 'semaines' ], day: [ 'jour', 'jours' ], hour: [ 'heure', 'heures' ], minute: [ 'minute', 'minutes' ], past: function (vagueTime, unit) { return 'il y a ' + vagueTime + ' ' + unit; }, future: function (vagueTime, unit) { return 'dans ' + vagueTime + ' ' + unit; }, defaults: { past: 'tout de suite', future: 'bientôt' } } }, defaultLanguage = 'en', functions = { get: getVagueTime }; exportFunctions(); /** * Public function `get`. * * Returns a vague time, such as '3 weeks ago', 'just now' or 'in 2 hours'. * * @option [from] {Date} The origin time. Defaults to `Date.now()`. * @option [to] {Date} The target time. Defaults to `Date.now()`. * @option [units] {string} If `from` or `to` are timestamps rather than date * instances, this indicates the units that they are * measured in. Can be either `ms` for milliseconds * or `s` for seconds. Defaults to `ms`. * @option [lang] {string} The output language. Default is specified as a * build option. */ function getVagueTime (options) { var units = normaliseUnits(options.units), now = Date.now(), from = normaliseTime(options.from, units, now), to = normaliseTime(options.to, units, now), difference = from - to, type; if (difference > 0) { type = 'past'; } else { type = 'future'; difference = -difference; } return estimate(difference, type, options.lang); } function normaliseUnits (units) { if (typeof units === 'undefined') { return 'ms'; } if (units === 's' || units === 'ms') { return units; } throw new Error('Invalid units'); } function normaliseTime(time, units, defaultTime) { if (typeof time === 'undefined') { return defaultTime; } if (typeof time === 'string') { time = parseInt(time, 10); } if (isNotDate(time) && isNotTimestamp(time)) { throw new Error('Invalid time'); } if (typeof time === 'number' && units === 's') { time *= 1000; } return time; } function isNotDate (date) { return Object.prototype.toString.call(date) !== '[object Date]' || isNaN(date.getTime()); } function isNotTimestamp (timestamp) { return typeof timestamp !== 'number' || isNaN(timestamp); } function estimate (difference, type, language) { var time, vagueTime, lang = languages[language] || languages[defaultLanguage]; for (time in times) { if (times.hasOwnProperty(time) && difference >= times[time]) { vagueTime = Math.floor(difference / times[time]); return lang[type](vagueTime, lang[time][(vagueTime > 1)+0]); } } return lang.defaults[type]; } function exportFunctions () { if (typeof define === 'function' && define.amd) { define(function () { return functions; }); } else if (typeof module !== 'undefined' && module !== null) { module.exports = functions; } else { globals.vagueTime = functions; } } }(this));
Package.describe({ summary: 'A solution for the allow/deny vs methods dilemma', name: 'mquandalle:collection-mutations', version: '0.1.0', documentation: null, }); Package.onUse(function(api) { api.versionsFrom('1.2-rc.7'); api.use('mongo'); api.use('ecmascript'); api.use('underscore'); api.use('dburles:collection-helpers@1.0.0'); api.addFiles('mutations.js'); });
var co = require('co') var os = require('os') var fs = require('fs') var path = require('path') var http = require('http') var request = require('..') var tmpdir = os.tmpdir() var uri = 'https://raw.github.com/component/domify/84b1917ea5a9451f5add48c5f61e477f2788532b/component.json' var redirect = 'https://raw.github.com/jonathanong/inherits/master/component.json' describe('cogent', function () { it('should work with HTTPS', co(function* () { var res = yield* request(uri) res.statusCode.should.equal(200) res.headers['content-encoding'].should.equal('gzip') res.resume() })) it('should save to a file', co(function* () { var destination = path.join(tmpdir, Math.random().toString(36).slice(2)) var res = yield* request(uri, destination) res.statusCode.should.equal(200) res.destination.should.equal(destination) fs.statSync(destination) })) it('should resolve redirects', co(function* () { var res = yield* request(redirect, true) res.urls.length.should.equal(2) res.statusCode.should.equal(200) res.body.name.should.equal('inherits') })) it('should work with retries', co(function* () { var res = yield* request(uri, { retries: 2 }) res.statusCode.should.equal(200) res.headers['content-encoding'].should.equal('gzip') res.resume() })) })
/*! * This file is part of me-cms. * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @copyright Copyright (c) Mirko Pagliai * @link https://github.com/mirko-pagliai/me-cms * @license https://opensource.org/licenses/mit-license.php MIT License */ $(function () { //On click on button to display passwords $(".display-password").click(function (event) { event.preventDefault(); //Gets the icon var icon = $(this).children("i.fas"); //Gets the password field var oldField = $(this).closest(".input").find("input"); //Creates a replace field, setting the same value var replaceField = $("<input />").val(oldField.val()); //Copies each attribute to the replace field oldField.each(function () { $.each(this.attributes, function () { if (this.specified) { replaceField.attr(this.name, this.value); } }); }); //Sets the `type` for the replace field and changes the button icon if (oldField.attr("type") === "password") { replaceField.attr("type", "text"); icon.removeClass("fa-eye").addClass("fa-eye-slash"); } else { replaceField.attr("type", "password"); icon.removeClass("fa-eye-slash").addClass("fa-eye"); } //Inserts the replace field and removes the old field replaceField.insertBefore(oldField); oldField.remove(); }); });
import * as React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <path d="M17.09 11h4.86c-.16-1.61-.71-3.11-1.54-4.4-1.73.83-2.99 2.45-3.32 4.4zM6.91 11c-.33-1.95-1.59-3.57-3.32-4.4-.83 1.29-1.38 2.79-1.54 4.4h4.86zM15.07 11c.32-2.59 1.88-4.79 4.06-6-1.6-1.63-3.74-2.71-6.13-2.95V11h2.07zM8.93 11H11V2.05C8.61 2.29 6.46 3.37 4.87 5c2.18 1.21 3.74 3.41 4.06 6zM15.07 13H13v8.95c2.39-.24 4.54-1.32 6.13-2.95-2.18-1.21-3.74-3.41-4.06-6zM3.59 17.4c1.72-.83 2.99-2.46 3.32-4.4H2.05c.16 1.61.71 3.11 1.54 4.4zM17.09 13c.33 1.95 1.59 3.57 3.32 4.4.83-1.29 1.38-2.79 1.54-4.4h-4.86zM8.93 13c-.32 2.59-1.88 4.79-4.06 6 1.6 1.63 3.74 2.71 6.13 2.95V13H8.93z" /> , 'SportsBasketball');
/*jshint node:true*/ module.exports = { scenarios: [ { name: 'default', dependencies: { } }, { name: 'ember-1.13', dependencies: { 'ember': '~1.13.0' }, resolutions: { 'ember': '~1.13.0' } }, { name: 'ember-2.0', dependencies: { 'ember': '~2.0.0' }, resolutions: { 'ember': '~2.0.0' } }, { name: 'ember-2.1', dependencies: { 'ember': '~2.1.0' }, resolutions: { 'ember': '~2.1.0' } }, { name: 'ember-2.2', dependencies: { 'ember': '~2.2.0' }, resolutions: { 'ember': '~2.2.0' } }, { name: 'ember-2.3', dependencies: { 'ember': '~2.3.0' }, resolutions: { 'ember': '~2.3.0' } }, { name: 'ember-release', dependencies: { 'ember': 'components/ember#release' }, resolutions: { 'ember': 'release' } }, { name: 'ember-beta', dependencies: { 'ember': 'components/ember#beta' }, resolutions: { 'ember': 'beta' } }, { name: 'ember-canary', dependencies: { 'ember': 'components/ember#canary' }, resolutions: { 'ember': 'canary' } } ] };
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Bars = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ module.exports = require('./lib'); },{"./lib":46}],2:[function(require,module,exports){ var Generator = require('generate-js'), Renderer = require('./renderer'), Token = require('./compiler/tokens'), Blocks = require('./blocks'), Transform = require('./transforms'), packageJSON = require('../package'); var Bars = Generator.generate(function Bars() { var _ = this; _.defineProperties({ blocks: new Blocks(), partials: {}, transforms: new Transform() }); }); Bars.definePrototype({ version: packageJSON.version, build: function build(parsedTemplate, state) { var _ = this, program = parsedTemplate; if (Array.isArray(parsedTemplate)) { program = new Token.tokens.program(); program.fromArray(parsedTemplate); } return new Renderer(_, program, state); }, registerBlock: function registerBlock(name, block) { var _ = this; _.blocks[name] = block; }, registerPartial: function registerPartial(name, compiledTemplate) { var _ = this; if (typeof compiledTemplate === 'string') { if (!_.preCompile) { throw 'partials must be pre-compiled using bars.preCompile(template)'; } compiledTemplate = _.preCompile(compiledTemplate, name, null, { minify: true }); } var program = compiledTemplate; if (Array.isArray(compiledTemplate)) { program = new Token.tokens.program(); program.fromArray(compiledTemplate); } _.partials[name] = program; }, registerTransform: function registerTransform(name, func) { var _ = this; _.transforms[name] = func; }, }); module.exports = Bars; },{"../package":95,"./blocks":4,"./compiler/tokens":31,"./renderer":49,"./transforms":53,"generate-js":63}],3:[function(require,module,exports){ var Bars = require('./bars-runtime'), compile = require('./compiler'); Bars.definePrototype({ compile: function compile(template, filename, mode, flags) { var _ = this; return _.build(_.preCompile(template, filename, mode, flags)); }, preCompile: function preCompile(template, filename, mode, flags) { return compile(template, filename, mode, flags); } }); module.exports = Bars; },{"./bars-runtime":2,"./compiler":6}],4:[function(require,module,exports){ var Generator = require('generate-js'); var Blocks = Generator.generate(function Blocks() {}); Blocks.definePrototype({ if: function ifBlock(args, consequent, alternate, context) { if (args[0]) { consequent(); } else { alternate(); } }, with: function withBlock(args, consequent, alternate, context) { var _ = this, data = args[0]; if (!args.length) { consequent(); } else if (data && typeof data === 'object') { consequent(context.newContext(data)); } else { alternate(); } }, each: function eachBlock(args, consequent, alternate, context) { var _ = this, data = args[0]; if (data && typeof data === 'object') { var keys = Object.keys(data); if (keys.length) { for (var i = 0; i < keys.length; i++) { consequent( context.newContext( data[keys[i]], { key: keys[i], index: i, length: keys.length } ) ); } } else { alternate(); } } else { alternate(); } } }); module.exports = Blocks; },{"generate-js":63}],5:[function(require,module,exports){ var compileit = require('compileit'); var parsers = require('./parsers'); var Token = require('./tokens'); /* Parse Modes */ var parseModes = { 'TEXT': [ parsers.parseText, parsers.parseBarsMarkup ], 'BARS': [ parsers.parseBarsComment, parsers.parseBarsBlock, parsers.parseBarsPartial, parsers.parseBarsInsert ], 'DOM': [ parsers.parseText, parsers.parseHTMLComment, parsers.parseHTMLTag, parsers.parseBarsMarkup ], 'ATTR': [ parsers.parseHTMLTagEnd, parsers.parseWhitspace, parsers.parseHTMLAttr, // parsers.parseBarsMarkup ], 'VALUE': [ parsers.parseHTMLAttrEnd, parsers.parseText, parsers.parseBarsMarkup ], 'LOGIC': [ parsers.parseBarsMarkupEnd, parsers.parseExpressionLiteral, parsers.parseExpressionTransform, parsers.parseExpressionValue, parsers.parseExpressionOperator, parsers.parseExpressionAssignment, parsers.parseWhitspace ], 'LOGIC-EXP': [ parsers.parseBarsMarkupEnd, parsers.parseExpressionLiteral, parsers.parseExpressionTransform, parsers.parseExpressionValue, parsers.parseExpressionOperator, parsers.parseWhitspace ], 'LOGIC-ARGS': [ parsers.parseExpressionTransformEnd, parsers.parseExpressionLiteral, parsers.parseExpressionTransform, parsers.parseExpressionValue, parsers.parseExpressionOperator, parsers.parseWhitspace ] }; var compiler = new compileit.Compiler(parseModes, { modeFormater: function (a) { return a.green; }, charFormater: function (a) { return a.green.underline; }, funcFormater: function (a) { return a.red; }, typeFormater: function (a) { return a.red; }, sourceFormater: function (a) { return ('`' + a + '`') .green.underline; } }); function compile(str, file, mode, flags) { mode = mode || 'DOM'; flags = flags || {}; var program = new Token.tokens.program(), frag = new Token.tokens.fragment(); frag.nodesUpdate = 1; program.mode = mode; program.fragment = frag; frag.nodes = compiler.compile(str, file, mode, flags); return program; } module.exports = compile; },{"./parsers":24,"./tokens":31,"compileit":56}],6:[function(require,module,exports){ module.exports = require('./compiler'); },{"./compiler":5}],7:[function(require,module,exports){ var Token = require('../tokens'), BlockToken = Token.tokens.block, FragmentToken = Token.tokens.fragment, utils = require('../utils'); function parseBarsBlock(mode, code, tokens, flags, scope, parseMode) { var index = code.index + 2, length = code.length, block, isOpening, isClosing, isElse, alternateIsBlock, blockMode = flags.markup.mode; if ( /* / */ code.codePointAt(index) === 0x002f ) { isClosing = true; flags.markup.closeParseScope = true; } else if ( /* # */ code.codePointAt(index) === 0x0023 || (scope.token && scope.token.alternateIsBlock) ) { isOpening = true; } else if ( /* else */ code.codePointAt(index) === 0x0065 && code.codePointAt(++index) === 0x006c && code.codePointAt(++index) === 0x0073 && code.codePointAt(++index) === 0x0065 ) { isElse = true; if (utils.isWhitespace(code.codePointAt(index + 1))) { index += 2; alternateIsBlock = true; } else if ( code.codePointAt(++index) === 0x007d && code.codePointAt(++index) === 0x007d ) { index++; } block = new BlockToken(code); code.index = index; block.close(); if (!BlockToken.isCreation(scope.token) || scope.token.elsed) { throw code.makeError( block.range[0], block.range[1], 'Unexpected Token: ' + JSON.stringify(block.source(code)) + '.' ); } scope.token.elsed = true; scope.token.alternateIsBlock = alternateIsBlock; flags.markup.closeParseScope = true; scope.close(); parseMode.close(); return true; } else { return null; } if (scope.token && scope.token.alternateIsBlock) { index -= 2; } else index++; block = new BlockToken(code); if (!utils.isHTMLIdentifierStart(code.codePointAt(index))) { throw code.makeError( index, index + 1, 'Unexpected Token: Expected <[A-Za-z]> but found ' + JSON.stringify(code.charAt(index)) + '.' ); } for (; index < length; index++) { ch = code.codePointAt(index); if (utils.isHTMLIdentifier(ch)) { block.name += code.charAt(index); } else { break; } } if (isClosing) { if ( code.codePointAt(index) === 0x007d && code.codePointAt(++index) === 0x007d ) { index++; } else { throw code.makeError( index, index + 1, 'Unexpected Token: Expected ' + JSON.stringify('}}') + ' but found ' + JSON.stringify(code.charAt(index)) + '.' ); } code.index = index; block.close(); if (!BlockToken.isCreation(scope.token)) { throw code.makeError( block.range[0], block.range[1], 'Unexpected Closing Block: ' + JSON.stringify(block.source(code)) + '.' ); } if (scope.token.name !== block.name) { throw code.makeError( block.range[0], block.range[1], 'Mismatch Closing Block: Expected ' + JSON.stringify('{{/' + scope.token.name + '}}') + ' but found ' + JSON.stringify(block.source(code)) + '.' ); } scope.close(); parseMode.close(); return true; } if (utils.isWhitespace(code.codePointAt(index))) index++; code.index = index; var args = []; scope.push(block); parseMode('LOGIC', args, flags); args = utils.makeExpressionTree(args, code); var am = utils.sortArgsAndContextMap(args, code); block.map = am.map; block.arguments = am.args; args = null; am = null; if (!block.closed) { throw code.makeError( code.index, code.index + 1, 'Unclosed Block: Expected ' + JSON.stringify('}}') + ' but found ' + JSON.stringify(code.charAt(code.index)) + '.' ); } block.consequent = new FragmentToken(code); delete block.closed; scope.push(block); parseMode(blockMode, block.consequent.nodes, flags); index = code.index; block.consequent.close(); code.index = index; if (block.elsed) { if (block.alternateIsBlock) { delete block.closed; scope.push(block); flags.markup = { mode: blockMode }; block.alternate = parseBarsBlock(mode, code, [], flags, scope, parseMode); delete flags.markup; scope.close(); return block; } block.alternate = new FragmentToken(code); delete block.closed; scope.push(block); parseMode(blockMode, block.alternate.nodes, flags); index = code.index; block.alternate.close(); } if (!block.closed) { throw code.makeError( block.range[0], block.range[0] + block.name.length + 6 + block.expression.length, 'Unclosed Block: Expected ' + JSON.stringify('{{/' + block.name + '}}') + ' to fallow ' + JSON.stringify('{{#' + block.name + ' <expression>}}') + '.' ); } parseMode.close(); return block; } module.exports = parseBarsBlock; },{"../tokens":31,"../utils":44}],8:[function(require,module,exports){ //parseBarsComment function parseBarsComment(mode, code, tokens, flags, scope, parseMode) { var index = code.index + 2, length = code.length; if ( /* ! */ code.codePointAt(index) === 0x0021 ) { if ( code.codePointAt(++index) === 0x002d && code.codePointAt(++index) === 0x002d ) { index++; for (; index < length; index++) { if ( /* --}} */ code.codePointAt(index) === 0x002d && code.codePointAt(index + 1) === 0x002d && code.codePointAt(index + 2) === 0x007d && code.codePointAt(index + 3) === 0x007d ) { index += 4; /* for --}} */ code.index = index; parseMode.close(); if (flags.keepComments) { // make a CommentToken and return that. } return true; } } throw code.makeError( 'Unclosed Comment: Expected "--}}" to fallow "{{!--".', 5 ); } index++; for (; index < length; index++) { if ( /* }} */ code.codePointAt(index) === 0x007d && code.codePointAt(index + 1) === 0x007d ) { index += 2; /* for }} */ code.index = index; parseMode.close(); if (flags.keepComments) { // make a CommentToken and return that. } return true; } } throw code.makeError( code.index, code.index + 3, 'Unclosed Comment: Expected "}}" to fallow "{{!".' ); } return null; } module.exports = parseBarsComment; },{}],9:[function(require,module,exports){ var InsertToken = require('../tokens') .tokens.insert, utils = require('../utils'); function parseBarsInsert(mode, code, tokens, flags, scope, parseMode) { var index = code.index + 2, length = code.length, insert = new InsertToken(code), args = []; scope.push(insert); code.index = index; parseMode('LOGIC-EXP', args, flags); args = utils.makeExpressionTree(args, code); if (args.length > 1) { code.index = args[1].range[0]; throw code.makeError( args[1].range[0], args[1].range[1], 'Unexpected Token: ' + JSON.stringify(args[1].source(code)) + '.' ); } insert.expression = args[0]; args = null; if (!insert.closed) { throw code.makeError( code.index, code.index + 1, 'Unclosed Block: Expected ' + JSON.stringify('}}') + ' but found ' + JSON.stringify(code.charAt(code.index)) + '.' ); } if (!insert.expression) { throw code.makeError( code.index - 2, code.index - 1, 'Missing <expression>.' ); } parseMode.close(); return insert; } module.exports = parseBarsInsert; },{"../tokens":31,"../utils":44}],10:[function(require,module,exports){ // parseBarsMarkupEnd var Token = require('../tokens'); function parseBarsMarkupEnd(mode, code, tokens, flags, scope, parseMode) { if ( /* }} */ code.codePointAt(code.index) === 0x007d && code.codePointAt(code.index + 1) === 0x007d ) { // console.log(JSON.stringify(scope.token.toObject(), null, 2)) if ( Token.tokens.insert.isCreation(scope.token) || Token.tokens.block.isCreation(scope.token) || Token.tokens.partial.isCreation(scope.token) || Token.tokens.prop.isCreation(scope.token) ) { code.index += 2; scope.close(); parseMode.close(); return true; } } return null; } module.exports = parseBarsMarkupEnd; },{"../tokens":31}],11:[function(require,module,exports){ //parseBarsMarkup function parseBarsMarkup(mode, code, tokens, flags, scope, parseMode) { var index = code.index, length = code.length; if ( /* {{ */ code.codePointAt(index) === 0x007b && code.codePointAt(++index) === 0x007b ) { flags.markup = {}; flags.markup.mode = mode; parseMode('BARS', tokens, flags); if (code.index > index) { if (flags.markup && flags.markup.closeParseScope) { parseMode.close(); } delete flags.markup; if (scope.token) { scope.token.updates(); } return true; } delete flags.markup; } return null; } module.exports = parseBarsMarkup; },{}],12:[function(require,module,exports){ var PartialToken = require('../tokens') .tokens.partial, utils = require('../utils'); function parseBarsPartial(mode, code, tokens, flags, scope, parseMode) { var index = code.index + 2, length = code.length, partial, router = false; if ( /* > */ code.codePointAt(index) === 0x003e ) { partial = new PartialToken(code); index++; if (code.codePointAt(index) === 0x003f) { router = true; index++; } else if (utils.isHTMLIdentifierStart(code.codePointAt(index))) { for (; index < length; index++) { ch = code.codePointAt(index); if (utils.isHTMLIdentifier(ch)) { partial.name += code.charAt(index); } else { break; } } } else { throw code.makeError( index, index + 1, 'Unexpected Token: Expected <[A-Za-z]> but found ' + JSON.stringify(code.charAt(index)) + '.' ); } code.index = index; var args = []; scope.push(partial); parseMode('LOGIC', args, flags); args = utils.makeExpressionTree(args, code); var am = utils.sortArgsAndContextMap(args, code); args = am.args; partial.map = am.map; am = null; if (args.length > (router ? 2 : 1)) { throw code.makeError( args[1].range[0], args[1].range[1], 'Unexpected Token: ' + JSON.stringify(args[1].source(code)) + '.' ); } if (router) { partial.name = args[0] || null; partial.expression = args[1] || null; } else { partial.expression = args[0] || null; } args = null; if (!partial.closed) { throw code.makeError( index, index + 1, 'Unclosed Block: Expected ' + JSON.stringify('}}') + ' but found ' + JSON.stringify(code.charAt(code.index)) + '.' ); } parseMode.close(); return partial; } return null; } module.exports = parseBarsPartial; },{"../tokens":31,"../utils":44}],13:[function(require,module,exports){ var Token = require('../tokens'), ValueToken = Token.tokens.value, AssignmentToken = Token.tokens.assignment; function isEQ(ch) { return ch === 0x003d; } function parseAssignment(mode, code, tokens, flags, scope, parseMode) { var index = code.index, length = code.length; if (!isEQ(code.codePointAt(index))) { return null; } var assignment = new AssignmentToken(code); code.index++; assignment.close(); var preToken = tokens[tokens.length - 1]; if (!ValueToken.isCreation(preToken)) { throw code.makeError( assignment.range[0], assignment.range[1], 'Unexpected Token: ' + JSON.stringify( assignment.source() ) .slice(1, -1) ); } return assignment; } module.exports = parseAssignment; },{"../tokens":31}],14:[function(require,module,exports){ var Token = require('../tokens'), LiteralToken = Token.tokens.literal, OperatorToken = Token.tokens.operator; function STRING(mode, code, tokens, flags, scope, parseMode) { var ch, index = code.index, length = code.length, text; /* ' */ if (code.codePointAt(index) !== 0x0027) { return null; } index++; text = new LiteralToken(code); text.value = ''; for (; index < length; index++) { ch = code.codePointAt(index); if (ch === 0x000a) { code.index = index; return null; } if ( /* ' but not \' */ ch === 0x0027 && code.codePointAt(index - 1) !== 0x005c ) { index++; break; } text.value += code.charAt(index); } if (index > code.index) { code.index = index; text.close(); return text; } return null; } function NUMBER(mode, code, tokens, flags, scope, parseMode) { var index = code.index, length = code.length, ch = code.codePointAt(index), nextCh = code.codePointAt(index + 1), dot, Ee; if ( (ch === 0x002d && 0x0030 <= nextCh && nextCh <= 0x0039) || /* -[0-9] */ (0x0030 <= ch && ch <= 0x0039) /* [0-9] */ ) { index++; number = new LiteralToken(code); for (; index < length; index++) { ch = code.codePointAt(index); if (0x0030 <= ch && ch <= 0x0039) { continue; } else if (ch === 0x0045 || ch === 0x0065) { /* [Ee] */ index++; ch = code.codePointAt(index); nextCh = code.codePointAt(index + 1); if ( /* [+-]?[0-9] */ Ee || !( ( (ch === 0x002b || ch === 0x002d) && (0x0030 <= nextCh && nextCh <= 0x0039) ) || (0x0030 <= ch && ch <= 0x0039) ) ) { code.index = index - 1; throw code.makeError( 'Unexpected Token: ' + JSON.stringify(code.charAt(index - 1)) + '.' ); } Ee = true; } else if (ch === 0x002e) { /* . */ index++; ch = code.codePointAt(index); if ( /* [+-]?[0-9] */ Ee || dot || !(0x0030 <= ch && ch <= 0x0039) ) { code.index = index - 1; throw code.makeError( 'Unexpected Token: ".".' ); } dot = true; } else { break; } } code.index = index; number.close(); number.value = Number(number.source(code)); return number; } return null; } function BOOLEAN(mode, code, tokens, flags, scope, parseMode) { var index = code.index, bool; if ( /* true */ code.codePointAt(index) === 0x0074 && code.codePointAt(++index) === 0x0072 && code.codePointAt(++index) === 0x0075 && code.codePointAt(++index) === 0x0065 ) { bool = true; } else if ( /* false */ code.codePointAt(index) === 0x0066 && code.codePointAt(++index) === 0x0061 && code.codePointAt(++index) === 0x006c && code.codePointAt(++index) === 0x0073 && code.codePointAt(++index) === 0x0065 ) { bool = false; } else { return null; } var boolean = new LiteralToken(code); index++; code.index = index; boolean.close(); boolean.value = bool; return boolean; } function NULL(mode, code, tokens, flags, scope, parseMode) { var index = code.index, nul; if ( /* true */ code.codePointAt(index) === 0x006e && code.codePointAt(++index) === 0x0075 && code.codePointAt(++index) === 0x006c && code.codePointAt(++index) === 0x006c ) { index++; nul = new LiteralToken(code); code.index = index; nul.close(); nul.value = null; } else { return null; } return nul; } function parseExpressionLiteral(mode, code, tokens, flags, scope, parseMode) { return ( STRING(mode, code, tokens, flags, scope, parseMode) || NUMBER(mode, code, tokens, flags, scope, parseMode) || BOOLEAN(mode, code, tokens, flags, scope, parseMode) || NULL(mode, code, tokens, flags, scope, parseMode) ); } module.exports = parseExpressionLiteral; },{"../tokens":31}],15:[function(require,module,exports){ var compileit = require('compileit'), Token = require('../tokens'), OperatorToken = Token.tokens.operator, AssignmentToken = Token.tokens.assignment, utils = require('../utils'); function opS(ch) { return ch === 0x0021 || (0x0025 <= ch && ch <= 0x0026) || (0x002a <= ch && ch <= 0x002b) || (0x002d <= ch && ch <= 0x002f) || (0x003c <= ch && ch <= 0x003e) || ch === 0x007c; } function opEQ(ch) { return ch === 0x0021 || (0x003c <= ch && ch <= 0x003e); } function opEQEQ(ch) { return ch === 0x0021 || ch === 0x003d; } function isEQ(ch) { return ch === 0x003d; } function isOR(ch) { return ch === 0x007c; } function isAND(ch) { return ch === 0x0026; } function parseConditional(mode, code, tokens, flags, scope, parseMode) { var index = code.index, length = code.length, operator, args; if ( code.codePointAt(index) === 0x003f // ^[?]$ ) { operator = new OperatorToken(code); code.index++; operator.operator = '?:'; args = []; scope.push(operator); parseMode('LOGIC-EXP', args, flags); // do more here args = utils.makeExpressionTree(args, code); if (args.length > 1) throw 'OPERATOR OPERAND MISMATCH'; operator.operands.push(args[0]); return operator; } else if ( code.codePointAt(index) === 0x003a // ^[:]$ ) { if ( OperatorToken.isCreation(scope.token) && scope.token.operator === '?:' ) { code.index++; scope.close(); parseMode.close(); return true; } else { throw code.makeError( index, index + 1, 'Unexpected token: ' + code.charAt(index) ); } } return null; } function parseParentheses(mode, code, tokens, flags, scope, parseMode) { var index = code.index, length = code.length, operator, args, p, b; if ( (p = code.codePointAt(index) === 0x0028) || // ^[(]$ (b = code.codePointAt(index) === 0x005b) // ^[\[]$ ) { operator = new OperatorToken(code); code.index++; if (p) { operator.parentheses = true; } else if (b) { operator.brackets = true; } operator.operator = '.'; args = []; scope.push(operator); parseMode('LOGIC-EXP', args, flags); // do more here args = utils.makeExpressionTree(args, code); if (args.length > 1) throw 'OPERATOR OPERAND MISMATCH'; operator.operands.push(args[0]); if (p) { return args[0]; } else if (b) { return operator; } } else if ( (p = code.codePointAt(index) === 0x0029) || // ^[)]$ (b = code.codePointAt(index) === 0x005d) // ^[\]]$ ) { if ( OperatorToken.isCreation(scope.token) && ( (p && scope.token.parentheses) || (b && scope.token.brackets) ) ) { code.index++; scope.close(); parseMode.close(); return true; } else { throw code.makeError( index, index + 1, 'Unexpected token: ' + code.charAt(index) ); } } return null; } function parseOperator(mode, code, tokens, flags, scope, parseMode) { var index = code.index, length = code.length, ch = code.codePointAt(index); if (!opS(ch)) { return null; } var operator = new OperatorToken(code); if (opEQ(ch) && isEQ(code.codePointAt(index + 1))) { index++; } else if (isEQ(ch)) { return null; } if ( (isOR(ch) && isOR(code.codePointAt(index + 1))) || (isAND(ch) && isAND(code.codePointAt(index + 1))) ) { index++; } else if (isOR(ch) || isAND(ch)) { throw code.makeError( operator.range[0], operator.range[1], 'Unexpected token: ' + JSON.stringify( operator.source() ) .slice(1, -1) ); } if (opEQEQ(ch) && isEQ(code.codePointAt(index + 1))) { index++; } index++; code.index = index; operator.close(); operator.operator = operator.source(); var preToken = tokens[tokens.length - 1]; var pre2Token = tokens[tokens.length - 2]; if ( AssignmentToken.isCreation(preToken) || ( operator.operator !== '!' && (!preToken || (!preToken.saturated && !preToken.brackets && OperatorToken.isCreation(preToken) ) ) ) || ( OperatorToken.isCreation(preToken) && preToken.operator === '!' && OperatorToken.isCreation(pre2Token) && pre2Token.operator === '!' ) ) { throw code.makeError( operator.range[0], operator.range[1], 'Unexpected token: ' + JSON.stringify( operator.source() ) .slice(1, -1) ); } return operator; } function parseExpressionOperator(mode, code, tokens, flags, scope, parseMode) { return ( parseOperator(mode, code, tokens, flags, scope, parseMode) || parseParentheses(mode, code, tokens, flags, scope, parseMode) || parseConditional(mode, code, tokens, flags, scope, parseMode) ); } module.exports = parseExpressionOperator; },{"../tokens":31,"../utils":44,"compileit":56}],16:[function(require,module,exports){ // parseExpressionTransformEnd var Token = require('../tokens'); function parseExpressionTransformEnd(mode, code, tokens, flags, scope, parseMode) { if ( /* ) */ code.codePointAt(code.index) === 0x0029 && Token.tokens.transform.isCreation(scope.token) ) { code.index++; scope.close(); parseMode.close(); return true; } if ( /* , */ code.codePointAt(code.index) === 0x002c && Token.tokens.transform.isCreation(scope.token) ) { code.index++; scope.token.nextArg = true; parseMode.close(); return true; } return null; } module.exports = parseExpressionTransformEnd; },{"../tokens":31}],17:[function(require,module,exports){ var Token = require('../tokens'), TransformToken = Token.tokens.transform, OperatorToken = Token.tokens.operator, utils = require('../utils'); function parseExpressionTransform(mode, code, tokens, flags, scope, parseMode) { var index = code.index, length = code.length, transform, ch = code.codePointAt(index); if (ch !== 0x0040) { /* @ */ return null; } index++; if (!utils.isHTMLIdentifierStart(code.codePointAt(index))) { return null; } transform = new TransformToken(code); for (; index < length; index++) { ch = code.codePointAt(index); if (utils.isHTMLIdentifier(ch)) { transform.name += code.charAt(index); } else { break; } } ch = code.codePointAt(index); if (ch === 0x0028) { /* ( */ index++; code.index = index; scope.push(transform); while (code.left) { var args = []; parseMode('LOGIC-ARGS', args, flags); args = utils.makeExpressionTree(args, code); if (args.length > 1) { code.index = args[1].range[0]; throw code.makeError( args[1].range[0], args[1].range[1], 'Unexpected Token: ' + JSON.stringify(args[1].source(code)) + '.' ); } transform.arguments.push(args[0]); if (transform.nextArg) { delete transform.nextArg; delete transform.closed; } if (transform.closed) { break; } } } else { return null; } return transform; } module.exports = parseExpressionTransform; },{"../tokens":31,"../utils":44}],18:[function(require,module,exports){ var Token = require('../tokens'), ValueToken = Token.tokens.value, OperatorToken = Token.tokens.operator, utils = require('../utils'); function parseExpressionValue(mode, code, tokens, flags, scope, parseMode) { var index = code.index, length = code.length, ch = code.codePointAt(index), prop = ch === 0x0040; if (!utils.isHTMLIdentifierStart(ch) && !prop ) { return null; } value = new ValueToken(code); value.path = []; if (prop) { value.path.push('@'); index++; } var name = ''; for (; index < length; index++) { ch = code.codePointAt(index); if (utils.isHTMLIdentifier(ch)) { name += code.charAt(index); } else { break; } } if (!name) { throw code.makeError( value.range[0], value.range[1], 'Unexpected Token: ' + JSON.stringify(value.source()) .slice(1, -1) ); } value.path.push(name); code.index = index; value.close(); return value; } module.exports = parseExpressionValue; },{"../tokens":31,"../utils":44}],19:[function(require,module,exports){ //parseHTMLAttrEnd function parseHTMLAttrEnd(mode, code, tokens, flags, scope, parseMode) { if (code.codePointAt(code.index) === 0x0022 /* " */ ) { code.index++; scope.close(); parseMode.close(); return true; } return null; } module.exports = parseHTMLAttrEnd; },{}],20:[function(require,module,exports){ // parseHTMLAttr var Token = require('../tokens'), AttrToken = Token.tokens.attr, PropToken = Token.tokens.prop, utils = require('../utils'); function parseHTMLAttr(mode, code, tokens, flags, scope, parseMode) { var index = code.index, length = code.length, attr; if (!utils.isHTMLIdentifierStart(code.codePointAt(index))) { return null; } attr = new AttrToken(code); prop = new PropToken(code); for (; index < length; index++) { if (!utils.isHTMLIdentifier(code.codePointAt(index))) { break; } attr.name += code.charAt(index); } prop.name = attr.name; if (attr.name) { /* = */ if (code.codePointAt(index) === 0x003d) { index++; /* " */ if (code.codePointAt(index) === 0x0022) { index++; code.index = index; scope.push(attr); flags.whitepaceString = true; parseMode('VALUE', attr.nodes, flags); delete flags.whitepaceString; } else { throw code.makeError( index, index + 1, 'Unexpected Token: Expected "\"" but found ' + JSON.stringify(code.charAt(index)) ); } } else if (code.codePointAt(index) === 0x003a) { /* : */ index++; if ( /* {{ */ code.codePointAt(index) === 0x007b && code.codePointAt(index + 1) === 0x007b ) { var args = []; code.index = index + 2; scope.push(prop); parseMode('LOGIC-EXP', args, flags); args = utils.makeExpressionTree(args, code); if (args.length > 1) { code.index = args[1].range[0]; throw code.makeError( args[1].range[0], args[1].range[1], 'Unexpected Token: ' + JSON.stringify(args[1].source(code)) + '.' ); } prop.expression = args[0]; args = null; if (!prop.closed) { throw code.makeError( code.index, code.index + 1, 'Unclosed Block: Expected ' + JSON.stringify('}}') + ' but found ' + JSON.stringify(code.charAt(code.index)) + '.' ); } if (!prop.expression) { throw code.makeError( code.index - 2, code.index - 1, 'Missing <expression>.' ); } return prop; } else { throw code.makeError( index - 1, index, 'Unexpected Token: :' ); } } else { code.index = index; attr.close(); } if (!attr.closed) { throw code.makeError( attr.range[0] + attr.name.length + 1, attr.range[0] + attr.name.length + 2, 'Unclosed String: Expected "\"" to fallow "\""' ); } if (scope.token && attr.nodesUpdate) { scope.token.updates('attr'); } return attr; } return null; } module.exports = parseHTMLAttr; },{"../tokens":31,"../utils":44}],21:[function(require,module,exports){ //parseHTMLComment function parseHTMLComment(mode, code, tokens, flags, scope, parseMode) { var index = code.index, length = code.length; if ( /* <!-- */ code.codePointAt(index) === 0x003c && code.codePointAt(++index) === 0x0021 && code.codePointAt(++index) === 0x002d && code.codePointAt(++index) === 0x002d ) { index++; for (; index < length; index++) { if ( /* --> */ code.codePointAt(index) === 0x002d && code.codePointAt(index + 1) === 0x002d && code.codePointAt(index + 2) === 0x003e ) { index += 3; code.index = index; return true; } } throw code.makeError( code.index, code.index + 4, 'Unclosed Comment: Expected "-->" to fallow "<!--".' ); } return null; } module.exports = parseHTMLComment; },{}],22:[function(require,module,exports){ // parseHTMLTagEnd function parseHTMLTagEnd(mode, code, tokens, flags, scope, parseMode) { var ch = code.codePointAt(code.index); /* > */ if (ch === 0x003e) { code.index++; scope.close(); parseMode.close(); return true; } else if ( /* /> */ ch === 0x002f && code.codePointAt(code.index + 1) === 0x003e ) { code.index += 2; var tag = scope.close(); tag.selfClosed = true; parseMode.close(); return true; } return null; } module.exports = parseHTMLTagEnd; },{}],23:[function(require,module,exports){ var Token = require('../tokens'), TagToken = Token.tokens.tag, AttrToken = Token.tokens.attr, PropToken = Token.tokens.prop, utils = require('../utils'); function parseHTMLTag(mode, code, tokens, flags, scope, parseMode) { var index = code.index, length = code.length, tag, isClosing; if ( /* < */ code.codePointAt(index) === 0x003c ) { if ( /* / */ code.codePointAt(index + 1) === 0x002f ) { isClosing = true; index++; } tag = new TagToken(code); index++; if (!utils.isHTMLIdentifierStart(code.codePointAt(index))) { throw code.makeError( index, index + 1, 'Unexpected Token: Expected <[A-Za-z]> but found ' + JSON.stringify(code.charAt(index)) + '.' ); } for (; index < length; index++) { ch = code.codePointAt(index); if (utils.isHTMLIdentifier(ch)) { tag.name += code.charAt(index); } else { break; } } code.index = index; if (isClosing) { if (ch !== 0x003e) { /* > */ throw code.makeError( index, index + 1, 'Unexpected Token: Expected ' + JSON.stringify('>') + ' but found ' + JSON.stringify(code.charAt(index)) + '.' ); } index++; code.index = index; tag.close(); if (!TagToken.isCreation(scope.token)) { throw code.makeError( tag.range[0], tag.range[1], 'Unexpected Closing Tag: ' + JSON.stringify(tag.source(code)) + '.' ); } if (scope.token.name !== tag.name) { throw code.makeError( tag.range[0], tag.range[1], 'Mismatch Closing Tag: Expected ' + JSON.stringify('</' + scope.token.name + '>') + ' but found ' + JSON.stringify(tag.source(code)) + '.' ); } scope.close(); parseMode.close(); return true; } var attrsAndProps = []; scope.push(tag); parseMode('ATTR', attrsAndProps, flags); tag.attrs = attrsAndProps.filter(function (token) { return AttrToken.isCreation(token); }); tag.props = attrsAndProps.filter(function (token) { return PropToken.isCreation(token); }); attrsAndProps = null; if (!tag.closed) { throw code.makeError( index, index + 1, 'Unclosed Tag: Expected ' + JSON.stringify('>') + ' but found ' + JSON.stringify(code.charAt(code.index)) + '.' ); } if (utils.isSelfClosing(tag.name)) { tag.selfClosing = true; } if (tag.selfClosing || tag.selfClosed) { return tag; } delete tag.closed; if (tag.name === 'pre' || tag.name === 'style' || tag.name === 'script') { flags.minify = false; } scope.push(tag); if (tag.name === 'style' || tag.name === 'script') { flags.textExitTag = tag.name; parseMode('TEXT', tag.nodes, flags); delete flags.textExitTag; } else { parseMode(mode, tag.nodes, flags); } if (!tag.closed) { throw code.makeError( tag.range[0], tag.range[1], 'Unclosed Tag: Expected ' + JSON.stringify('</' + tag.name + '>') + ' to fallow ' + JSON.stringify(tag.source(code)) + '.' ); } if (scope.token && (tag.attrsUpdate || tag.nodesUpdate)) { scope.token.updates(); } return tag; } return null; } module.exports = parseHTMLTag; },{"../tokens":31,"../utils":44}],24:[function(require,module,exports){ // text exports.parseText = require('./text'); exports.parseWhitspace = require('./whitespace'); // HTML markup exports.parseHTMLComment = require('./html-comment'); exports.parseHTMLTag = require('./html-tag'); exports.parseHTMLTagEnd = require('./html-tag-end'); exports.parseHTMLAttr = require('./html-attr'); exports.parseHTMLAttrEnd = require('./html-attr-end'); // Bars markup exports.parseBarsMarkup = require('./bars-markup'); exports.parseBarsComment = require('./bars-comment'); exports.parseBarsInsert = require('./bars-insert'); exports.parseBarsPartial = require('./bars-partial'); exports.parseBarsBlock = require('./bars-block'); exports.parseBarsMarkupEnd = require('./bars-markup-end'); // Expression exports.parseExpressionValue = require('./expression-value'); exports.parseExpressionLiteral = require('./expression-literal'); exports.parseExpressionOperator = require('./expression-operator'); exports.parseExpressionAssignment = require('./expression-assignment'); exports.parseExpressionTransform = require('./expression-transform'); exports.parseExpressionTransformEnd = require('./expression-transform-end'); },{"./bars-block":7,"./bars-comment":8,"./bars-insert":9,"./bars-markup":11,"./bars-markup-end":10,"./bars-partial":12,"./expression-assignment":13,"./expression-literal":14,"./expression-operator":15,"./expression-transform":17,"./expression-transform-end":16,"./expression-value":18,"./html-attr":20,"./html-attr-end":19,"./html-comment":21,"./html-tag":23,"./html-tag-end":22,"./text":25,"./whitespace":26}],25:[function(require,module,exports){ var TextToken = require('../tokens') .tokens.text, utils = require('../utils'); function parseText(mode, code, tokens, flags, scope, parseMode) { var index = code.index, isEntity = false, entityStr = '', value = '', textExitTag; if (mode === 'DOM') { for (; index < code.length; index++) { ch = code.codePointAt(index); if ( ch === 0x003c /* < */ || ch === 0x007b /* { */ && code.codePointAt(index + 1) === 0x007b /* { */ ) { value += entityStr; break; } if (ch === 0x0026 /* & */ ) { isEntity = true; entityStr = code.charAt(index); continue; } else if (isEntity && ch === 0x003b /* ; */ ) { entityStr += code.charAt(index); value += utils.getHTMLUnEscape(entityStr); isEntity = false; entityStr = ''; continue; } if (isEntity && utils.isHTMLEntity(ch)) { entityStr += code.charAt(index); } else { value += entityStr; isEntity = false; entityStr = ''; value += code.charAt(index); } } } else if (flags.whitepaceString) { for (; index < code.length; index++) { ch = code.codePointAt(index); /* \n */ if (ch === 0x000a) { code.index = index; return null; } if ( /* " but not \" */ ch === 0x0022 && code.codePointAt(index - 1) !== 0x005c ) { break; } if ( /* {{ */ ch === 0x007b && code.codePointAt(index + 1) === 0x007b ) { break; } } } else { for (; index < code.length; index++) { if ( code.codePointAt(index) === 0x007b /* { */ && code.codePointAt(index + 1) === 0x007b /* { */ ) { break; } else if ( flags.textExitTag === 'script' && /* </script> */ code.codePointAt(index) === 0x003c && code.codePointAt(index + 1) === 0x002f && code.codePointAt(index + 2) === 0x0073 && code.codePointAt(index + 3) === 0x0063 && code.codePointAt(index + 4) === 0x0072 && code.codePointAt(index + 5) === 0x0069 && code.codePointAt(index + 6) === 0x0070 && code.codePointAt(index + 7) === 0x0074 && code.codePointAt(index + 8) === 0x003e ) { textExitTag = 9; break; } else if ( flags.textExitTag === 'style' && /* </style> */ code.codePointAt(index) === 0x003c && code.codePointAt(index + 1) === 0x002f && code.codePointAt(index + 2) === 0x0073 && code.codePointAt(index + 3) === 0x0074 && code.codePointAt(index + 4) === 0x0079 && code.codePointAt(index + 5) === 0x006c && code.codePointAt(index + 6) === 0x0065 && code.codePointAt(index + 7) === 0x003e ) { textExitTag = 8; break; } } } if (code.index < index) { var text = new TextToken(code); code.index = index; text.close(); if (flags.minify) { text.value = utils.minifyHTMLText(value || text.source(code)); if (/^\s*$/.test(text.value)) return true; } else { text.value = value || text.source(code); } if (flags.textExitTag && textExitTag) { code.index += textExitTag; scope.close(); parseMode.close(); } return text; } else if (flags.textExitTag && textExitTag) { code.index += textExitTag; scope.close(); parseMode.close(); } return null; } module.exports = parseText; },{"../tokens":31,"../utils":44}],26:[function(require,module,exports){ // parseWhitspace var utils = require('../utils'); function parseWhitspace(mode, code, tokens, flags, scope, parseMode) { var index = code.index, length = code.length, whitespace = 0; for (; index < length; index++) { if (!utils.isWhitespace(code.codePointAt(index))) { break; } if ( flags.whitepaceString && code.codePointAt(index) === 0x000a /* \n */ ) { break; } whitespace++; } if (whitespace) { code.index = index; return true; } return null; } module.exports = parseWhitspace; },{"../utils":44}],27:[function(require,module,exports){ var Token = require('./token'); var AssignmentToken = Token.generate( function AssignmentToken(code) { var _ = this; if (code) { Token.call(_, code); } _.name = ''; _.expression = null; } ); AssignmentToken.definePrototype({ enumerable: true }, { type: 'assignment' }); AssignmentToken.definePrototype({ TYPE_ID: Token.tokens.push(AssignmentToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.name, _.expression ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, name: _.name, expression: _.expression }; }, _fromArray: function _fromArray(arr) { var _ = this; _.name = arr[1]; _.expression = new Token.tokens[arr[2][0]](); _.expression.fromArray(arr[2]); }, toString: function toString() { // var _ = this, // str = ''; // // if (_.operands.length === 1) { // str += _.assignment + _.operands[0].toString(); // } else if (_.operands.length === 2) { // str += _.operands[0].toString(); // str += ' ' + _.assignment + ' '; // str += _.operands[1].toString(); // } // // return str; } }); Token.tokens.assignment = AssignmentToken; },{"./token":40}],28:[function(require,module,exports){ var Token = require('./token'); var AttrToken = Token.generate( function AttrToken(code) { var _ = this; if (code) { Token.call(_, code); } _.name = ''; _.nodes = []; _.nodesUpdate = 0; } ); AttrToken.definePrototype({ enumerable: true }, { type: 'attr' }); AttrToken.definePrototype({ TYPE_ID: Token.tokens.push(AttrToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.name, _.nodes, _.nodesUpdate ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, name: _.name, nodes: _.nodes, nodesUpdate: _.nodesUpdate }; }, _fromArray: function _fromArray(arr) { var _ = this; _.name = arr[1]; _.nodes = arr[2].map(function (item) { var node = new Token.tokens[item[0]](); node.fromArray(item); return node; }); _.nodesUpdate = arr[3]; }, toString: function toString() { var _ = this, str = ' '; str += _.name + (_.nodes.length ? '="' : ''); for (var i = 0; i < _.nodes.length; i++) { _.nodes[i].indentLevel = ''; str += _.nodes[i].toString(); } str += (_.nodes.length ? '"' : ''); return str; }, updates: function updates() { var _ = this; _.nodesUpdate = 1; } }); Token.tokens.attr = AttrToken; },{"./token":40}],29:[function(require,module,exports){ var Token = require('./token'); var BlockToken = Token.generate( function BlockToken(code) { var _ = this; if (code) { Token.call(_, code); } _.name = ''; _.arguments = null; _.map = null; _.consequent = null; _.alternate = null; } ); BlockToken.definePrototype({ enumerable: true }, { type: 'block' }); BlockToken.definePrototype({ TYPE_ID: Token.tokens.push(BlockToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.name, _.arguments, _.map, _.consequent, _.alternate ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, name: _.name, arguments: _.arguments, map: _.map, consequent: _.consequent, alternate: _.alternate }; }, _fromArray: function _fromArray(arr) { var _ = this; _.name = arr[1]; _.arguments = arr[2].map(function (item) { var arg = new Token.tokens[item[0]](); arg.fromArray(item); return arg; }); _.map = arr[3].map(function (item) { var arg = new Token.tokens[item[0]](); arg.fromArray(item); return arg; }); var consequent = new Token.tokens.fragment(); consequent.fromArray(arr[4]); _.consequent = consequent; if (arr[5]) { var alternate = new Token.tokens[arr[5][0]](); alternate.fromArray(arr[5]); _.alternate = alternate; } }, toString: function toString() { var _ = this, str = ''; if (!_.fromElse) { str += _.indentLevel + '{{#'; } str += _.name + ' '; str += _.expression.toString(); str += (_.map ? _.map.toString() : ''); str += '}}'; _.consequent.indentLevel = (_.indentLevel ? _.indentLevel + ' ' : ''); str += _.consequent.toString(); if (_.alternate) { _.alternate.indentLevel = _.indentLevel; if (_.alternate.type === 'block') { _.alternate.fromElse = true; str += _.indentLevel + '{{else ' + _.alternate.toString(); return str; } _.alternate.indentLevel += (_.indentLevel ? _.indentLevel + ' ' : ''); str += _.indentLevel + '{{else}}'; str += _.alternate.toString(); } str += _.indentLevel + '{{/' + _.name + '}}'; return str; }, updates: function updates() { var _ = this; if (_.elsed && _.alternate) { _.alternate.nodesUpdate = 1; } else if (_.consequent) { _.consequent.nodesUpdate = 1; } } }); Token.tokens.block = BlockToken; },{"./token":40}],30:[function(require,module,exports){ var Token = require('./token'); var FragmentToken = Token.generate( function FragmentToken(code) { var _ = this; if (code) { Token.call(_, code); } _.nodes = []; _.nodesUpdate = 0; } ); FragmentToken.definePrototype({ enumerable: true }, { type: 'fragment' }); FragmentToken.definePrototype({ TYPE_ID: Token.tokens.push(FragmentToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.nodes, _.nodesUpdate ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, nodes: _.nodes, nodesUpdate: _.nodesUpdate }; }, _fromArray: function _fromArray(arr) { var _ = this; _.nodes = arr[1].map(function (item) { var node = new Token.tokens[item[0]](); node.fromArray(item); return node; }); _.nodesUpdate = arr[2]; }, toString: function toString() { var _ = this, str = ''; for (var i = 0; i < _.nodes.length; i++) { _.nodes[i].indentLevel = _.indentLevel; str += _.nodes[i].toString(); } return str; }, updates: function updates() { var _ = this; _.nodesUpdate = 1; } }); Token.tokens.fragment = FragmentToken; },{"./token":40}],31:[function(require,module,exports){ var Token = require('./token'); // program require('./program'); require('./fragment'); // html markup require('./text'); require('./tag'); require('./attr'); require('./prop'); // bars markup require('./block'); require('./insert'); require('./partial'); // bars expression require('./literal'); require('./value'); require('./transform'); require('./operator'); // context-maps require('./assignment'); module.exports = Token; // module.exports = window.Token = Token; // test // var prog = new Token.tokens.program(); // // prog.fragment = new Token.tokens.fragment(); // // for (var i = 0; i < 5; i++) { // prog.fragment.nodes.push(new Token.tokens.tag()); // } // window.prog = prog; },{"./assignment":27,"./attr":28,"./block":29,"./fragment":30,"./insert":32,"./literal":33,"./operator":34,"./partial":35,"./program":36,"./prop":37,"./tag":38,"./text":39,"./token":40,"./transform":41,"./value":42}],32:[function(require,module,exports){ var Token = require('./token'); var InsertToken = Token.generate( function InsertToken(code) { var _ = this; if (code) { Token.call(_, code); } _.expression = null; } ); InsertToken.definePrototype({ enumerable: true }, { type: 'insert' }); InsertToken.definePrototype({ TYPE_ID: Token.tokens.push(InsertToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.expression ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, expression: _.expression }; }, _fromArray: function _fromArray(arr) { var _ = this; var expression = new Token.tokens[arr[1][0]](); expression.fromArray(arr[1]); _.expression = expression; }, toString: function toString() { var _ = this, str = '{{ '; str += _.expression.toString(); str += ' }}'; return str; } }); Token.tokens.insert = InsertToken; },{"./token":40}],33:[function(require,module,exports){ var Token = require('./token'); var LiteralToken = Token.generate( function LiteralToken(code) { var _ = this; if (code) { Token.call(_, code); } _.value = ''; } ); LiteralToken.definePrototype({ enumerable: true }, { type: 'literal' }); LiteralToken.definePrototype({ TYPE_ID: Token.tokens.push(LiteralToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.value ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, value: _.value }; }, _fromArray: function _fromArray(arr) { var _ = this; _.value = arr[1]; }, toString: function toString() { var _ = this, str = ''; str += _.value; return str; } }); Token.tokens.literal = LiteralToken; },{"./token":40}],34:[function(require,module,exports){ var Token = require('./token'); var OperatorToken = Token.generate( function OperatorToken(code) { var _ = this; if (code) { Token.call(_, code); } _.operator = ''; _.operands = []; } ); OperatorToken.definePrototype({ enumerable: true }, { type: 'operator' }); OperatorToken.definePrototype({ TYPE_ID: Token.tokens.push(OperatorToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.operator, _.operands ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, operator: _.operator, operands: _.operands }; }, _fromArray: function _fromArray(arr) { var _ = this; _.operator = arr[1]; _.operands = arr[2].map(function (item) { var arg = new Token.tokens[item[0]](); arg.fromArray(item); return arg; }); }, toString: function toString() { var _ = this, str = ''; if (_.operands.length === 1) { str += _.operator + _.operands[0].toString(); } else if (_.operands.length === 2) { str += _.operands[0].toString(); str += ' ' + _.operator + ' '; str += _.operands[1].toString(); } return str; } }); Token.tokens.operator = OperatorToken; Token; },{"./token":40}],35:[function(require,module,exports){ var Token = require('./token'); var PartialToken = Token.generate( function PartialToken(code) { var _ = this; if (code) { Token.call(_, code); } _.name = ''; _.expression = null; _.map = null; } ); PartialToken.definePrototype({ enumerable: true }, { type: 'partial' }); PartialToken.definePrototype({ TYPE_ID: Token.tokens.push(PartialToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.name, _.expression, _.map ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, name: _.name, expression: _.expression, map: _.map }; }, _fromArray: function _fromArray(arr) { var _ = this; _.name = arr[1]; if (arr[2]) { var expression = new Token.tokens[arr[2][0]](); expression.fromArray(arr[2]); _.expression = expression; } _.map = arr[3].map(function (item) { var arg = new Token.tokens[item[0]](); arg.fromArray(item); return arg; }); }, toString: function toString() { var _ = this, str = _.indentLevel + '{{>' + _.name; str += (_.expression ? ' ' + _.expression.toString() : ''); str += '}}'; return str; } }); Token.tokens.partial = PartialToken; },{"./token":40}],36:[function(require,module,exports){ var Token = require('./token'); var PACKAGE_JSON = require('../../../package'); var ProgramToken = Token.generate( function ProgramToken(code) { var _ = this; if (code) { Token.call(_, code); } _.version = PACKAGE_JSON.version; _.mode = ''; _.fragment = null; } ); ProgramToken.definePrototype({ enumerable: true }, { type: 'program' }); ProgramToken.definePrototype({ writable: true }, { indentLevel: '\n' }); ProgramToken.definePrototype({ TYPE_ID: Token.tokens.push(ProgramToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.version, _.mode, _.fragment ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, version: _.version, mode: _.mode, fragment: _.fragment }; }, _fromArray: function _fromArray(arr) { var _ = this; _.version = arr[1]; _.mode = arr[2]; var fragment = new Token.tokens.fragment(); fragment.fromArray(arr[3]); _.fragment = fragment; }, toString: function toString() { var _ = this; _.fragment.indentLevel = _.indentLevel; return _.fragment.toString() .trim() + '\n'; } }); Token.tokens.program = ProgramToken; },{"../../../package":95,"./token":40}],37:[function(require,module,exports){ var Token = require('./token'); var PropToken = Token.generate( function PropToken(code) { var _ = this; if (code) { Token.call(_, code); } _.name = ''; _.expression = null; } ); PropToken.definePrototype({ enumerable: true }, { type: 'prop' }); PropToken.definePrototype({ TYPE_ID: Token.tokens.push(PropToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.name, _.expression ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, name: _.name, expression: _.expression }; }, _fromArray: function _fromArray(arr) { var _ = this; _.name = arr[1]; var expression = new Token.tokens[arr[2][0]](); expression.fromArray(arr[2]); _.expression = expression; }, toString: function toString() { var _ = this, str = _.name + ':{{ '; str += _.expression.toString(); str += ' }}'; return str; } }); Token.tokens.prop = PropToken; },{"./token":40}],38:[function(require,module,exports){ var Token = require('./token'); var TagToken = Token.generate( function TagToken(code) { var _ = this; if (code) { Token.call(_, code); } _.name = ''; _.attrs = []; _.props = []; _.nodes = []; _.attrsUpdate = 0; _.nodesUpdate = 0; } ); TagToken.definePrototype({ enumerable: true }, { type: 'tag' }); TagToken.definePrototype({ TYPE_ID: Token.tokens.push(TagToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.name, _.attrs, _.attrsUpdate, _.nodes, _.nodesUpdate, _.props ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, name: _.name, attrs: _.attrs, attrsUpdate: _.attrsUpdate, nodes: _.nodes, nodesUpdate: _.nodesUpdate, props: _.props }; }, _fromArray: function _fromArray(arr) { var _ = this; _.name = arr[1]; _.attrs = arr[2].map(function (item) { var attr = new Token.tokens[item[0]](); attr.fromArray(item); return attr; }); _.attrsUpdate = arr[3]; _.nodes = arr[4].map(function (item) { var node = new Token.tokens[item[0]](); node.fromArray(item); return node; }); _.nodesUpdate = arr[5]; _.props = arr[6].map(function (item) { var prop = new Token.tokens[item[0]](); prop.fromArray(item); return prop; }); }, toString: function toString() { var _ = this, str = _.indentLevel + '<' + _.name; for (var i = 0; i < _.attrs.length; i++) { str += _.attrs[i].toString(); } if (_.selfClosed) { str += (_.attrs.length ? ' ' : '') + '/>';  return str; } str += '>';  if (_.selfClosing) { return str; } var nodes = ''; for (i = 0; i < _.nodes.length; i++) { _.nodes[i].indentLevel = (_.indentLevel ? _.indentLevel + ' ' : ''); nodes += _.nodes[i].toString(); } str += nodes.trim(); str += _.indentLevel + '</' + _.name + '>'; return str; }, updates: function updates(type) { var _ = this; if (type === 'attr') { _.attrsUpdate = 1; } else { _.nodesUpdate = 1; } } }); Token.tokens.tag = TagToken; },{"./token":40}],39:[function(require,module,exports){ var Token = require('./token'); var TextToken = Token.generate( function TextToken(code) { var _ = this; if (code) { Token.call(_, code); } _.value = ''; } ); TextToken.definePrototype({ enumerable: true }, { type: 'text' }); TextToken.definePrototype({ TYPE_ID: Token.tokens.push(TextToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.value ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, value: _.value }; }, _fromArray: function _fromArray(arr) { var _ = this; _.value = arr[1]; }, toString: function toString() { var _ = this, str = ''; str += _.indentLevel + _.value; return str; } }); Token.tokens.text = TextToken; },{"./token":40}],40:[function(require,module,exports){ var Token = require('compileit') .Token; var BarsToken = Token.generate( function BarsToken(code, type) { Token.call(this, code, type); } ); BarsToken.tokens = []; BarsToken.definePrototype({ writable: true }, { indentLevel: '', JSONuseObject: true }); BarsToken.definePrototype({ TYPE_ID: -1, toJSON: function toJSON(arr) { if (this.JSONuseObject) return this.toObject(); return this.toArray(); }, toArray: function toArray() { var _ = this; console.warn('toArray not impleneted.'); return [-1]; }, toObject: function toObject() { var _ = this; console.warn('toObject not impleneted.'); return { type: _.type, TYPE_ID: _.TYPE_ID }; }, fromArray: function fromArray(arr) { var _ = this; if (arr[0] !== _.TYPE_ID) { throw 'TypeMismatch: ' + arr[0] + ' is not ' + _.TYPE_ID; } _._fromArray(arr); }, updates: function updates() { var _ = this; console.warn('updates not impleneted.'); } }); module.exports = BarsToken; },{"compileit":56}],41:[function(require,module,exports){ var Token = require('./token'); var TransformToken = Token.generate( function TransformToken(code) { var _ = this; if (code) { Token.call(_, code); } _.name = ''; _.arguments = []; } ); TransformToken.definePrototype({ enumerable: true }, { type: 'transform' }); TransformToken.definePrototype({ TYPE_ID: Token.tokens.push(TransformToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.name, _.arguments ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, name: _.name, arguments: _.arguments }; }, _fromArray: function _fromArray(arr) { var _ = this; _.name = arr[1]; _.arguments = arr[2].map(function (item) { var arg = new Token.tokens[item[0]](); arg.fromArray(item); return arg; }); }, toString: function toString() { var _ = this, str = '@'; str += _.name + '('; for (var i = 0; i < _.arguments.length; i++) { str += _.arguments[i].toString() + (i + 1 < _.arguments .length ? ', ' : ''); } str += ')'; return str; } }); Token.tokens.transform = TransformToken; },{"./token":40}],42:[function(require,module,exports){ var Token = require('./token'); var ValueToken = Token.generate( function ValueToken(code) { var _ = this; if (code) { Token.call(_, code); } _.path = ''; } ); ValueToken.definePrototype({ enumerable: true }, { type: 'value' }); ValueToken.definePrototype({ TYPE_ID: Token.tokens.push(ValueToken) - 1, toArray: function () { var _ = this; return [ _.TYPE_ID, _.path ]; }, toObject: function () { var _ = this; return { type: _.type, TYPE_ID: _.TYPE_ID, path: _.path }; }, _fromArray: function _fromArray(arr) { var _ = this; _.path = arr[1]; }, toString: function toString() { var _ = this, str = ''; if ( _.path[0] === '~' || _.path[0] === '..' || _.path[0] === '.' || _.path[0] === '@' ) { str += _.path.join('/'); } else { str += _.path.join('.'); } return str; } }); Token.tokens.value = ValueToken; },{"./token":40}],43:[function(require,module,exports){ module.exports={ "quot": 34, "amp": 38, "lt": 60, "gt": 62, "nbsp": 160, "iexcl": 161, "cent": 162, "pound": 163, "curren": 164, "yen": 165, "brvbar": 166, "sect": 167, "uml": 168, "copy": 169, "ordf": 170, "laquo": 171, "not": 172, "shy": 173, "reg": 174, "macr": 175, "deg": 176, "plusmn": 177, "sup2": 178, "sup3": 179, "acute": 180, "micro": 181, "para": 182, "middot": 183, "cedil": 184, "sup1": 185, "ordm": 186, "raquo": 187, "frac14": 188, "frac12": 189, "frac34": 190, "iquest": 191, "Agrave": 192, "Aacute": 193, "Acirc": 194, "Atilde": 195, "Auml": 196, "Aring": 197, "AElig": 198, "Ccedil": 199, "Egrave": 200, "Eacute": 201, "Ecirc": 202, "Euml": 203, "Igrave": 204, "Iacute": 205, "Icirc": 206, "Iuml": 207, "ETH": 208, "Ntilde": 209, "Ograve": 210, "Oacute": 211, "Ocirc": 212, "Otilde": 213, "Ouml": 214, "times": 215, "Oslash": 216, "Ugrave": 217, "Uacute": 218, "Ucirc": 219, "Uuml": 220, "Yacute": 221, "THORN": 222, "szlig": 223, "agrave": 224, "aacute": 225, "acirc": 226, "atilde": 227, "auml": 228, "aring": 229, "aelig": 230, "ccedil": 231, "egrave": 232, "eacute": 233, "ecirc": 234, "euml": 235, "igrave": 236, "iacute": 237, "icirc": 238, "iuml": 239, "eth": 240, "ntilde": 241, "ograve": 242, "oacute": 243, "ocirc": 244, "otilde": 245, "ouml": 246, "divide": 247, "oslash": 248, "ugrave": 249, "uacute": 250, "ucirc": 251, "uuml": 252, "yacute": 253, "thorn": 254, "euro": 8364 } },{}],44:[function(require,module,exports){ var SELF_CLOSEING_TAGS = require('./self-closing-tags'); var ENTITIES = require('./html-entities'); var Token = require('../tokens'), AssignmentToken = Token.tokens.assignment, LiteralToken = Token.tokens.literal, ValueToken = Token.tokens.value, OperatorToken = Token.tokens.operator; function pathSpliter(path) { var splitPath; if (path instanceof Array) { splitPath = path; } else if (typeof path === 'string') { if (path.match(/[/]|[.][.]/)) { splitPath = path.split('/'); } else { splitPath = path.split('.'); } if (!splitPath[0] && !splitPath[1]) { splitPath = ['.']; } var barsProp = splitPath.pop() .split('@'); if (barsProp[0]) { splitPath.push(barsProp[0]); } if (barsProp[1]) { splitPath.push('@' + barsProp[1]); } } else { throw 'bad arrgument: expected String | Array<String>.'; } return splitPath; } exports.pathSpliter = pathSpliter; function isSelfClosing(name) { return SELF_CLOSEING_TAGS.indexOf(name) !== -1; } exports.isSelfClosing = isSelfClosing; function isHTMLIdentifierStart(ch) { return (0x0041 <= ch && ch <= 0x005a) || (0x0061 <= ch && ch <= 0x007a); } exports.isHTMLIdentifierStart = isHTMLIdentifierStart; function isHTMLEntity(ch) { /* ^[0-9A-Za-z]$ */ return (0x0030 <= ch && ch <= 0x0039) || (0x0041 <= ch && ch <= 0x005a) || (0x0061 <= ch && ch <= 0x007a); } exports.isHTMLEntity = isHTMLEntity; function isHTMLIdentifier(ch) { /* ^[0-9A-Z_a-z-]$ */ return ch === 0x002d || (0x0030 <= ch && ch <= 0x0039) || (0x0041 <= ch && ch <= 0x005a) || ch === 0x005f || (0x0061 <= ch && ch <= 0x007a); } exports.isHTMLIdentifier = isHTMLIdentifier; function isWhitespace(ch) { /* ^\s$ */ return (0x0009 <= ch && ch <= 0x000d) || ch === 0x0020 || ch === 0x00a0 || /* nbsp */ ch === 0x1680 || ch === 0x180e || (0x2000 <= ch && ch <= 0x200a) || (0x2028 <= ch && ch <= 0x2029) || ch === 0x202f || ch === 0x205f || ch === 0x3000 || ch === 0xfeff; } exports.isWhitespace = isWhitespace; function minifyHTMLText(text) { return text.replace(/(\s*)/g, function ($1) { return $1.split('') .sort(function (a, b) { a = a.codePointAt(0); b = b.codePointAt(0); if (a !== 0x00a0 && b === 0x00a0) return 1; if (a === 0x00a0 && b !== 0x00a0) return -1; return 0; }) .join('') .replace(/[^\u00a0]+/, ' '); }); } exports.minifyHTMLText = minifyHTMLText; function getHTMLUnEscape(str) { var code; code = ENTITIES[str.slice(1, -1)]; if (typeof code !== 'number' && str[1] === '#') { code = parseInt(str.slice(2, -1), 0x000a); } if (typeof code === 'number' && !isNaN(code)) { return String.fromCharCode(code); } return str; } exports.getHTMLUnEscape = getHTMLUnEscape; var OpPresidence = { dm: ['/', '%', '*'], as: ['+', '-'], c: ['===', '==', '!==', '!=', '<=', '>=', '>', '<'], ao: ['||', '&&'], co: ['?:'] }; function lookupExpression(tokens, code) { for (var i = 0; i < tokens.length; i++) { prevToken = tokens[i - 1]; token = tokens[i]; nextToken = tokens[i + 1]; var dels = 3; if ( OperatorToken.isCreation(token) && token.operator === '.' && !token.saturated ) { if (!OperatorToken.isCreation(prevToken) || prevToken.saturated ) { token.operands.unshift(prevToken); if (token.operands.length === 1) { if (isName(nextToken)) { var lit = new LiteralToken(code); lit.range = nextToken.range; lit.loc = nextToken.loc; lit.value = nextToken.path[0]; lit.closed = true; token.operands.push(lit); } else { throw code.makeError( token.range[0], token.range[2], 'Unexpected token: ' + JSON.stringify(token.source()) .slice(1, -1) ); } } else { dels = 2; } } else { throw code.makeError( token.range[0], token.range[2], 'Unexpected token: ' + JSON.stringify(token.source()) .slice(1, -1) ); } token.saturated = true; tokens.splice(Math.max(0, i - 1), dels, token); i--; } } } function unaryExpression(tokens, code) { for (var i = tokens.length - 1; i >= 0; i--) { token = tokens[i]; nextToken = tokens[i + 1]; if ( OperatorToken.isCreation(token) && token.operator === '!' ) { if (!OperatorToken.isCreation(nextToken) || nextToken.saturated ) { token.operands.push(nextToken); } else { console.log(token); throw code.makeError( token.range[0], token.range[2], 'Unexpected token: ' + JSON.stringify(token.source()) .slice(1, -1) ); } token.saturated = true; tokens.splice(i, 2, token); } } } function binaryExpression(tokens, key, code) { for (var i = 0; i < tokens.length; i++) { prevToken = tokens[i - 1]; token = tokens[i]; nextToken = tokens[i + 1]; // console.log( // i, '\n', // prevToken && prevToken.constructor.name, // token && token.constructor.name, // nextToken && nextToken.constructor.name // ); if ( OperatorToken.isCreation(token) && !token.saturated && OpPresidence[key].indexOf(token.operator) !== -1 ) { if (!OperatorToken.isCreation(prevToken) || prevToken.saturated ) { token.operands.unshift(prevToken); if (!OperatorToken.isCreation(nextToken) || nextToken.saturated ) { token.operands.push(nextToken); } else { throw code.makeError( token.range[0], token.range[2], 'Unexpected token: ' + JSON.stringify(token.source()) .slice(1, -1) ); } } else { throw code.makeError( token.range[0], token.range[2], 'Unexpected token: ' + JSON.stringify(token.source()) .slice(1, -1) ); } token.saturated = true; tokens.splice(i - 1, 3, token); i--; } } } function makeExpressionTree(tokens, code) { lookupExpression(tokens, code); unaryExpression(tokens, code); for (var key in OpPresidence) { if (OpPresidence.hasOwnProperty(key)) { binaryExpression(tokens, key, code); } } // console.log(tokens[0], expressionTree(tokens[0])); return tokens; } exports.makeExpressionTree = makeExpressionTree; function isName(token) { return ValueToken.isCreation(token) && token.path.length === 1 && token.path[0] !== 'this' && token.path[0] !== '~' && token.path[0] !== '..' && token.path[0] !== '.' && token.path[0] !== '@'; } function sortArgsAndContextMap(tokens, code) { var i, temp = [], prevToken, token, nextToken; for (i = 0; i < tokens.length; i++) { prevToken = tokens[i - 1]; token = tokens[i]; nextToken = tokens[i + 1]; if ( AssignmentToken.isCreation(token) ) { if (isName(prevToken)) { token.name = prevToken.path[0]; if (!AssignmentToken.isCreation(nextToken)) { token.expression = nextToken; } else { throw code.makeError( token.range[0], token.range[2], 'Unexpected token: ' + JSON.stringify(token.source()) .slice(1, -1) ); } } else { throw code.makeError( token.range[0], token.range[2], 'Unexpected token: ' + JSON.stringify(token.source()) .slice(1, -1) ); } tokens.splice(i - 1, 3, token); } } var map = []; var args = []; for (i = 0; i < tokens.length; i++) { if (AssignmentToken.isCreation(tokens[i])) { map.push(tokens[i]); } else { args.push(tokens[i]); } } return { args: args, map: map }; } exports.sortArgsAndContextMap = sortArgsAndContextMap; function expressionTree(op, d) { d = d || 0; if (!op) return ''; var s = ''; s += (op.operator || op.value || op.name || op.path.join()) + '\n'; if (op.operator) { d += 2; var sp = (new Array(d + 1)) .join(' '); s += sp; s += expressionTree(op.operands[0], d); if (op.operands[1]) { s += sp; s += expressionTree(op.operands[1], d); } if (op.operands[2]) { s += sp; s += expressionTree(op.operands[2], d); } } return s; } },{"../tokens":31,"./html-entities":43,"./self-closing-tags":45}],45:[function(require,module,exports){ module.exports=[ "area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr" ] },{}],46:[function(require,module,exports){ module.exports = require('./bars'); },{"./bars":3}],47:[function(require,module,exports){ var h = require('virtual-dom/h'); var execute = require('../runtime/execute'); function makeVars(context, map, bars) { var vars = {}; for (var i = 0; i < map.length; i++) { vars[map[i].name] = execute(map[i].expression, bars.transforms, context); } // console.log(vars); return vars; } function renderTextNode(bars, struct, context) { return struct.value; } var PROP_MAP = { 'class': 'className' }; function renderAttrsAndProps(bars, struct, context) { var i, _data = {}, props = {}, attrs = {}; function get(name) { return _data[name]; } props.data = get; for (i = 0; i < struct.attrs.length; i++) { var attr = struct.attrs[i]; attrs[attr.name] = renderChildrenTexts(bars, attr, context); } for (i = 0; i < struct.props.length; i++) { _data[struct.props[i].name] = execute(struct.props[i].expression, bars.transforms, context); } props.attributes = attrs; // var key = context.lookup(['@', 'key']); // props.key = /[^0-9]/.test(key) ? key : context.lookup(['id']); What is this supposed to do? return props; } function renderInsert(bars, struct, context) { return execute(struct.expression, bars.transforms, context); } function renderChildrenTexts(bars, struct, context) { var children = []; if (!struct || !struct.nodes) return children.join(''); for (var i = 0; i < struct.nodes.length; i++) { var child = struct.nodes[i]; if (child.type === 'text') { children.push(child.value); } else if (child.type === 'insert') { children.push(renderInsert(bars, child, context)); } else if (child.type === 'block') { children.push(renderBlockAsTexts(bars, child, context)); } } return children.join(''); } function renderBlockAsTexts(bars, struct, context) { var nodes = []; function consequent(new_context) { new_context = new_context || context; new_context = new_context.contextWithVars(makeVars(new_context, struct.map, bars)); nodes.push(renderTypeAsTexts(bars, struct.consequent, new_context)); } function alternate(new_context) { if (new_context) { new_context = new_context.contextWithVars(makeVars(new_context, struct.map, bars)); } nodes.push(renderTypeAsTexts(bars, struct.alternate, new_context || context)); } var blockFunc = bars.blocks[struct.name]; if (typeof blockFunc !== 'function') { throw 'Bars Error: Missing Block helper: ' + struct.name; } blockFunc( struct.arguments.map(function (expression) { return execute(expression, bars.transforms, context); }), consequent, alternate, context ); return nodes.join(''); } function renderBlockAsNodes(bars, struct, context) { var nodes = []; function consequent(new_context) { new_context = new_context || context; new_context = new_context.contextWithVars(makeVars(new_context, struct.map, bars)); nodes = nodes.concat(renderTypeAsNodes(bars, struct.consequent, new_context)); } function alternate(new_context) { if (new_context) { new_context = new_context.contextWithVars(makeVars(new_context, struct.map, bars)); } nodes = nodes.concat(renderTypeAsNodes(bars, struct.alternate, new_context || context)); } var blockFunc = bars.blocks[struct.name]; if (typeof blockFunc !== 'function') { throw 'Bars Error: Missing Block helper: ' + struct.name; } blockFunc( struct.arguments.map(function (expression) { return execute(expression, bars.transforms, context); }), consequent, alternate, context ); return nodes; } function renderPartial(bars, struct, context) { var name = struct.name; if (typeof struct.name === 'object') { name = execute(struct.name, bars.transforms, context); } var partial = bars.partials[name]; if (!partial) { throw 'Bars Error: Missing Partial: ' + name; } var newContext = context; if (struct.expression) { newContext = newContext.newContext( execute(struct.expression, bars.transforms, context), null, true ); } newContext = newContext.contextWithVars(makeVars(context, struct.map, bars)); return renderChildrenNodes(bars, partial.fragment, newContext); } function renderChildrenNodes(bars, struct, context) { var children = []; if (!struct || !struct.nodes) return children; for (var i = 0; i < struct.nodes.length; i++) { var child = struct.nodes[i]; if (child.type === 'tag') { children.push(renderTagNode(bars, child, context)); } else if (child.type === 'text') { children.push(renderTextNode(bars, child, context)); } else if (child.type === 'insert') { children.push(renderInsert(bars, child, context)); } else if (child.type === 'block') { children = children.concat(renderBlockAsNodes(bars, child, context)); } else if (child.type === 'partial') { children = children.concat(renderPartial(bars, child, context)); } } return children; } function renderTagNode(bars, struct, context) { return h( struct.name, renderAttrsAndProps(bars, struct, context), renderChildrenNodes(bars, struct, context) ); } function renderTypeAsNodes(bars, struct, context) { if (!struct) return []; if (struct.type === 'tag') { return [renderTagNode(bars, struct, context)]; } else if (struct.type === 'text') { return [renderTextNode(bars, struct, context)]; } else if (struct.type === 'insert') { return [renderInsert(bars, struct, context)]; } else if (struct.type === 'block') { return renderBlockAsNodes(bars, struct, context); } else if (struct.type === 'fragment') { return renderChildrenNodes(bars, struct, context); } else if (struct.type === 'partial') { return renderPartial(bars, struct, context); } throw 'Bars Error: unknown type: ' + struct.type; } function renderTypeAsTexts(bars, struct, context) { if (!struct) return []; if (struct.type === 'text') { return struct.value; } else if (struct.type === 'insert') { return renderInsert(bars, struct, context); } else if (struct.type === 'block') { return renderBlockAsTexts(bars, struct, context); } else if (struct.type === 'fragment') { return renderChildrenTexts(bars, struct, context); } throw 'Bars Error: unknown type: ' + struct.type; } function render(bars, struct, context, noRender) { return h( 'div', noRender ? [] : renderChildrenNodes(bars, struct.fragment, context) ); } module.exports = render; },{"../runtime/execute":51,"virtual-dom/h":70}],48:[function(require,module,exports){ var execute = require('../runtime/execute'); function makeVars(context, map, bars) { var vars = {}; for (var i = 0; i < map.length; i++) { vars[map[i].name] = execute(map[i].expression, bars.transforms, context); } // console.log(vars); return vars; } function repeat(a, n) { n = n || 0; var r = ''; for (var i = 0; i < n; i++) { r += a; } return r; } function abb(token, indentWith, bars, context) { var r = ''; function consequent(new_context) { new_context = new_context || context; new_context = new_context.contextWithVars(makeVars(new_context, token.map, bars)); r += ac(token.consequent.nodes, indentWith, bars, new_context); } function alternate(new_context) { if (new_context) { new_context = new_context.contextWithVars(makeVars(new_context, token.map, bars)); } r += ac(token.alternate.nodes, indentWith, bars, new_context || context); } var blockFunc = bars.blocks[token.name]; if (typeof blockFunc !== 'function') { throw 'Bars Error: Missing Block helper: ' + token.name; } blockFunc( token.arguments.map(function (expression) { return execute(expression, bars.transforms, context); }), consequent, alternate, context ); return r; } function ac(tokens, indentWith, bars, context) { if (tokens.length === 0) { return ''; } var r = '="'; for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; if (token.type === 'text') { r += token.value; } else if (token.type === 'insert') { var val = execute(token.expression, bars.transforms, context); r += val !== void(0) ? val : ''; } else if (token.type === 'block') { r += abb(token, indentWith, bars, context); } } r += '"'; return r; } function a(token, indentWith, bars, context) { var r = ' '; r += token.name; r += ac(token.nodes, indentWith, bars, context); return r; } function hbb(token, indentWith, indent, bars, context) { var r = ''; function consequent(new_context) { new_context = new_context || context; new_context = new_context.contextWithVars(makeVars(new_context, token.map, bars)); r += hc(token.consequent.nodes, indentWith, indent, bars, new_context); } function alternate(new_context) { if (new_context) { new_context = new_context.contextWithVars(makeVars(new_context, token.map, bars)); } r += hc(token.alternate.nodes, indentWith, indent, bars, new_context || context); } var blockFunc = bars.blocks[token.name]; if (typeof blockFunc !== 'function') { throw 'Bars Error: Missing Block helper: ' + token.name; } blockFunc( token.arguments.map(function (expression) { return execute(expression, bars.transforms, context); }), consequent, alternate, context ); return r; } function hbp(token, indentWith, indent, bars, context) { var name = token.name; if (typeof token.name === 'object') { name = execute(token.name, bars.transforms, context); } var partial = bars.partials[name]; if (!partial) { throw 'Bars Error: Missing Partial: ' + name; } if (token.expression) { context = context.newContext( execute(token.expression, bars.transforms, context), null, true ); } context = context.contextWithVars(makeVars(context, token.map, bars)); return hc(partial.fragment.nodes, indentWith, indent, bars, context); } function hc(tokens, indentWith, indent, bars, context) { if (tokens.length === 0) { return ''; } var val; if (tokens.length === 1) { if (tokens[0].type === 'text') { return tokens[0].value; } else if (tokens[0].type === 'insert') { val = execute(tokens[0].expression, bars.transforms, context); return val !== void(0) ? val : ''; } } var r = '\n'; for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; r += repeat(indentWith, indent + 1); if (token.type === 'tag') { r += h(token, indentWith, indent + 1, bars, context); } else if (token.type === 'text') { r += token.value; } else if (token.type === 'insert') { val = execute(token.expression, bars.transforms, context); r += val !== void(0) ? val : ''; } else if (token.type === 'block') { r += hbb(token, indentWith, indent, bars, context); } else if (token.type === 'partial') { r += hbp(token, indentWith, indent, bars, context); } } r += repeat(indentWith, indent); return r; } function h(token, indentWith, indent, bars, context) { var r = ''; r += '<' + token.name; for (var i = 0; i < token.attrs.length; i++) { r += a(token.attrs[i], indentWith, bars, context); } if (token.isSelfClosing || token.selfClosed) { r += ' />'; } else { r += '>'; r += hc(token.nodes, indentWith, indent, bars, context); r += '</' + token.name + '>'; } r += '\n'; return r; } function render(fragment, indentWith, bars, context) { return hc(fragment.nodes, indentWith, -1, bars, context); } module.exports = render; },{"../runtime/execute":51}],49:[function(require,module,exports){ var Generator = require('generate-js'); var ContextN = require('./runtime/context-n'); var renderV = require('./render/render'); var renderT = require('./render/text-renderer'); var diff = require('virtual-dom/diff'); var patch = require('virtual-dom/patch'); var createElement = require('virtual-dom/create-element'); function repeat(a, n) { n = n || 0; var r = ''; for (var i = 0; i < n; i++) { r += a; } return r; } var Renderer = Generator.generate(function Renderer(bars, struct, state) { var _ = this; _.bars = bars; _.struct = struct; _.tree = renderV(_.bars, _.struct, new ContextN(state || {}), true); _.rootNode = createElement(_.tree); }); Renderer.definePrototype({ update: function update(state) { var _ = this; var newTree = renderV(_.bars, _.struct, new ContextN(state)); var patches = diff(_.tree, newTree); patch(_.rootNode, patches); _.tree = newTree; }, text: function text(state, options) { var _ = this; options = options || {}; var indent = repeat(options.tabs ? '\t' : ' ', options.tabs ? 1 : options.indent); return renderT(_.struct.fragment, indent, _.bars, new ContextN(state)); }, appendTo: function appendTo(el) { var _ = this; el.appendChild(_.rootNode); } }); module.exports = Renderer; },{"./render/render":47,"./render/text-renderer":48,"./runtime/context-n":50,"generate-js":63,"virtual-dom/create-element":68,"virtual-dom/diff":69,"virtual-dom/patch":71}],50:[function(require,module,exports){ var Generator = require('generate-js'); var utils = require('compileit/lib/utils'); var Context = Generator.generate(function Context(data, props, context, cleanVars) { var _ = this; _.data = data; _.props = props || {}; _.context = context; if (cleanVars || !context) { _.vars = Object.create(null); } else { _.vars = Object.create(context.vars); _.props.vars = _.vars; } }); Context.definePrototype({ lookup: function lookup(path) { var _ = this, i = 0; if (path[0] === '@') { if (_.props) { return _.props[path[1]]; } else { return void(0); } } if ( path[0] === 'this' ) { return _.data; } if (_.vars && path[0] in _.vars) { return _.vars[path[0]]; } if (_.data === null || _.data === void(0)) { console.warn('Bars Error: Cannot read property ' + path[0] + ' of ' + _.data); } return _.data ? _.data[path[0]] : void(0); }, newContext: function newContext(data, props, cleanVars) { return new Context(data, props, this, cleanVars); }, contextWithVars: function contextWithVars(vars) { var _ = this; var context = new Context(_.data, _.props, _); context.setVars(vars); return context; }, setVars: function setVars(vars) { var _ = this; for (var v in vars) { if (vars.hasOwnProperty(v)) { _.vars[v] = vars[v]; } } } }); module.exports = Context; },{"compileit/lib/utils":61,"generate-js":63}],51:[function(require,module,exports){ var logic = require('./logic'); function execute(syntaxTree, transforms, context) { function run(token) { var result, args = []; // token.type === 'operator' ? console.log('>>>>', token) : void(0); if ( token.type === 'literal' ) { result = token.value; } else if ( token.type === 'value' ) { result = context.lookup(token.path); } else if ( token.type === 'operator' && token.operands.length === 1 ) { result = logic[token.operator]( run(token.operands[0]) ); } else if ( token.type === 'operator' && token.operator === '?:' ) { result = run(token.operands[0]) ? run(token.operands[1]) : run(token.operands[2]); } else if ( token.type === 'operator' && token.operands.length === 2 ) { if (token.operator === '||') { result = run(token.operands[0]) || run(token.operands[1]); } else if (token.operator === '&&') { result = run(token.operands[0]) && run(token.operands[1]); } else { result = logic[token.operator]( run(token.operands[0]), run(token.operands[1]) ); } } else if ( token.type === 'transform' ) { for (var i = 0; i < token.arguments.length; i++) { args.push(run(token.arguments[i])); } if (transforms[token.name] instanceof Function) { result = transforms[token.name].apply(null, args); } else { throw 'Bars Error: Missing Transfrom: "' + token.name + '".'; } } // console.log('<<<<', result) return result; } if (syntaxTree) { return run(syntaxTree); } else { return context.lookup('this'); } } module.exports = execute; },{"./logic":52}],52:[function(require,module,exports){ /*Look up*/ exports.lookup = function add(a, b) { if (a === null || a === void(0)) { console.warn('Bars Error: Cannot read property ' + b + ' of ' + a); } return a ? a[b] : void(0); // soft // return a[b]; // hard }; exports['.'] = exports.lookup; /* Arithmetic */ exports.add = function add(a, b) { return a + b; }; exports.subtract = function subtract(a, b) { return a - b; }; exports.multiply = function multiply(a, b) { return a * b; }; exports.devide = function devide(a, b) { return a / b; }; exports.mod = function mod(a, b) { return a % b; }; exports['+'] = exports.add; exports['-'] = exports.subtract; exports['*'] = exports.multiply; exports['/'] = exports.devide; exports['%'] = exports.mod; /* Logic */ exports.not = function not(a) { return !a; }; exports['!'] = exports.not; exports.or = function or(a, b) { return a || b; }; exports.and = function and(a, b) { return a && b; }; exports['||'] = exports.or; exports['&&'] = exports.and; /* Comparison */ exports.strictequals = function strictequals(a, b) { return a === b; }; exports.strictnotequals = function strictnotequals(a, b) { return a !== b; }; exports['==='] = exports.strictequals; exports['!=='] = exports.strictnotequals; exports.equals = function equals(a, b) { return a == b; }; exports.notequals = function notequals(a, b) { return a != b; }; exports.ltequals = function ltequals(a, b) { return a <= b; }; exports.gtequals = function gtequals(a, b) { return a >= b; }; exports['=='] = exports.equals; exports['!='] = exports.notequals; exports['<='] = exports.ltequals; exports['>='] = exports.gtequals; exports.lt = function lt(a, b) { return a < b; }; exports.gt = function gt(a, b) { return a > b; }; exports['<'] = exports.lt; exports['>'] = exports.gt; },{}],53:[function(require,module,exports){ var Generator = require('generate-js'); var Transform = Generator.generate(function Transform() {}); Transform.definePrototype({ log: function log() { var args = Array.prototype.slice.call(arguments); args.unshift('Bars:'); console.log.apply(console, args); }, upperCase: function upperCase(a) { return String(a) .toUpperCase(); }, lowerCase: function lowerCase(a) { return String(a) .toLowerCase(); }, number: function number(a) { return Number(a); }, string: function string(a) { return String(a); }, reverse: function reverse(arr) { return arr.slice() .reverse(); }, slice: function (arr, start, end) { return arr.slice(start, end); }, map: function map(arr, prop) { return arr.map(function (item) { return arr[prop]; }); }, sort: function sort(arr, key) { return arr.slice() .sort(function (a, b) { if (key) { if (a[key] < b[key]) return -1; if (a[key] > b[key]) return 1; return 0; } if (a < b) return -1; if (a > b) return 1; return 0; }); }, sum: function sum(arr, key) { var sum = 0, i; if (key) { for (i = 0; i < arr.length; i++) { sum += arr[i][key]; } } else { for (i = 0; i < arr.length; i++) { sum += arr[i]; } } return sum; }, ave: function ave(arr, key) { var sum = 0, i; if (key) { for (i = 0; i < arr.length; i++) { sum += arr[i][key]; } } else { for (i = 0; i < arr.length; i++) { sum += arr[i]; } } return sum / arr.length; } }); module.exports = Transform; },{"generate-js":63}],54:[function(require,module,exports){ },{}],55:[function(require,module,exports){ /*! * Cross-Browser Split 1.1.1 * Copyright 2007-2012 Steven Levithan <stevenlevithan.com> * Available under the MIT License * ECMAScript compliant, uniform cross-browser split method */ /** * Splits a string into an array of strings using a regex or string separator. Matches of the * separator are not included in the result array. However, if `separator` is a regex that contains * capturing groups, backreferences are spliced into the result each time `separator` is matched. * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably * cross-browser. * @param {String} str String to split. * @param {RegExp|String} separator Regex or string to use for separating the string. * @param {Number} [limit] Maximum number of items to include in the result array. * @returns {Array} Array of substrings. * @example * * // Basic use * split('a b c d', ' '); * // -> ['a', 'b', 'c', 'd'] * * // With limit * split('a b c d', ' ', 2); * // -> ['a', 'b'] * * // Backreferences in result array * split('..word1 word2..', /([a-z]+)(\d+)/i); * // -> ['..', 'word', '1', ' ', 'word', '2', '..'] */ module.exports = (function split(undef) { var nativeSplit = String.prototype.split, compliantExecNpcg = /()??/.exec("")[1] === undef, // NPCG: nonparticipating capturing group self; self = function(str, separator, limit) { // If `separator` is not a regex, use `nativeSplit` if (Object.prototype.toString.call(separator) !== "[object RegExp]") { return nativeSplit.call(str, separator, limit); } var output = [], flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.extended ? "x" : "") + // Proposed for ES6 (separator.sticky ? "y" : ""), // Firefox 3+ lastLastIndex = 0, // Make `global` and avoid `lastIndex` issues by working with a copy separator = new RegExp(separator.source, flags + "g"), separator2, match, lastIndex, lastLength; str += ""; // Type-convert if (!compliantExecNpcg) { // Doesn't need flags gy, but they don't hurt separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags); } /* Values for `limit`, per the spec: * If undefined: 4294967295 // Math.pow(2, 32) - 1 * If 0, Infinity, or NaN: 0 * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296; * If negative number: 4294967296 - Math.floor(Math.abs(limit)) * If other: Type-convert, then use the above rules */ limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1 limit >>> 0; // ToUint32(limit) while (match = separator.exec(str)) { // `separator.lastIndex` is not reliable cross-browser lastIndex = match.index + match[0].length; if (lastIndex > lastLastIndex) { output.push(str.slice(lastLastIndex, match.index)); // Fix browsers whose `exec` methods don't consistently return `undefined` for // nonparticipating capturing groups if (!compliantExecNpcg && match.length > 1) { match[0].replace(separator2, function() { for (var i = 1; i < arguments.length - 2; i++) { if (arguments[i] === undef) { match[i] = undef; } } }); } if (match.length > 1 && match.index < str.length) { Array.prototype.push.apply(output, match.slice(1)); } lastLength = match[0].length; lastLastIndex = lastIndex; if (output.length >= limit) { break; } } if (separator.lastIndex === match.index) { separator.lastIndex++; // Avoid an infinite loop } } if (lastLastIndex === str.length) { if (lastLength || !separator.test("")) { output.push(""); } } else { output.push(str.slice(lastLastIndex)); } return output.length > limit ? output.slice(0, limit) : output; }; return self; })(); },{}],56:[function(require,module,exports){ exports.Compiler = require('./lib/compiler'); exports.Token = require('./lib/token'); },{"./lib/compiler":58,"./lib/token":60}],57:[function(require,module,exports){ var Generator = require('generate-js'), utils = require('./utils'); var CodeBuffer = Generator.generate( function CodeBuffer(str, file) { var _ = this; _.reset(); _._buffer = str; _._file = file; } ); CodeBuffer.definePrototype({ reset: function reset() { var _ = this; _.line = 1; _.column = 1; _._index = 0; _._currentLine = 0; }, currentLine: { get: function currentLine() { var _ = this, lineText = '', i = _._currentLine; while (i < _.length) { lineText += _._buffer[i]; if (_._buffer.codePointAt(i) === 10) { break; } i++; } return lineText; } }, buffer: { get: function getBuffer() { var _ = this; return _._buffer; } }, index: { get: function getIndex() { var _ = this; return _._index; }, set: function setIndex(val) { var _ = this, i = _._index, update = false; val = Math.min(_.length, val); val = Math.max(0, val); if (i == val) return; if (i > val) { // throw new Error('========' + val + ' < ' +i+'======='); _.reset(); i = _._index; } if (_.buffer.codePointAt(i) === 10) { update = true; i++; } for (; i <= val; i++) { if (update) { _._currentLine = i; _.line++; update = false; } else { _.column++; } if (_.buffer.codePointAt(i) === 10) { update = true; } } _.column = val - _._currentLine + 1; _._index = val; } }, length: { get: function getLength() { var _ = this; return _._buffer.length; } }, next: function next() { var _ = this; _.index++; return _.charAt(_.index); }, left: { get: function getLeft() { var _ = this; return _._index < _.length; } }, charAt: function charAt(i) { var _ = this; return _._buffer[i] || 'EOF'; }, codePointAt: function codePointAt(i) { var _ = this; return _._buffer.codePointAt(i); }, slice: function slice(startIndex, endIndex) { var _ = this; return _._buffer.slice(startIndex, endIndex); }, makeError: function makeError(start, end, message) { var _ = this; utils.assertTypeError(start, 'number'); utils.assertTypeError(end, 'number'); utils.assertTypeError(message, 'string'); _.index = start; var currentLine = _.currentLine, tokenLength = end - start, tokenIdentifier = currentLine[currentLine.length - 1] === '\n' ? '' : '\n', i; for (i = 1; i < _.column; i++) { tokenIdentifier += ' '; } tokenLength = Math.min( tokenLength, currentLine.length - tokenIdentifier.length ) || 1; for (i = 0; i < tokenLength; i++) { tokenIdentifier += '^'; } return 'Syntax Error: ' + message + ' at ' + (_._file ? _._file + ':' : '') + _.line + ':' + _.column + '\n\n' + currentLine + tokenIdentifier + '\n'; } }); module.exports = CodeBuffer; },{"./utils":61,"generate-js":63}],58:[function(require,module,exports){ var Generator = require('generate-js'), Scope = require('./scope'), Token = require('./token'), CodeBuffer = require('./code-buffer'), utils = require('./utils'); var Compiler = Generator.generate( function Compiler(parseModes, formaters) { var _ = this; _.modeFormater = formaters.modeFormater || utils.varThrough; _.charFormater = formaters.charFormater || utils.varThrough; _.funcFormater = formaters.funcFormater || utils.varThrough; _.typeFormater = formaters.typeFormater || utils.varThrough; _.sourceFormater = formaters.sourceFormater || utils.varThrough; _.parseModes = parseModes; _.scope = new Scope(); } ); Compiler.definePrototype({ compile: function compile(codeStr, file, mode, flags) { var _ = this, tokens = []; _.codeBuffer = new CodeBuffer(codeStr, file); _.scope.verbose = flags.verbose; if (flags.verbose) { _.scope.printScope(); } _.parseMode(mode, tokens, flags); if (flags.verbose) { _.scope.printScope(); } if (_.scope.length) { throw _.codeBuffer.makeError( 'Unexpected End Of Input.' ); } return tokens; }, parseMode: function parseMode(mode, tokens, flags) { var _ = this, scope = _.scope, code = _.codeBuffer, token, parseFuncs = _.parseModes[mode], index = code.index; if (!parseFuncs) { throw new Error('Mode not found: ' + JSON.stringify( mode) + '.'); } function newParseMode(mode, tokens, flags) { _.parseMode(mode, tokens, flags); } newParseMode.close = function () { this.closed = true; }; loop: while (code.left) { for (var i = 0; i < parseFuncs.length; i++) { var parseFunc = parseFuncs[i]; if (flags.verbose) { console.log( utils.repeat(' ', scope.length + 1) + _.modeFormater(mode) + ' ' + _.funcFormater(parseFunc.name) + '\n' + utils.repeat(' ', scope.length + 1) + utils.bufferSlice(code, 5, _.charFormater) ); } token = parseFunc( mode, code, tokens, flags, scope, newParseMode ); if (token) { if (token instanceof Token) { tokens.push(token); if (flags.verbose) { console.log( utils.repeat(' ', scope.length + 1) + _.typeFormater(token.constructor .name || token.type) + ': ' + _.sourceFormater(token.source()) ); } } if (newParseMode.closed) { delete newParseMode.closed; break loop; } break; } } if (newParseMode.closed) { delete newParseMode.closed; break loop; } if (index === code.index) { token = new Token(code); token.close(code); token.value = token.source(code); if (flags.noErrorOnILLEGAL) { tokens.push(token); } else { throw code.makeError( token.range[0], token.range[1], 'ILLEGAL Token: ' + JSON.stringify( token.source(code) ) .slice(1, -1) ); } } index = code.index; } } }); module.exports = Compiler; },{"./code-buffer":57,"./scope":59,"./token":60,"./utils":61,"generate-js":63}],59:[function(require,module,exports){ var Generator = require('generate-js'), Token = require('./token'), utils = require('./utils'); var Scope = Generator.generate( function Scope() { var _ = this; _.defineProperties({ _scope: [] }); } ); Scope.definePrototype({ push: function push(token) { var _ = this; utils.assertError(Token.isCreation(token), 'Invalid Type.'); _._scope.push(token); if (_.verbose) { _.printScope(); } return _._scope.length; }, pop: function pop() { var _ = this; var token = _._scope.pop(); if (_.verbose) { _.printScope(); } return token; }, close: function close() { var _ = this; var token = _._scope.pop(); token.close(); if (_.verbose) { _.printScope(); } return token; }, printScope: function printScope() { var _ = this; console.log( ['Main'].concat( _._scope .map(function (item) { return item.constructor.name || item.type; }) ) .join(' => ') ); }, token: { get: function getToken() { var _ = this; return _._scope[_._scope.length - 1]; } }, length: { get: function getLength() { var _ = this; return _._scope.length; } } }); module.exports = Scope; },{"./token":60,"./utils":61,"generate-js":63}],60:[function(require,module,exports){ var Generator = require('generate-js'), utils = require('./utils'); var Token = Generator.generate( function Token(code, type) { var _ = this; _.defineProperties({ code: code }); _.type = type; _.range = [code.index, code.index + 1]; _.loc = { start: { line: code.line, column: code.column }, end: { line: code.line, column: code.column + 1 } }; } ); Token.definePrototype({ writable: true, enumerable: true }, { type: 'ILLEGAL' }); Token.definePrototype({ length: { get: function getLength() { return this.range[1] - this.range[0]; } }, source: function source() { var _ = this; return _.code.slice(_.range[0], _.range[1]); }, close: function close() { var _ = this; if (_.closed) { throw new Error('Cannot call close on a closed token.'); } _.closed = true; if (_.code.index > _.range[1]) { _.range[1] = _.code.index; _.loc.end = { line: _.code.line, column: _.code.column }; } } }); module.exports = Token; },{"./utils":61,"generate-js":63}],61:[function(require,module,exports){ /** * Assert Error function. * @param {Boolean} condition Whether or not to throw error. * @param {String} message Error message. */ function assertError(condition, message) { if (!condition) { throw new Error(message); } } exports.assertError = assertError; /** * Assert TypeError function. * @param {Boolean} condition Whether or not to throw error. * @param {String} message Error message. */ function assertTypeError(test, type) { if (typeof test !== type) { throw new TypeError('Expected \'' + type + '\' but instead found \'' + typeof test + '\''); } } exports.assertTypeError = assertTypeError; /** * Repeats a string `n` time. * @param {String} str String to be repeated. * @param {Number} n Number of times to repeat. */ function repeat(str, n) { var result = ''; for (var i = 0; i < n; i++) { result += str; } return result; } exports.repeat = repeat; /** * Returns whatever you pass it. * @param {Any} a CodeBuffer to slice. */ function varThrough(a) { return a; } exports.varThrough = varThrough; /** * Stringified CodeBuffer slice. * @param {CodeBuffer} code CodeBuffer to slice. * @param {Number} range Range to slice before and after `code.index`. */ function bufferSlice(code, range, format) { format = format || varThrough; return JSON.stringify( code.slice(Math.max(0, code.index - range), code.index) ) .slice(1, -1) + format( JSON.stringify(code.charAt(code.index) || 'EOF') .slice(1, -1) ) + JSON.stringify( code.slice( code.index + 1, Math.min(code.length, code.index + 1 + range) ) ) .slice(1, -1); } exports.bufferSlice = bufferSlice; },{}],62:[function(require,module,exports){ 'use strict'; var OneVersionConstraint = require('individual/one-version'); var MY_VERSION = '7'; OneVersionConstraint('ev-store', MY_VERSION); var hashKey = '__EV_STORE_KEY@' + MY_VERSION; module.exports = EvStore; function EvStore(elem) { var hash = elem[hashKey]; if (!hash) { hash = elem[hashKey] = {}; } return hash; } },{"individual/one-version":66}],63:[function(require,module,exports){ /** * @name generate.js * @author Michaelangelo Jong */ (function GeneratorScope() { /** * Assert Error function. * @param {Boolean} condition Whether or not to throw error. * @param {String} message Error message. */ function assertError(condition, message) { if (!condition) { throw new Error(message); } } /** * Assert TypeError function. * @param {Boolean} condition Whether or not to throw error. * @param {String} message Error message. */ function assertTypeError(test, type) { if (typeof test !== type) { throw new TypeError('Expected \'' + type + '\' but instead found \'' + typeof test + '\''); } } /** * Returns the name of function 'func'. * @param {Function} func Any function. * @return {String} Name of 'func'. */ function getFunctionName(func) { if (func.name !== void(0)) { return func.name; } // Else use IE Shim var funcNameMatch = func.toString() .match(/function\s*([^\s]*)\s*\(/); func.name = (funcNameMatch && funcNameMatch[1]) || ''; return func.name; } /** * Returns true if 'obj' is an object containing only get and set functions, false otherwise. * @param {Any} obj Value to be tested. * @return {Boolean} true or false. */ function isGetSet(obj) { var keys, length; if (obj && typeof obj === 'object') { keys = Object.getOwnPropertyNames(obj) .sort(); length = keys.length; if ((length === 1 && (keys[0] === 'get' && typeof obj.get === 'function' || keys[0] === 'set' && typeof obj.set === 'function' )) || (length === 2 && (keys[0] === 'get' && typeof obj.get === 'function' && keys[1] === 'set' && typeof obj.set === 'function' ))) { return true; } } return false; } /** * Defines properties on 'obj'. * @param {Object} obj An object that 'properties' will be attached to. * @param {Object} descriptor Optional object descriptor that will be applied to all attaching properties on 'properties'. * @param {Object} properties An object who's properties will be attached to 'obj'. * @return {Generator} 'obj'. */ function defineObjectProperties(obj, descriptor, properties) { var setProperties = {}, i, keys, length, p = properties || descriptor, d = properties && descriptor; properties = (p && typeof p === 'object') ? p : {}; descriptor = (d && typeof d === 'object') ? d : {}; keys = Object.getOwnPropertyNames(properties); length = keys.length; for (i = 0; i < length; i++) { if (isGetSet(properties[keys[i]])) { setProperties[keys[i]] = { configurable: !!descriptor.configurable, enumerable: !!descriptor.enumerable, get: properties[keys[i]].get, set: properties[keys[i]].set }; } else { setProperties[keys[i]] = { configurable: !!descriptor.configurable, enumerable: !!descriptor.enumerable, writable: !!descriptor.writable, value: properties[keys[i]] }; } } Object.defineProperties(obj, setProperties); return obj; } var Creation = { /** * Defines properties on this object. * @param {Object} descriptor Optional object descriptor that will be applied to all attaching properties. * @param {Object} properties An object who's properties will be attached to this object. * @return {Object} This object. */ defineProperties: function defineProperties(descriptor, properties) { defineObjectProperties(this, descriptor, properties); return this; }, /** * returns the prototype of `this` Creation. * @return {Object} Prototype of `this` Creation. */ getProto: function getProto() { return Object.getPrototypeOf(this); }, /** * returns the prototype of `this` super Creation. * @return {Object} Prototype of `this` super Creation. */ getSuper: function getSuper() { return Object.getPrototypeOf(this.constructor.prototype); } }; var Generation = { /** * Returns true if 'generator' was generated by this Generator. * @param {Generator} generator A Generator. * @return {Boolean} true or false. */ isGeneration: function isGeneration(generator) { assertTypeError(generator, 'function'); var _ = this; return _.prototype.isPrototypeOf(generator.prototype); }, /** * Returns true if 'object' was created by this Generator. * @param {Object} object An Object. * @return {Boolean} true or false. */ isCreation: function isCreation(object) { var _ = this; return object instanceof _; }, /** * Generates a new generator that inherits from `this` generator. * @param {Generator} ParentGenerator Generator to inherit from. * @param {Function} create Create method that gets called when creating a new instance of new generator. * @return {Generator} New Generator that inherits from 'ParentGenerator'. */ generate: function generate(construct) { assertTypeError(construct, 'function'); var _ = this; defineObjectProperties( construct, { configurable: false, enumerable: false, writable: false }, { prototype: Object.create(_.prototype) } ); defineObjectProperties( construct, { configurable: false, enumerable: false, writable: false }, Generation ); defineObjectProperties( construct.prototype, { configurable: false, enumerable: false, writable: false }, { constructor: construct, generator: construct, } ); return construct; }, /** * Defines shared properties for all objects created by this generator. * @param {Object} descriptor Optional object descriptor that will be applied to all attaching properties. * @param {Object} properties An object who's properties will be attached to this generator's prototype. * @return {Generator} This generator. */ definePrototype: function definePrototype(descriptor, properties) { defineObjectProperties(this.prototype, descriptor, properties); return this; } }; function Generator() {} defineObjectProperties( Generator, { configurable: false, enumerable: false, writable: false }, { prototype: Generator.prototype } ); defineObjectProperties( Generator.prototype, { configurable: false, enumerable: false, writable: false }, Creation ); defineObjectProperties( Generator, { configurable: false, enumerable: false, writable: false }, Generation ); defineObjectProperties( Generator, { configurable: false, enumerable: false, writable: false }, { /** * Returns true if 'generator' was generated by this Generator. * @param {Generator} generator A Generator. * @return {Boolean} true or false. */ isGenerator: function isGenerator(generator) { return this.isGeneration(generator); }, /** * Generates a new generator that inherits from `this` generator. * @param {Generator} extendFrom Constructor to inherit from. * @param {Function} create Create method that gets called when creating a new instance of new generator. * @return {Generator} New Generator that inherits from 'ParentGenerator'. */ toGenerator: function toGenerator(extendFrom, create) { console.warn( 'Generator.toGenerator is depreciated please use Generator.generateFrom' ); return this.generateFrom(extendFrom, create); }, /** * Generates a new generator that inherits from `this` generator. * @param {Constructor} extendFrom Constructor to inherit from. * @param {Function} create Create method that gets called when creating a new instance of new generator. * @return {Generator} New Generator that inherits from 'ParentGenerator'. */ generateFrom: function generateFrom(extendFrom, create) { assertTypeError(extendFrom, 'function'); assertTypeError(create, 'function'); defineObjectProperties( create, { configurable: false, enumerable: false, writable: false }, { prototype: Object.create(extendFrom.prototype), } ); defineObjectProperties( create, { configurable: false, enumerable: false, writable: false }, Generation ); defineObjectProperties( create.prototype, { configurable: false, enumerable: false, writable: false }, { constructor: create, generator: create, } ); defineObjectProperties( create.prototype, { configurable: false, enumerable: false, writable: false }, Creation ); return create; } } ); Object.freeze(Generator); Object.freeze(Generator.prototype); // Exports if (typeof define === 'function' && define.amd) { // AMD define(function () { return Generator; }); } else if (typeof module === 'object' && typeof exports === 'object') { // Node/CommonJS module.exports = Generator; } else { // Browser global window.Generator = Generator; } }()); },{}],64:[function(require,module,exports){ (function (global){ var topLevel = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : {} var minDoc = require('min-document'); if (typeof document !== 'undefined') { module.exports = document; } else { var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4']; if (!doccy) { doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc; } module.exports = doccy; } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"min-document":54}],65:[function(require,module,exports){ (function (global){ 'use strict'; /*global window, global*/ var root = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}; module.exports = Individual; function Individual(key, value) { if (key in root) { return root[key]; } root[key] = value; return value; } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],66:[function(require,module,exports){ 'use strict'; var Individual = require('./index.js'); module.exports = OneVersion; function OneVersion(moduleName, version, defaultValue) { var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName; var enforceKey = key + '_ENFORCE_SINGLETON'; var versionValue = Individual(enforceKey, version); if (versionValue !== version) { throw new Error('Can only have one copy of ' + moduleName + '.\n' + 'You already have version ' + versionValue + ' installed.\n' + 'This means you cannot install version ' + version); } return Individual(key, defaultValue); } },{"./index.js":65}],67:[function(require,module,exports){ "use strict"; module.exports = function isObject(x) { return typeof x === "object" && x !== null; }; },{}],68:[function(require,module,exports){ var createElement = require("./vdom/create-element.js") module.exports = createElement },{"./vdom/create-element.js":73}],69:[function(require,module,exports){ var diff = require("./vtree/diff.js") module.exports = diff },{"./vtree/diff.js":93}],70:[function(require,module,exports){ var h = require("./virtual-hyperscript/index.js") module.exports = h },{"./virtual-hyperscript/index.js":80}],71:[function(require,module,exports){ var patch = require("./vdom/patch.js") module.exports = patch },{"./vdom/patch.js":76}],72:[function(require,module,exports){ var isObject = require("is-object") var isHook = require("../vnode/is-vhook.js") module.exports = applyProperties function applyProperties(node, props, previous) { for (var propName in props) { var propValue = props[propName] if (propValue === undefined) { removeProperty(node, propName, propValue, previous); } else if (isHook(propValue)) { removeProperty(node, propName, propValue, previous) if (propValue.hook) { propValue.hook(node, propName, previous ? previous[propName] : undefined) } } else { if (isObject(propValue)) { patchObject(node, props, previous, propName, propValue); } else { node[propName] = propValue } } } } function removeProperty(node, propName, propValue, previous) { if (previous) { var previousValue = previous[propName] if (!isHook(previousValue)) { if (propName === "attributes") { for (var attrName in previousValue) { node.removeAttribute(attrName) } } else if (propName === "style") { for (var i in previousValue) { node.style[i] = "" } } else if (typeof previousValue === "string") { node[propName] = "" } else { node[propName] = null } } else if (previousValue.unhook) { previousValue.unhook(node, propName, propValue) } } } function patchObject(node, props, previous, propName, propValue) { var previousValue = previous ? previous[propName] : undefined // Set attributes if (propName === "attributes") { for (var attrName in propValue) { var attrValue = propValue[attrName] if (attrValue === undefined) { node.removeAttribute(attrName) } else { node.setAttribute(attrName, attrValue) } } return } if(previousValue && isObject(previousValue) && getPrototype(previousValue) !== getPrototype(propValue)) { node[propName] = propValue return } if (!isObject(node[propName])) { node[propName] = {} } var replacer = propName === "style" ? "" : undefined for (var k in propValue) { var value = propValue[k] node[propName][k] = (value === undefined) ? replacer : value } } function getPrototype(value) { if (Object.getPrototypeOf) { return Object.getPrototypeOf(value) } else if (value.__proto__) { return value.__proto__ } else if (value.constructor) { return value.constructor.prototype } } },{"../vnode/is-vhook.js":84,"is-object":67}],73:[function(require,module,exports){ var document = require("global/document") var applyProperties = require("./apply-properties") var isVNode = require("../vnode/is-vnode.js") var isVText = require("../vnode/is-vtext.js") var isWidget = require("../vnode/is-widget.js") var handleThunk = require("../vnode/handle-thunk.js") module.exports = createElement function createElement(vnode, opts) { var doc = opts ? opts.document || document : document var warn = opts ? opts.warn : null vnode = handleThunk(vnode).a if (isWidget(vnode)) { return vnode.init() } else if (isVText(vnode)) { return doc.createTextNode(vnode.text) } else if (!isVNode(vnode)) { if (warn) { warn("Item is not a valid virtual dom node", vnode) } return null } var node = (vnode.namespace === null) ? doc.createElement(vnode.tagName) : doc.createElementNS(vnode.namespace, vnode.tagName) var props = vnode.properties applyProperties(node, props) var children = vnode.children for (var i = 0; i < children.length; i++) { var childNode = createElement(children[i], opts) if (childNode) { node.appendChild(childNode) } } return node } },{"../vnode/handle-thunk.js":82,"../vnode/is-vnode.js":85,"../vnode/is-vtext.js":86,"../vnode/is-widget.js":87,"./apply-properties":72,"global/document":64}],74:[function(require,module,exports){ // Maps a virtual DOM tree onto a real DOM tree in an efficient manner. // We don't want to read all of the DOM nodes in the tree so we use // the in-order tree indexing to eliminate recursion down certain branches. // We only recurse into a DOM node if we know that it contains a child of // interest. var noChild = {} module.exports = domIndex function domIndex(rootNode, tree, indices, nodes) { if (!indices || indices.length === 0) { return {} } else { indices.sort(ascending) return recurse(rootNode, tree, indices, nodes, 0) } } function recurse(rootNode, tree, indices, nodes, rootIndex) { nodes = nodes || {} if (rootNode) { if (indexInRange(indices, rootIndex, rootIndex)) { nodes[rootIndex] = rootNode } var vChildren = tree.children if (vChildren) { var childNodes = rootNode.childNodes for (var i = 0; i < tree.children.length; i++) { rootIndex += 1 var vChild = vChildren[i] || noChild var nextIndex = rootIndex + (vChild.count || 0) // skip recursion down the tree if there are no nodes down here if (indexInRange(indices, rootIndex, nextIndex)) { recurse(childNodes[i], vChild, indices, nodes, rootIndex) } rootIndex = nextIndex } } } return nodes } // Binary search for an index in the interval [left, right] function indexInRange(indices, left, right) { if (indices.length === 0) { return false } var minIndex = 0 var maxIndex = indices.length - 1 var currentIndex var currentItem while (minIndex <= maxIndex) { currentIndex = ((maxIndex + minIndex) / 2) >> 0 currentItem = indices[currentIndex] if (minIndex === maxIndex) { return currentItem >= left && currentItem <= right } else if (currentItem < left) { minIndex = currentIndex + 1 } else if (currentItem > right) { maxIndex = currentIndex - 1 } else { return true } } return false; } function ascending(a, b) { return a > b ? 1 : -1 } },{}],75:[function(require,module,exports){ var applyProperties = require("./apply-properties") var isWidget = require("../vnode/is-widget.js") var VPatch = require("../vnode/vpatch.js") var updateWidget = require("./update-widget") module.exports = applyPatch function applyPatch(vpatch, domNode, renderOptions) { var type = vpatch.type var vNode = vpatch.vNode var patch = vpatch.patch switch (type) { case VPatch.REMOVE: return removeNode(domNode, vNode) case VPatch.INSERT: return insertNode(domNode, patch, renderOptions) case VPatch.VTEXT: return stringPatch(domNode, vNode, patch, renderOptions) case VPatch.WIDGET: return widgetPatch(domNode, vNode, patch, renderOptions) case VPatch.VNODE: return vNodePatch(domNode, vNode, patch, renderOptions) case VPatch.ORDER: reorderChildren(domNode, patch) return domNode case VPatch.PROPS: applyProperties(domNode, patch, vNode.properties) return domNode case VPatch.THUNK: return replaceRoot(domNode, renderOptions.patch(domNode, patch, renderOptions)) default: return domNode } } function removeNode(domNode, vNode) { var parentNode = domNode.parentNode if (parentNode) { parentNode.removeChild(domNode) } destroyWidget(domNode, vNode); return null } function insertNode(parentNode, vNode, renderOptions) { var newNode = renderOptions.render(vNode, renderOptions) if (parentNode) { parentNode.appendChild(newNode) } return parentNode } function stringPatch(domNode, leftVNode, vText, renderOptions) { var newNode if (domNode.nodeType === 3) { domNode.replaceData(0, domNode.length, vText.text) newNode = domNode } else { var parentNode = domNode.parentNode newNode = renderOptions.render(vText, renderOptions) if (parentNode && newNode !== domNode) { parentNode.replaceChild(newNode, domNode) } } return newNode } function widgetPatch(domNode, leftVNode, widget, renderOptions) { var updating = updateWidget(leftVNode, widget) var newNode if (updating) { newNode = widget.update(leftVNode, domNode) || domNode } else { newNode = renderOptions.render(widget, renderOptions) } var parentNode = domNode.parentNode if (parentNode && newNode !== domNode) { parentNode.replaceChild(newNode, domNode) } if (!updating) { destroyWidget(domNode, leftVNode) } return newNode } function vNodePatch(domNode, leftVNode, vNode, renderOptions) { var parentNode = domNode.parentNode var newNode = renderOptions.render(vNode, renderOptions) if (parentNode && newNode !== domNode) { parentNode.replaceChild(newNode, domNode) } return newNode } function destroyWidget(domNode, w) { if (typeof w.destroy === "function" && isWidget(w)) { w.destroy(domNode) } } function reorderChildren(domNode, moves) { var childNodes = domNode.childNodes var keyMap = {} var node var remove var insert for (var i = 0; i < moves.removes.length; i++) { remove = moves.removes[i] node = childNodes[remove.from] if (remove.key) { keyMap[remove.key] = node } domNode.removeChild(node) } var length = childNodes.length for (var j = 0; j < moves.inserts.length; j++) { insert = moves.inserts[j] node = keyMap[insert.key] // this is the weirdest bug i've ever seen in webkit domNode.insertBefore(node, insert.to >= length++ ? null : childNodes[insert.to]) } } function replaceRoot(oldRoot, newRoot) { if (oldRoot && newRoot && oldRoot !== newRoot && oldRoot.parentNode) { oldRoot.parentNode.replaceChild(newRoot, oldRoot) } return newRoot; } },{"../vnode/is-widget.js":87,"../vnode/vpatch.js":90,"./apply-properties":72,"./update-widget":77}],76:[function(require,module,exports){ var document = require("global/document") var isArray = require("x-is-array") var render = require("./create-element") var domIndex = require("./dom-index") var patchOp = require("./patch-op") module.exports = patch function patch(rootNode, patches, renderOptions) { renderOptions = renderOptions || {} renderOptions.patch = renderOptions.patch && renderOptions.patch !== patch ? renderOptions.patch : patchRecursive renderOptions.render = renderOptions.render || render return renderOptions.patch(rootNode, patches, renderOptions) } function patchRecursive(rootNode, patches, renderOptions) { var indices = patchIndices(patches) if (indices.length === 0) { return rootNode } var index = domIndex(rootNode, patches.a, indices) var ownerDocument = rootNode.ownerDocument if (!renderOptions.document && ownerDocument !== document) { renderOptions.document = ownerDocument } for (var i = 0; i < indices.length; i++) { var nodeIndex = indices[i] rootNode = applyPatch(rootNode, index[nodeIndex], patches[nodeIndex], renderOptions) } return rootNode } function applyPatch(rootNode, domNode, patchList, renderOptions) { if (!domNode) { return rootNode } var newNode if (isArray(patchList)) { for (var i = 0; i < patchList.length; i++) { newNode = patchOp(patchList[i], domNode, renderOptions) if (domNode === rootNode) { rootNode = newNode } } } else { newNode = patchOp(patchList, domNode, renderOptions) if (domNode === rootNode) { rootNode = newNode } } return rootNode } function patchIndices(patches) { var indices = [] for (var key in patches) { if (key !== "a") { indices.push(Number(key)) } } return indices } },{"./create-element":73,"./dom-index":74,"./patch-op":75,"global/document":64,"x-is-array":94}],77:[function(require,module,exports){ var isWidget = require("../vnode/is-widget.js") module.exports = updateWidget function updateWidget(a, b) { if (isWidget(a) && isWidget(b)) { if ("name" in a && "name" in b) { return a.id === b.id } else { return a.init === b.init } } return false } },{"../vnode/is-widget.js":87}],78:[function(require,module,exports){ 'use strict'; var EvStore = require('ev-store'); module.exports = EvHook; function EvHook(value) { if (!(this instanceof EvHook)) { return new EvHook(value); } this.value = value; } EvHook.prototype.hook = function (node, propertyName) { var es = EvStore(node); var propName = propertyName.substr(3); es[propName] = this.value; }; EvHook.prototype.unhook = function(node, propertyName) { var es = EvStore(node); var propName = propertyName.substr(3); es[propName] = undefined; }; },{"ev-store":62}],79:[function(require,module,exports){ 'use strict'; module.exports = SoftSetHook; function SoftSetHook(value) { if (!(this instanceof SoftSetHook)) { return new SoftSetHook(value); } this.value = value; } SoftSetHook.prototype.hook = function (node, propertyName) { if (node[propertyName] !== this.value) { node[propertyName] = this.value; } }; },{}],80:[function(require,module,exports){ 'use strict'; var isArray = require('x-is-array'); var VNode = require('../vnode/vnode.js'); var VText = require('../vnode/vtext.js'); var isVNode = require('../vnode/is-vnode'); var isVText = require('../vnode/is-vtext'); var isWidget = require('../vnode/is-widget'); var isHook = require('../vnode/is-vhook'); var isVThunk = require('../vnode/is-thunk'); var parseTag = require('./parse-tag.js'); var softSetHook = require('./hooks/soft-set-hook.js'); var evHook = require('./hooks/ev-hook.js'); module.exports = h; function h(tagName, properties, children) { var childNodes = []; var tag, props, key, namespace; if (!children && isChildren(properties)) { children = properties; props = {}; } props = props || properties || {}; tag = parseTag(tagName, props); // support keys if (props.hasOwnProperty('key')) { key = props.key; props.key = undefined; } // support namespace if (props.hasOwnProperty('namespace')) { namespace = props.namespace; props.namespace = undefined; } // fix cursor bug if (tag === 'INPUT' && !namespace && props.hasOwnProperty('value') && props.value !== undefined && !isHook(props.value) ) { props.value = softSetHook(props.value); } transformProperties(props); if (children !== undefined && children !== null) { addChild(children, childNodes, tag, props); } return new VNode(tag, props, childNodes, key, namespace); } function addChild(c, childNodes, tag, props) { if (typeof c === 'string') { childNodes.push(new VText(c)); } else if (typeof c === 'number') { childNodes.push(new VText(String(c))); } else if (isChild(c)) { childNodes.push(c); } else if (isArray(c)) { for (var i = 0; i < c.length; i++) { addChild(c[i], childNodes, tag, props); } } else if (c === null || c === undefined) { return; } else { throw UnexpectedVirtualElement({ foreignObject: c, parentVnode: { tagName: tag, properties: props } }); } } function transformProperties(props) { for (var propName in props) { if (props.hasOwnProperty(propName)) { var value = props[propName]; if (isHook(value)) { continue; } if (propName.substr(0, 3) === 'ev-') { // add ev-foo support props[propName] = evHook(value); } } } } function isChild(x) { return isVNode(x) || isVText(x) || isWidget(x) || isVThunk(x); } function isChildren(x) { return typeof x === 'string' || isArray(x) || isChild(x); } function UnexpectedVirtualElement(data) { var err = new Error(); err.type = 'virtual-hyperscript.unexpected.virtual-element'; err.message = 'Unexpected virtual child passed to h().\n' + 'Expected a VNode / Vthunk / VWidget / string but:\n' + 'got:\n' + errorString(data.foreignObject) + '.\n' + 'The parent vnode is:\n' + errorString(data.parentVnode) '\n' + 'Suggested fix: change your `h(..., [ ... ])` callsite.'; err.foreignObject = data.foreignObject; err.parentVnode = data.parentVnode; return err; } function errorString(obj) { try { return JSON.stringify(obj, null, ' '); } catch (e) { return String(obj); } } },{"../vnode/is-thunk":83,"../vnode/is-vhook":84,"../vnode/is-vnode":85,"../vnode/is-vtext":86,"../vnode/is-widget":87,"../vnode/vnode.js":89,"../vnode/vtext.js":91,"./hooks/ev-hook.js":78,"./hooks/soft-set-hook.js":79,"./parse-tag.js":81,"x-is-array":94}],81:[function(require,module,exports){ 'use strict'; var split = require('browser-split'); var classIdSplit = /([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/; var notClassId = /^\.|#/; module.exports = parseTag; function parseTag(tag, props) { if (!tag) { return 'DIV'; } var noId = !(props.hasOwnProperty('id')); var tagParts = split(tag, classIdSplit); var tagName = null; if (notClassId.test(tagParts[1])) { tagName = 'DIV'; } var classes, part, type, i; for (i = 0; i < tagParts.length; i++) { part = tagParts[i]; if (!part) { continue; } type = part.charAt(0); if (!tagName) { tagName = part; } else if (type === '.') { classes = classes || []; classes.push(part.substring(1, part.length)); } else if (type === '#' && noId) { props.id = part.substring(1, part.length); } } if (classes) { if (props.className) { classes.push(props.className); } props.className = classes.join(' '); } return props.namespace ? tagName : tagName.toUpperCase(); } },{"browser-split":55}],82:[function(require,module,exports){ var isVNode = require("./is-vnode") var isVText = require("./is-vtext") var isWidget = require("./is-widget") var isThunk = require("./is-thunk") module.exports = handleThunk function handleThunk(a, b) { var renderedA = a var renderedB = b if (isThunk(b)) { renderedB = renderThunk(b, a) } if (isThunk(a)) { renderedA = renderThunk(a, null) } return { a: renderedA, b: renderedB } } function renderThunk(thunk, previous) { var renderedThunk = thunk.vnode if (!renderedThunk) { renderedThunk = thunk.vnode = thunk.render(previous) } if (!(isVNode(renderedThunk) || isVText(renderedThunk) || isWidget(renderedThunk))) { throw new Error("thunk did not return a valid node"); } return renderedThunk } },{"./is-thunk":83,"./is-vnode":85,"./is-vtext":86,"./is-widget":87}],83:[function(require,module,exports){ module.exports = isThunk function isThunk(t) { return t && t.type === "Thunk" } },{}],84:[function(require,module,exports){ module.exports = isHook function isHook(hook) { return hook && (typeof hook.hook === "function" && !hook.hasOwnProperty("hook") || typeof hook.unhook === "function" && !hook.hasOwnProperty("unhook")) } },{}],85:[function(require,module,exports){ var version = require("./version") module.exports = isVirtualNode function isVirtualNode(x) { return x && x.type === "VirtualNode" && x.version === version } },{"./version":88}],86:[function(require,module,exports){ var version = require("./version") module.exports = isVirtualText function isVirtualText(x) { return x && x.type === "VirtualText" && x.version === version } },{"./version":88}],87:[function(require,module,exports){ module.exports = isWidget function isWidget(w) { return w && w.type === "Widget" } },{}],88:[function(require,module,exports){ module.exports = "2" },{}],89:[function(require,module,exports){ var version = require("./version") var isVNode = require("./is-vnode") var isWidget = require("./is-widget") var isThunk = require("./is-thunk") var isVHook = require("./is-vhook") module.exports = VirtualNode var noProperties = {} var noChildren = [] function VirtualNode(tagName, properties, children, key, namespace) { this.tagName = tagName this.properties = properties || noProperties this.children = children || noChildren this.key = key != null ? String(key) : undefined this.namespace = (typeof namespace === "string") ? namespace : null var count = (children && children.length) || 0 var descendants = 0 var hasWidgets = false var hasThunks = false var descendantHooks = false var hooks for (var propName in properties) { if (properties.hasOwnProperty(propName)) { var property = properties[propName] if (isVHook(property) && property.unhook) { if (!hooks) { hooks = {} } hooks[propName] = property } } } for (var i = 0; i < count; i++) { var child = children[i] if (isVNode(child)) { descendants += child.count || 0 if (!hasWidgets && child.hasWidgets) { hasWidgets = true } if (!hasThunks && child.hasThunks) { hasThunks = true } if (!descendantHooks && (child.hooks || child.descendantHooks)) { descendantHooks = true } } else if (!hasWidgets && isWidget(child)) { if (typeof child.destroy === "function") { hasWidgets = true } } else if (!hasThunks && isThunk(child)) { hasThunks = true; } } this.count = count + descendants this.hasWidgets = hasWidgets this.hasThunks = hasThunks this.hooks = hooks this.descendantHooks = descendantHooks } VirtualNode.prototype.version = version VirtualNode.prototype.type = "VirtualNode" },{"./is-thunk":83,"./is-vhook":84,"./is-vnode":85,"./is-widget":87,"./version":88}],90:[function(require,module,exports){ var version = require("./version") VirtualPatch.NONE = 0 VirtualPatch.VTEXT = 1 VirtualPatch.VNODE = 2 VirtualPatch.WIDGET = 3 VirtualPatch.PROPS = 4 VirtualPatch.ORDER = 5 VirtualPatch.INSERT = 6 VirtualPatch.REMOVE = 7 VirtualPatch.THUNK = 8 module.exports = VirtualPatch function VirtualPatch(type, vNode, patch) { this.type = Number(type) this.vNode = vNode this.patch = patch } VirtualPatch.prototype.version = version VirtualPatch.prototype.type = "VirtualPatch" },{"./version":88}],91:[function(require,module,exports){ var version = require("./version") module.exports = VirtualText function VirtualText(text) { this.text = String(text) } VirtualText.prototype.version = version VirtualText.prototype.type = "VirtualText" },{"./version":88}],92:[function(require,module,exports){ var isObject = require("is-object") var isHook = require("../vnode/is-vhook") module.exports = diffProps function diffProps(a, b) { var diff for (var aKey in a) { if (!(aKey in b)) { diff = diff || {} diff[aKey] = undefined } var aValue = a[aKey] var bValue = b[aKey] if (aValue === bValue) { continue } else if (isObject(aValue) && isObject(bValue)) { if (getPrototype(bValue) !== getPrototype(aValue)) { diff = diff || {} diff[aKey] = bValue } else if (isHook(bValue)) { diff = diff || {} diff[aKey] = bValue } else { var objectDiff = diffProps(aValue, bValue) if (objectDiff) { diff = diff || {} diff[aKey] = objectDiff } } } else { diff = diff || {} diff[aKey] = bValue } } for (var bKey in b) { if (!(bKey in a)) { diff = diff || {} diff[bKey] = b[bKey] } } return diff } function getPrototype(value) { if (Object.getPrototypeOf) { return Object.getPrototypeOf(value) } else if (value.__proto__) { return value.__proto__ } else if (value.constructor) { return value.constructor.prototype } } },{"../vnode/is-vhook":84,"is-object":67}],93:[function(require,module,exports){ var isArray = require("x-is-array") var VPatch = require("../vnode/vpatch") var isVNode = require("../vnode/is-vnode") var isVText = require("../vnode/is-vtext") var isWidget = require("../vnode/is-widget") var isThunk = require("../vnode/is-thunk") var handleThunk = require("../vnode/handle-thunk") var diffProps = require("./diff-props") module.exports = diff function diff(a, b) { var patch = { a: a } walk(a, b, patch, 0) return patch } function walk(a, b, patch, index) { if (a === b) { return } var apply = patch[index] var applyClear = false if (isThunk(a) || isThunk(b)) { thunks(a, b, patch, index) } else if (b == null) { // If a is a widget we will add a remove patch for it // Otherwise any child widgets/hooks must be destroyed. // This prevents adding two remove patches for a widget. if (!isWidget(a)) { clearState(a, patch, index) apply = patch[index] } apply = appendPatch(apply, new VPatch(VPatch.REMOVE, a, b)) } else if (isVNode(b)) { if (isVNode(a)) { if (a.tagName === b.tagName && a.namespace === b.namespace && a.key === b.key) { var propsPatch = diffProps(a.properties, b.properties) if (propsPatch) { apply = appendPatch(apply, new VPatch(VPatch.PROPS, a, propsPatch)) } apply = diffChildren(a, b, patch, apply, index) } else { apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b)) applyClear = true } } else { apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b)) applyClear = true } } else if (isVText(b)) { if (!isVText(a)) { apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b)) applyClear = true } else if (a.text !== b.text) { apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b)) } } else if (isWidget(b)) { if (!isWidget(a)) { applyClear = true } apply = appendPatch(apply, new VPatch(VPatch.WIDGET, a, b)) } if (apply) { patch[index] = apply } if (applyClear) { clearState(a, patch, index) } } function diffChildren(a, b, patch, apply, index) { var aChildren = a.children var orderedSet = reorder(aChildren, b.children) var bChildren = orderedSet.children var aLen = aChildren.length var bLen = bChildren.length var len = aLen > bLen ? aLen : bLen for (var i = 0; i < len; i++) { var leftNode = aChildren[i] var rightNode = bChildren[i] index += 1 if (!leftNode) { if (rightNode) { // Excess nodes in b need to be added apply = appendPatch(apply, new VPatch(VPatch.INSERT, null, rightNode)) } } else { walk(leftNode, rightNode, patch, index) } if (isVNode(leftNode) && leftNode.count) { index += leftNode.count } } if (orderedSet.moves) { // Reorder nodes last apply = appendPatch(apply, new VPatch( VPatch.ORDER, a, orderedSet.moves )) } return apply } function clearState(vNode, patch, index) { // TODO: Make this a single walk, not two unhook(vNode, patch, index) destroyWidgets(vNode, patch, index) } // Patch records for all destroyed widgets must be added because we need // a DOM node reference for the destroy function function destroyWidgets(vNode, patch, index) { if (isWidget(vNode)) { if (typeof vNode.destroy === "function") { patch[index] = appendPatch( patch[index], new VPatch(VPatch.REMOVE, vNode, null) ) } } else if (isVNode(vNode) && (vNode.hasWidgets || vNode.hasThunks)) { var children = vNode.children var len = children.length for (var i = 0; i < len; i++) { var child = children[i] index += 1 destroyWidgets(child, patch, index) if (isVNode(child) && child.count) { index += child.count } } } else if (isThunk(vNode)) { thunks(vNode, null, patch, index) } } // Create a sub-patch for thunks function thunks(a, b, patch, index) { var nodes = handleThunk(a, b) var thunkPatch = diff(nodes.a, nodes.b) if (hasPatches(thunkPatch)) { patch[index] = new VPatch(VPatch.THUNK, null, thunkPatch) } } function hasPatches(patch) { for (var index in patch) { if (index !== "a") { return true } } return false } // Execute hooks when two nodes are identical function unhook(vNode, patch, index) { if (isVNode(vNode)) { if (vNode.hooks) { patch[index] = appendPatch( patch[index], new VPatch( VPatch.PROPS, vNode, undefinedKeys(vNode.hooks) ) ) } if (vNode.descendantHooks || vNode.hasThunks) { var children = vNode.children var len = children.length for (var i = 0; i < len; i++) { var child = children[i] index += 1 unhook(child, patch, index) if (isVNode(child) && child.count) { index += child.count } } } } else if (isThunk(vNode)) { thunks(vNode, null, patch, index) } } function undefinedKeys(obj) { var result = {} for (var key in obj) { result[key] = undefined } return result } // List diff, naive left to right reordering function reorder(aChildren, bChildren) { // O(M) time, O(M) memory var bChildIndex = keyIndex(bChildren) var bKeys = bChildIndex.keys var bFree = bChildIndex.free if (bFree.length === bChildren.length) { return { children: bChildren, moves: null } } // O(N) time, O(N) memory var aChildIndex = keyIndex(aChildren) var aKeys = aChildIndex.keys var aFree = aChildIndex.free if (aFree.length === aChildren.length) { return { children: bChildren, moves: null } } // O(MAX(N, M)) memory var newChildren = [] var freeIndex = 0 var freeCount = bFree.length var deletedItems = 0 // Iterate through a and match a node in b // O(N) time, for (var i = 0 ; i < aChildren.length; i++) { var aItem = aChildren[i] var itemIndex if (aItem.key) { if (bKeys.hasOwnProperty(aItem.key)) { // Match up the old keys itemIndex = bKeys[aItem.key] newChildren.push(bChildren[itemIndex]) } else { // Remove old keyed items itemIndex = i - deletedItems++ newChildren.push(null) } } else { // Match the item in a with the next free item in b if (freeIndex < freeCount) { itemIndex = bFree[freeIndex++] newChildren.push(bChildren[itemIndex]) } else { // There are no free items in b to match with // the free items in a, so the extra free nodes // are deleted. itemIndex = i - deletedItems++ newChildren.push(null) } } } var lastFreeIndex = freeIndex >= bFree.length ? bChildren.length : bFree[freeIndex] // Iterate through b and append any new keys // O(M) time for (var j = 0; j < bChildren.length; j++) { var newItem = bChildren[j] if (newItem.key) { if (!aKeys.hasOwnProperty(newItem.key)) { // Add any new keyed items // We are adding new items to the end and then sorting them // in place. In future we should insert new items in place. newChildren.push(newItem) } } else if (j >= lastFreeIndex) { // Add any leftover non-keyed items newChildren.push(newItem) } } var simulate = newChildren.slice() var simulateIndex = 0 var removes = [] var inserts = [] var simulateItem for (var k = 0; k < bChildren.length;) { var wantedItem = bChildren[k] simulateItem = simulate[simulateIndex] // remove items while (simulateItem === null && simulate.length) { removes.push(remove(simulate, simulateIndex, null)) simulateItem = simulate[simulateIndex] } if (!simulateItem || simulateItem.key !== wantedItem.key) { // if we need a key in this position... if (wantedItem.key) { if (simulateItem && simulateItem.key) { // if an insert doesn't put this key in place, it needs to move if (bKeys[simulateItem.key] !== k + 1) { removes.push(remove(simulate, simulateIndex, simulateItem.key)) simulateItem = simulate[simulateIndex] // if the remove didn't put the wanted item in place, we need to insert it if (!simulateItem || simulateItem.key !== wantedItem.key) { inserts.push({key: wantedItem.key, to: k}) } // items are matching, so skip ahead else { simulateIndex++ } } else { inserts.push({key: wantedItem.key, to: k}) } } else { inserts.push({key: wantedItem.key, to: k}) } k++ } // a key in simulate has no matching wanted key, remove it else if (simulateItem && simulateItem.key) { removes.push(remove(simulate, simulateIndex, simulateItem.key)) } } else { simulateIndex++ k++ } } // remove all the remaining nodes from simulate while(simulateIndex < simulate.length) { simulateItem = simulate[simulateIndex] removes.push(remove(simulate, simulateIndex, simulateItem && simulateItem.key)) } // If the only moves we have are deletes then we can just // let the delete patch remove these items. if (removes.length === deletedItems && !inserts.length) { return { children: newChildren, moves: null } } return { children: newChildren, moves: { removes: removes, inserts: inserts } } } function remove(arr, index, key) { arr.splice(index, 1) return { from: index, key: key } } function keyIndex(children) { var keys = {} var free = [] var length = children.length for (var i = 0; i < length; i++) { var child = children[i] if (child.key) { keys[child.key] = i } else { free.push(i) } } return { keys: keys, // A hash of key name to index free: free // An array of unkeyed item indices } } function appendPatch(apply, patch) { if (apply) { if (isArray(apply)) { apply.push(patch) } else { apply = [apply, patch] } return apply } else { return patch } } },{"../vnode/handle-thunk":82,"../vnode/is-thunk":83,"../vnode/is-vnode":85,"../vnode/is-vtext":86,"../vnode/is-widget":87,"../vnode/vpatch":90,"./diff-props":92,"x-is-array":94}],94:[function(require,module,exports){ var nativeIsArray = Array.isArray var toString = Object.prototype.toString module.exports = nativeIsArray || isArray function isArray(obj) { return toString.call(obj) === "[object Array]" } },{}],95:[function(require,module,exports){ module.exports={ "name": "bars", "version": "1.7.1", "description": "Bars is a lightweight high performance HTML aware templating engine.", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { "type": "git", "url": "git+https://github.com/Mike96Angelo/Bars.git" }, "keywords": [ "bars", "render", "renderer", "rendering", "template", "templating", "html" ], "author": "Michaelangelo Jong", "license": "MIT", "bugs": { "url": "https://github.com/Mike96Angelo/Bars/issues" }, "homepage": "https://github.com/Mike96Angelo/Bars#readme", "dependencies": { "compileit": "^1.0.1", "generate-js": "^3.1.2", "jquery": "^3.1.1", "source-map": "^0.5.6", "virtual-dom": "^2.1.1" }, "devDependencies": { "browserify": "^13.1.1", "colors": "^1.1.2", "gulp": "^3.9.1", "gulp-minify": "0.0.14", "stringify": "^5.1.0", "vinyl-buffer": "^1.0.0", "vinyl-source-stream": "^1.1.0" } } },{}]},{},[1])(1) });
describe('wokArmyBuilder.builder.army.optionList', function () { beforeEach(module('wokArmyBuilder')); describe('wokOptionListController', function () { var controller, $scope, Army, Models, gameSizes; beforeEach(function () { module('wokArmyBuilder.builder.army.coreList', function ($provide) { $provide.service('Army', function () { angular.extend(this, { options: jasmine.createSpy('options').and.callFake(function () { return 0; }), gameSize: 'Skirmish', lists: { 'Core List': { Leader: [0], Infantry: [0], Specialist: [0] }, 'Options List #1': { Infantry: [0], Specialist: [0] }, 'Options List #2': { Infantry: [0], Specialist: [0] } } }); }); }); }); beforeEach(inject(function ($controller, $rootScope, _Army_, _Models_, _gameSizes_) { $scope = $rootScope.$new(); $scope.list = 'Options List #1'; Army = _Army_; Models = _Models_; gameSizes = _gameSizes_; controller = $controller('OptionListController', { $scope: $scope, Army: Army, Models: Models, gameSizes: gameSizes }); })); describe('army', function () { beforeEach(function () { spyOn($scope, '$broadcast'); Models.load('Goritsi'); }); it('should be initialized to Army service', function () { expect($scope.army).toEqual(Army); }); it('should call options when lists[Options List #] arrays change', function () { Army.lists['Options List #1'].Infantry[0] = 1; $scope.$digest(); expect(Army.options).toHaveBeenCalled(); expect($scope.options).toEqual(0); expect($scope.$broadcast).toHaveBeenCalledWith('setNotEnoughRanks', Models.Infantry[0], false); }); }); describe('maxOptions', function () { it('should return the maximum options for a given list', function () { expect($scope.maxOptions()).toEqual(6); }); }); describe('models', function () { it('should be initialized to Models service', function () { expect($scope.models).toBe(Models); }); }); describe('options', function () { it('should be initialized to 0', function () { expect($scope.options).toEqual(0); }); }); describe('coreListCharacterSelected event', function () { beforeEach(function () { spyOn($scope, '$broadcast'); $scope.$emit('coreListCharacterSelected', {}, false); }); it('should broadcast a setSelectedCharacter event', function () { expect($scope.$broadcast).toHaveBeenCalledWith('setSelectedCharacter', {}, false); }); }); }); });
// const express = require('express'); const Activity = require("../models/activities"); const Trip = require("../models/trip"); const User = require("../models/user"); const router = express.Router(); var app = express(); /* GET activities. */ router.get('/trip/:id/activities', (req, res, next) => { var tripid = req.params.id; Trip .findOne({ _id: tripid }) .populate("activities") .exec((err, trip) => { if (err) { next(err); return; } res.render('app/activity', { trip, user: req.user }); }); }); router.post('/trip/:id/activities', (req, res, next) => { // tripId that is selected var tripid = req.body.tripid; console.log("tripid", tripid); var newActivity = new Activity({ date: req.body.date, location: req.body.location_name, latitude: req.body.lat, longitude: req.body.lng, category: req.body.category, text: req.body.notes, price: req.body.price }); newActivity.save((err, doc) => { // Trip.findByIdAndUpdate(push newActivity.id) if err else console.log("doooooc", doc); Trip.findById(tripid, (err, trip) => { trip.activities.push(doc._id); trip.save(); res.json(doc); }) }); }) module.exports = router;
'use strict'; const assert = require('assert'); //const app = require('../../../src/app'); describe('user service', function() { it('registered the users service', () => { // assert.ok(app.service('users')); }); });
'use strict' const sgf = require('staged-git-files') const Listr = require('listr') const has = require('lodash/has') const pify = require('pify') const makeCmdTasks = require('./makeCmdTasks') const generateTasks = require('./generateTasks') const resolveGitDir = require('./resolveGitDir') const debug = require('debug')('lint-staged:run') /** * Executes all tasks and either resolves or rejects the promise * @param config {Object} * @returns {Promise} */ module.exports = function runAll(config) { debug('Running all linter scripts') // Config validation if (!config || !has(config, 'concurrent') || !has(config, 'renderer')) { throw new Error('Invalid config provided to runAll! Use getConfig instead.') } const { concurrent, renderer, chunkSize, subTaskConcurrency } = config const gitDir = resolveGitDir() debug('Resolved git directory to be `%s`', gitDir) sgf.cwd = gitDir return pify(sgf)('ACM').then(files => { /* files is an Object{ filename: String, status: String } */ const filenames = files.map(file => file.filename) debug('Loaded list of staged files in git:\n%O', filenames) const tasks = generateTasks(config, filenames).map(task => ({ title: `Running tasks for ${task.pattern}`, task: () => new Listr( makeCmdTasks(task.commands, task.fileList, { chunkSize, subTaskConcurrency }), { // In sub-tasks we don't want to run concurrently // and we want to abort on errors dateFormat: false, concurrent: false, exitOnError: true } ), skip: () => { if (task.fileList.length === 0) { return `No staged files match ${task.pattern}` } return false } })) if (tasks.length) { return new Listr(tasks, { dateFormat: false, concurrent, renderer, exitOnError: !concurrent // Wait for all errors when running concurrently }).run() } return 'No tasks to run.' }) }
var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var routes = require('./routes'); var app = express(); // view engine setup app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); // uncomment after placing your favicon in /public //app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); //app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(cookieParser()); app.use(express.static(path.join(__dirname, 'public'))); app.use('/get', routes); module.exports = app;
//document.write 只能重绘整个页面 // //innerHTML 可以重绘页面的一部分 var d = document.getElementById("d");
import Test from '../../_helpers/Test' import bp from '../../_helpers/breakpoints' import mq from '../../_helpers/mq' import report_result_summary from '../../_helpers/report_result_summary' import sequence from '../../_helpers/sequence' import ResultTracker from '../../_helpers/ResultTracker' import apply_style from '../../_helpers/apply_style' export default function () { let outsideHeightResults = new ResultTracker() class positiveTest_low extends Test { constructor({ name, test }) { super({ name: `positive low outsideHeight ${name}`, test, size: [bp.small], mqMatch: true, localTracker: outsideHeightResults, }) } } class positiveTest_high extends Test { constructor({ name, test }) { super({ name: `positive high outsideHeight ${name}`, test, size: [bp.large, bp.large + 1], mqMatch: true, localTracker: outsideHeightResults, }) } } class negativeTest_low extends Test { constructor({ name, test }) { super({ name: `negative low outsideHeight ${name}`, size: [bp.small, bp.small + 1], mqMatch: false, test: test, localTracker: outsideHeightResults, }) } } class negativeTest_high extends Test { constructor({ name, test }) { super({ name: `negative high outsideHeight ${name}`, size: [bp.large], mqMatch: false, test: test, localTracker: outsideHeightResults, }) } } const positive_tests = [ new positiveTest_low({ name: `"small" (if)`, test: () => mq.outsideHeight('small', 'large'), }), new positiveTest_low({ name: `${bp.small} (if)`, test: () => mq.outsideHeight(bp.large, bp.small), }), new positiveTest_low({ name: `"small" (cb)`, test: () => { let result = false mq.outsideHeight('large', 'small', () => { result = true }) return result }, }), new positiveTest_low({ name: `${bp.small} (cb)`, test: () => { let result = false mq.outsideHeight(bp.small, bp.large, () => { result = true }) return result }, }), new positiveTest_high({ name: `"large" (if)`, test: () => mq.outsideHeight('small', 'large'), }), new positiveTest_high({ name: `${bp.large} (if)`, test: () => mq.outsideHeight(bp.large, bp.small), }), new positiveTest_high({ name: `"large" (cb)`, test: () => { let result = false mq.outsideHeight('large', 'small', () => { result = true }) return result }, }), new positiveTest_high({ name: `${bp.large} (cb)`, test: () => { let result = false mq.outsideHeight(bp.small, bp.large, () => { result = true }) return result }, }), ] const negative_tests = [ new negativeTest_high({ name: `"large" (if)`, test: () => mq.outsideHeight('large', 'small'), }), new negativeTest_high({ name: `${bp.large} (if)`, test: () => mq.outsideHeight(bp.small, bp.large), }), new negativeTest_high({ name: `"large" (cb)`, test: () => { let result = false mq.outsideHeight('small', 'large', () => { result = true }) return result }, }), new negativeTest_high({ name: `${bp.large} (cb)`, test: () => { let result = false mq.outsideHeight(bp.large, bp.small, () => { result = true }) return result }, }), new negativeTest_low({ name: `"small" (if)`, test: () => mq.outsideHeight('large', 'small'), }), new negativeTest_low({ name: `${bp.small} (if)`, test: () => mq.outsideHeight(bp.small, bp.large), }), new negativeTest_low({ name: `"small" (cb)`, test: () => { let result = false mq.outsideHeight('small', 'large', () => { result = true }) return result }, }), new negativeTest_low({ name: `${bp.small} (cb)`, test: () => { let result = false mq.outsideHeight(bp.large, bp.small, () => { result = true }) return result }, }), ] return sequence([ apply_style('outsideHeight'), ...positive_tests, ...negative_tests, report_result_summary('outsideHeight', outsideHeightResults), ]) }
// gulpfile.js "use strict"; import gulp from "gulp"; import path from "path"; import fs from "fs"; import htmlmin from "gulp-htmlmin"; import uglify from "gulp-uglify"; import rename from "gulp-rename"; import concatCss from "gulp-concat-css"; import csso from "gulp-csso"; import inject from "gulp-inject"; import replace from "gulp-replace"; import browserify from "browserify"; import source from "vinyl-source-stream"; import gutil from "gulp-util"; import tap from "gulp-tap"; import buffer from "gulp-buffer"; import sourcemaps from "gulp-sourcemaps"; import concat from "gulp-concat"; import uncss from "gulp-uncss"; import eslint from "gulp-eslint"; import del from "del"; import gulpIf from "gulp-if"; const APP_PATH = path.join(__dirname, "app"); const APP_CSS_PATH = path.join(APP_PATH, "css"); const APP_JS_PATH = path.join(APP_PATH, "js"); const INDEX_TEMPLATE_PATH = path.join(APP_PATH, "index.template.html"); const DEST_PATH = path.join(APP_PATH, "assets"); const DEST_PATH_JS = path.join(DEST_PATH, "js"); const DEST_PATH_CSS = path.join(DEST_PATH, "css"); const DEST_PATH_FONTS = path.join(DEST_PATH, "fonts"); const TEMPLATES_PATH = path.join(APP_PATH, "templates/**/*.html"); const IS_PRODUCTION = !process.env.NODE_ENV || process.env.NODE_ENV == "production"; function getDirectories(dir) { return fs.readdirSync(dir) .filter(function(file) { return fs.statSync(path.join(dir, file)).isDirectory(); }); } gulp.task("inject-html", (cb) => { let srcCss = gulp.src([DEST_PATH_CSS + "/*.css", "!" + DEST_PATH_CSS + "/*.min.css"], {read: false}); let appJs = gulp.src([APP_JS_PATH + "/*.js", APP_JS_PATH + "/*.min.js"], {read: false}); let allJS = gulp.src([DEST_PATH_JS + "/*.js", "!" + DEST_PATH_CSS + "/*.min.js"], {read: false}); gulp.src(INDEX_TEMPLATE_PATH) .pipe(inject(srcCss, { removeTags: true })) .pipe(inject(allJS, { starttag: "<!-- inject:all-js -->", removeTags: true })) .pipe(inject(appJs, { starttag: "<!-- inject:js-app -->", removeTags: true })) .pipe(replace("/app/", "")) .pipe(rename("index.html")) .pipe(gulpIf(IS_PRODUCTION, htmlmin({ collapseWhitespace: true, removeComments: true, quoteCharacter: "\"" }))) .pipe(gulpIf(IS_PRODUCTION, rename("index.min.html"))) .pipe(gulp.dest(DEST_PATH)); cb(); }); gulp.task("clean:js", () => { return del(DEST_PATH_JS); }); gulp.task("concat-js", (cb) => { let directories = getDirectories(APP_JS_PATH); directories.map( (dirName) => { return gulp.src([path.join(APP_JS_PATH, dirName, "/*.js"), "!" + path.join(APP_JS_PATH, dirName, "/angular.js")]) // concat into dirName.bundle.js .pipe(concat(dirName + ".bundle.js")) // write to output .pipe(gulp.dest(DEST_PATH_JS)); }) cb(); }); gulp.task("eslint", (cb) => { let allJS = gulp.src([path.join(APP_JS_PATH, "**/*.js"), "!" + path.join(APP_JS_PATH, "vendors/*.js"), path.join(__dirname, "gulpfile.babel.js")]); allJS // eslint() attaches the lint output to the "eslint" property // of the file object so it can be used by other modules. .pipe(eslint()) // eslint.format() outputs the lint results to the console. // Alternatively use eslint.formatEach() (see Docs). .pipe(eslint.format()) // To have the process exit with an error code (1) on // lint error, return the stream and pipe to failAfterError last. .pipe(eslint.failAfterError()); cb(); }); gulp.task("uglify-js", (cb) => { let allJS = gulp.src(path.join(DEST_PATH_JS, "/*.js")); allJS .pipe(uglify()) .pipe(rename({ extname: ".min.js" })) .pipe(gulp.dest(DEST_PATH_JS)); cb(); }); gulp.task("transpile", (cb) => { let assetsJS = gulp.src(path.join(DEST_PATH_JS, "/*.bundle.js")); assetsJS .pipe(tap( (file) => { gutil.log("bundling " + file.path) file.contents = browserify(file.path, { debug: true }) .transform("babelify") .bundle(); })) // transform streaming contents into buffer contents (because gulp-sourcemaps does not support streaming contents) .pipe(buffer()) .pipe(gulp.dest(DEST_PATH_JS)); cb(); }); gulp.task("copy-css", () => { let bootstrapCss = path.normalize("bower_components/bootstrap/dist/css/bootstrap.css"); return gulp.src(bootstrapCss) .pipe(gulp.dest(APP_CSS_PATH)); }); gulp.task("minify-css", (cb) => { let allCss = gulp.src(path.join(APP_CSS_PATH, "/*.css")); allCss .pipe(concatCss("styles.css")) .pipe(gulp.dest(DEST_PATH_CSS)) .pipe(uncss({ html: [INDEX_TEMPLATE_PATH, TEMPLATES_PATH] })) .pipe(csso({ restructure: false, sourceMap: true, debug: true, comments: false })) .pipe(rename("styles.min.css")) .pipe(gulp.dest(DEST_PATH_CSS)); cb(); }); gulp.task("copy-fonts", (cb) => { let bootstrapFonts = gulp.src(path.normalize("bower_components/bootstrap/fonts/glyphicons*")); bootstrapFonts .pipe(gulp.dest(DEST_PATH_FONTS)); cb(); }); gulp.task("assets", ["copy-css", "copy-fonts", "minify-css", "transpile", "uglify-js", "inject-html"]); gulp.task("default", ["clean:js", "concat-js", "transpile"]);
import React from 'react' import cookie from 'react-cookie' import { Link } from 'react-router' import url from '../../config.js' // components import NavBar from './NavBar' import Header from './Header' import ToggleDisplay from 'react-toggle-display' import FlatButton from 'material-ui/lib/flat-button' import RaisedButton from 'material-ui/lib/raised-button' import TextField from 'material-ui/lib/text-field' // database functions import postRequest from '../postRequest.js' import getRequest from '../getRequest.js' // material-ui helpers import GetMuiTheme from 'material-ui/lib/styles/getMuiTheme' import MyTheme from '../theme.js'; export default React.createClass ({ childContextTypes : { muiTheme: React.PropTypes.object }, getChildContext() { return { muiTheme: GetMuiTheme(MyTheme), } }, getInitialState: function () { return { name: "", target: 0, sobstory: "", photo: "", isUploaded: false, alreadyHasTeeth: false, isLoggedIn: false, profileURL: "" } }, handleName: function (e) { this.setState({'name': e.target.value}) }, handleTarget: function (e) { this.setState({'target': e.target.value}) }, handleSobstory: function (e) { this.setState({'sobstory': e.target.value}) }, photoUploaded: function (error, l){ this.setState({'photo': l[0].secure_url}) this.setState({'isUploaded': true}) }, componentDidMount: function () { if (cookie.load('donorID')) { this.setState({'isLoggedIn': true}) } var _this = this document.getElementById("upload_widget_opener").addEventListener("click", function () { cloudinary.openUploadWidget({ cloud_name: 'toothandpail', upload_preset: 'fasiveib' }, function (error, result) { _this.photoUploaded(error, result) }) }, false) this.handleIsUser() }, handleIsUser: function () { var _this = this getRequest(url + '/recipientsbydonor/' + cookie.load('donorID'), _this.handleExistingUser) }, handleExistingUser: function (err, data) { console.log("data", data) if (data !== undefined) { var profileURL = "/recipient/" + data.recipientID this.setState({'profileURL': profileURL}) this.setState({'alreadyHasTeeth': true}) } }, handleSubmit: function () { let _this = this let dataObject = { name: this.state.name, imgURL: this.state.photo, received: 0, target: this.state.target, sobStory: this.state.sobstory, donorID: cookie.load('donorID') } postRequest(url + '/recipients', dataObject, _this.handleIsUser) }, render: function () { return ( <div> <NavBar/> <Header header={this.props.recipientID}/> <div className="twelve columns" id="RecipientForm"> <ToggleDisplay show={this.state.isLoggedIn}> <ToggleDisplay hide={this.state.alreadyHasTeeth}> <h2>Submit Your Teeth</h2> <p>Need funding for dental treatment? Submit your details here and with the help of our generous donors, the funding you need could be closer than you think.</p> Your name <br /> <TextField id={1} type="text" className="name" id="name" onChange={this.handleName} /> <br /> How much do you need to raise for your treatment? <br /> <TextField id={2} type="number" className="target" id="target" onChange={this.handleTarget} /> <br /> Tell us about why you need funding? <br /> <TextField id={3} type='text' multiLine={true} id="sobstory" rows={8} fullWidth onChange={this.handleSobstory} /> <br /> <FlatButton secondary={true} label="Upload picture" backgroundColor='red' id="upload_widget_opener" /> <br /> <ToggleDisplay show={this.state.isUploaded}> <p>Photo uploaded!</p> </ToggleDisplay> <br /> <RaisedButton label="Submit your teeth!" onClick={this.handleSubmit} /> </ToggleDisplay> <ToggleDisplay show={this.state.alreadyHasTeeth}> <p>Thank you for requesting funding for your teeth. Check out your profile!</p> <RaisedButton label="Show me my teeth" className="showmyteeth" onClick={() => {this.props.history.push(this.state.profileURL)}}/> </ToggleDisplay> </ToggleDisplay> <ToggleDisplay hide={this.state.isLoggedIn}> <h2>Oops!</h2> <p>You need to log in before you can request funding!</p> <RaisedButton label="Login / Signup" className="login-signup" onClick={() => {this.props.history.push('/')}}/> </ToggleDisplay> </div> </div> ) } })
import React from 'react'; import style from 'PVWStyle/ReactProperties/CheckboxProperty.mcss'; export default React.createClass({ displayName: 'Checkbox', propTypes: { idx: React.PropTypes.number, label: React.PropTypes.string, onChange: React.PropTypes.func, value: React.PropTypes.bool, }, getDefaultProps() { return { value: false, label: '', }; }, valueChange(e) { if (this.props.onChange) { if (this.props.idx >= 0) { this.props.onChange(this.props.idx, e.target.checked); } else { this.props.onChange(null, e.target.checked); } } }, render() { return ( <div> <label className={style.label}>{this.props.label}</label> <input className={style.input} type="checkbox" checked={this.props.value} onChange={this.valueChange} /> </div>); }, });
/** * runApp * Created by dcorns on 1/3/15. * Returns a new object with a run method that executes os commands in node. */ 'use strict'; module.exports = function(){ this.run = function run(arg, cnn, cmd){ var spawn = require('child_process').spawn; var proc = spawn(cmd, arg); proc.on('exit', function(code){ console.log(cmd + ' exit code:' + code); }); proc.stderr.on('data', function (data) { console.log('stderr: ' + data); cnn.write(data); }); proc.stdout.on('data', function (ot) { cnn.write(ot); }); }; };
define(function () { var Meal = function () { this.ids = {}; this.time = null; this.timezone = null; // if available this.params = { }; /* this.params = { // in grams or ml 'calories': 900, 'fat': 99 }; */ }; return Meal; });
var gulp = require('gulp'); var del = require('del'); var config = require('../config'); gulp.task('clean', function(cb) { del([config.dir_dist + '/**'], cb); });
module.exports = { re: /^https?:\/\/(?:[\w\-]+\.)?genius\.com\/(?!jobs)([a-zA-Z\-]+)/i, mixins: [ "domain-icon", "*" ], getLinks: function(urlMatch, twitter) { var id = twitter.app.url.iphone.match(/\d+/)[0]; if (id) { return { html: '<div id="rg_embed_link_' + id + '" class="rg_embed_link" data-song-id="' + id + '"></div><script src="//genius.com/songs/' + id + '/embed.js?dark=1"></script>', type: CONFIG.T.text_html, rel: [CONFIG.R.reader, CONFIG.R.ssl] }; } }, tests: [{ page: 'http://rap.genius.com/', selector: '.song_link' }, { skipMixins: ["favicon"]}, "http://rock.genius.com/Bruce-springsteen-4th-of-july-asbury-park-sandy-lyrics", "http://rap.genius.com/Beyonce-flawless-remix-lyrics" ] };
// Karma configuration // Generated on Thu Oct 01 2015 17:56:10 GMT+0900 (JST) module.exports = function(config) { config.set({ // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '', // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['jasmine', 'browserify'], // list of files / patterns to load in the browser files: [ 'spec/**/*.js' ], // list of files to exclude exclude: [ ], // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { 'src/js/**/*.js': ['browserify'], 'spec/**/*.js': ['browserify'] }, browserify: { debug: true, transform: ['rewireify', 'babelify'] }, // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter reporters: ['mocha'], // web server port port: 9876, // enable / disable colors in the output (reporters and logs) colors: true, // level of logging // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG logLevel: config.LOG_INFO, // enable / disable watching file and executing tests whenever any file changes autoWatch: true, // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: ['Chrome'], // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits singleRun: false, // To prevent this error: https://github.com/karma-runner/karma/issues/598 browserNoActivityTimeout: 60000 }) }
var creds = (function () { var creds = {}; creds.API_SECRET=""; creds.API_KEY=""; creds.AUTHOR=''; return creds; }());
/* * grunt-arcgis-press * https://github.com/agrc/grunt-arcgis-press * * Copyright (c) 2015 Steve Gourley & Scott Davis * Licensed under the MIT license. */ 'use strict'; module.exports = function(grunt) { var PythonShell = require('python-shell'); var chalk = require('chalk'); var mixin = require('./lib/mixin_options'); var Promise = require('promise'); var path = require('path'); grunt.registerMultiTask('arcgis_press', 'A grunt task for covering your ArcGIS service publishing needs. Hot off the press!', function() { var done = this.async(); // create temp folder if needed var tempFolder = path.join(process.cwd(), '.grunt', 'grunt-arcgis-press'); if (!grunt.file.exists(tempFolder)) { grunt.file.mkdir(tempFolder); } // need to use our own mixin because grunt's doesn't do a deep mixin var config = mixin(grunt.config('arcgis_press'), this.target); var commonArgs = [ config.server.host, config.server.username, config.server.password ]; var shellOptions = { cwd: __dirname + '/scripts', pythonOptions: ['-m'], scriptPath: 'press' }; var promises = []; var invokePython = function(command, args) { shellOptions.args = [command].concat(commonArgs, args); return new Promise(function(resolve, reject) { PythonShell.run('', shellOptions, function(err, results) { if (err) { grunt.log.error(err.message); grunt.verbose.error(err.stack); reject(); } resolve(results); }); }); }; var publishService = function(service) { var basePath = null; if(service.type.toUpperCase() === 'MAPSERVER'){ basePath = config.mapServerBasePath; }else if(service.type.toUpperCase() === 'GPSERVER'){ basePath = config.gpServerBasePath; } service.resource = path.join(basePath, service.resource); var args = [ JSON.stringify(service), tempFolder ]; var sn = service.serviceName; grunt.log.writelns(chalk.blue('Publishing: ' + sn + ' to ' + config.server.host)); grunt.verbose.writelns(chalk.blue(sn + ': staging...')); return invokePython('stage', args) .then(function(results) { // the return value from the python script has an extra // character that causes the next script to error so we // need to trim it results[0] = results[0].trim(); results[1] = results[1].trim(); grunt.verbose.writelns(chalk.blue(sn + ': uploading...')); return invokePython('upload', results); }) .then(function() { grunt.verbose.writelns(chalk.blue(sn + ': updating service properties...')); return invokePython('edit', args); }) .then(function () { var msg = sn + ' (' + service.type + ') was successfully published to ' + config.server.host; grunt.log.writelns(chalk.blue(msg)); }); }; // loop through services for (var prop in config.services) { if (config.services.hasOwnProperty(prop)) { promises.push(publishService(config.services[prop])); } } Promise.all(promises).then(function() { done(); }, function() { done(false); }); }); };
var d = global.d; describe("bfs", function () { it("should throw a TypeError when no arguments are given", function () { expect(() => d.bfs().next()).toThrow(new TypeError("Argument 1 must be an Object or Array")); }); it("should throw a TypeError when any arguments are the wrong type", function () { expect(() => d.bfs(123).next()).toThrow(new TypeError("Argument 1 must be an Object or Array")); expect(() => d.bfs("test").next()).toThrow(new TypeError("Argument 1 must be an Object or Array")); expect(() => d.bfs({}, 123).next()).toThrow(new TypeError("Argument 2 must be a non-empty Object or Array")); expect(() => d.bfs({}, "test").next()).toThrow(new TypeError("Argument 2 must be a non-empty Object or Array")); }); it("should iterate all nodes and properties", function () { var keyCounts = global.createKeyCounter(); var testObject = global.testObjects["Multidimensional Cyclic"](); var iterator = d.bfs(testObject, testObject); var iteration = iterator.next(); while (!iteration.done) { keyCounts[iteration.value.accessor]++; iteration = iterator.next(); } //console.info("bfs Traversal & Iteration Results:"); for (var accessor in keyCounts) { //console.info("Accessor \"" + accessor + "\" was visited " + keyCounts[accessor] + " time(s)."); expect(keyCounts[accessor] > 0).toBe(true); } }); }); describe("dfs", function () { it("should throw a TypeError when no arguments are given", function () { expect(() => d.dfs().next()).toThrow(new TypeError("Argument 1 must be an Object or Array")); }); it("should throw a TypeError when any arguments are the wrong type", function () { expect(() => d.dfs(123).next()).toThrow(new TypeError("Argument 1 must be an Object or Array")); expect(() => d.dfs("test").next()).toThrow(new TypeError("Argument 1 must be an Object or Array")); expect(() => d.dfs({}, 123).next()).toThrow(new TypeError("Argument 2 must be a non-empty Object or Array")); expect(() => d.dfs({}, "test").next()).toThrow(new TypeError("Argument 2 must be a non-empty Object or Array")); }); it("should iterate all nodes and properties", function () { var keyCounts = global.createKeyCounter(); var testObject = global.testObjects["Multidimensional Cyclic"](); var iterator = d.dfs(testObject, testObject); var iteration = iterator.next(); while (!iteration.done) { keyCounts[iteration.value.accessor]++; iteration = iterator.next(); } //console.info("bfs Traversal & Iteration Results:"); for (var accessor in keyCounts) { //console.info("Accessor \"" + accessor + "\" was visited " + keyCounts[accessor] + " time(s)."); expect(keyCounts[accessor] > 0).toBe(true); } }); });
window.onload = function() { var video = document.getElementById('video'); var canvas = document.getElementById('canvas'); var context = canvas.getContext('2d'); var tracker = new tracking.ObjectTracker('eye'); tracking.track('#video', tracker, { camera: true }); tracker.on('track', function(event) { context.clearRect(0, 0, canvas.width, canvas.height); event.data.forEach(function(rect) { console.log(rect.x, rect.y, rect.width, rect.height); //print tracking to the page var log = document.getElementById("location-data").innerHTML; //document.getElementById("location-data").innerHTML = log + '<br />' + rect.x + ',' + rect.y + ',' + rect.width + ',' + rect.height context.strokeStyle = '#a64ceb'; context.strokeRect(rect.x, rect.y, rect.width, rect.height); context.font = '11px Helvetica'; context.fillStyle = "#fff"; context.fillText('x: ' + rect.x + 'px', rect.x + rect.width + 5, rect.y + 11); context.fillText('y: ' + rect.y + 'px', rect.x + rect.width + 5, rect.y + 22); }); }); };
'use strict'; exports.init = function(req, res){ res.render('new/index'); };
var CancelTextCommand = function() { this.Extends = SimpleCommand; this.execute = function(note) { //alert("CancelTextCommand"); var mediator = note.getBody(); var textEditor = null; if (mediator instanceof ModelObjectsTextsEditorMediator) { textEditor = mediator.getViewComponent().gridListSplitter.right.modelObjectsTextsEditor; } else { textEditor = mediator.getViewComponent().gridListSplitter.right.modelRelationsTextsEditor; } var properties = { "state": SjamayeeMediator.STATE_LIST, "textEditor": textEditor }; this.sendNotification(SjamayeeFacade.DATA_MODEL_CHANGE, properties); //this.sendNotification(SjamayeeFacade.TEXT_CANCELED,mediator); var toolBarMediator = null; if (mediator instanceof ModelObjectsTextsEditorMediator) { toolBarMediator = this.facade.retrieveMediator(ModelObjectsListMediator.ID); } else { toolBarMediator = this.facade.retrieveMediator(ModelRelationsGridMediator.ID); } toolBarMediator.setMessageText("Text canceled."); }; }; CancelTextCommand = new Class(new CancelTextCommand());
version https://git-lfs.github.com/spec/v1 oid sha256:1d9080414602f6f5917e7b36b5aba29a65872741dae9d855477b867a38088897 size 7969
'use strict'; var React = require('react-native'); var Navigation = require('./Navigation'); var CatalogCell = require('./CatalogCell'); var { StyleSheet, Text, View, ListView, Image, DrawerLayoutAndroid, TouchableHighlight, TouchableNativeFeedback, ToolbarAndroid, } = React; import {manager, ReactCBLite} from 'react-native-couchbase-lite' ReactCBLite.init(5984, 'admin', 'password', (e) => {}); var MyBooks = React.createClass({ getInitialState() { return { dataSource: new ListView.DataSource({ rowHasChanged: (row1, row2) => row1 !== row2, }), }; }, componentDidMount() { var remoteURL = 'https://infinitelibrary.cloudant.com/gitburg' var database = new manager('http://admin:password@localhost:5984/', 'demoapp'); database.createDatabase() .then((res) => { database.replicate(remoteURL, 'demoapp') }) .then((res) => { return database.getDesignDocument('_all_docs?include_docs=true&attachments=true') }) .then((res) => { this.setState({ dataSource: this.state.dataSource.cloneWithRows(res.rows) }); console.log(res.rows) }) .catch((ex) => {file:///android_asset/ console.log(ex) }) }, selectBook(book) { // fix for iOS/Android dismiss keyboard needs to be added this.props.navigator.push({ title: book.title, name: 'reader', book: book, }); }, goTo(route) { // fix for iOS/Android dismiss keyboard needs to be added this.props.navigator.push({ name: route, }); }, renderRow(data) { var book = data.doc return ( <CatalogCell key= {book._id} onSelect={() => this.selectBook(book)} book={book} style={styles.catalogCell} /> ); }, render() { var navigationView = ( <Navigation goToRoute= {(route) => this.goTo(route)}/> ); return ( <DrawerLayoutAndroid drawerWidth={300} drawerPosition={DrawerLayoutAndroid.positions.Left} ref={(drawer) => { return this.drawer = drawer }} renderNavigationView={() => navigationView}> <ToolbarAndroid actions={[]} navIcon={require('image!three_bar')} onIconClicked={() => this.drawer.openDrawer()} style={styles.toolBar} titleColor="white" title="My Books" /> <ListView dataSource={this.state.dataSource} renderRow={this.renderRow} style={styles.listView} /> </DrawerLayoutAndroid> ); }, }); var styles = StyleSheet.create({ catalogCell: { flex: 1 }, listView: { flex: 1, backgroundColor: '#F5FCFF', }, toolBar: { backgroundColor: '#FF5252', height: 56, }, }); module.exports = MyBooks;
/* */ "format cjs"; import ActionAccessibility from './action/accessibility'; export { ActionAccessibility }; import ActionAccessible from './action/accessible'; export { ActionAccessible }; import ActionAccountBalanceWallet from './action/account-balance-wallet'; export { ActionAccountBalanceWallet }; import ActionAccountBalance from './action/account-balance'; export { ActionAccountBalance }; import ActionAccountBox from './action/account-box'; export { ActionAccountBox }; import ActionAccountCircle from './action/account-circle'; export { ActionAccountCircle }; import ActionAddShoppingCart from './action/add-shopping-cart'; export { ActionAddShoppingCart }; import ActionAlarmAdd from './action/alarm-add'; export { ActionAlarmAdd }; import ActionAlarmOff from './action/alarm-off'; export { ActionAlarmOff }; import ActionAlarmOn from './action/alarm-on'; export { ActionAlarmOn }; import ActionAlarm from './action/alarm'; export { ActionAlarm }; import ActionAllOut from './action/all-out'; export { ActionAllOut }; import ActionAndroid from './action/android'; export { ActionAndroid }; import ActionAnnouncement from './action/announcement'; export { ActionAnnouncement }; import ActionAspectRatio from './action/aspect-ratio'; export { ActionAspectRatio }; import ActionAssessment from './action/assessment'; export { ActionAssessment }; import ActionAssignmentInd from './action/assignment-ind'; export { ActionAssignmentInd }; import ActionAssignmentLate from './action/assignment-late'; export { ActionAssignmentLate }; import ActionAssignmentReturn from './action/assignment-return'; export { ActionAssignmentReturn }; import ActionAssignmentReturned from './action/assignment-returned'; export { ActionAssignmentReturned }; import ActionAssignmentTurnedIn from './action/assignment-turned-in'; export { ActionAssignmentTurnedIn }; import ActionAssignment from './action/assignment'; export { ActionAssignment }; import ActionAutorenew from './action/autorenew'; export { ActionAutorenew }; import ActionBackup from './action/backup'; export { ActionBackup }; import ActionBook from './action/book'; export { ActionBook }; import ActionBookmarkBorder from './action/bookmark-border'; export { ActionBookmarkBorder }; import ActionBookmark from './action/bookmark'; export { ActionBookmark }; import ActionBugReport from './action/bug-report'; export { ActionBugReport }; import ActionBuild from './action/build'; export { ActionBuild }; import ActionCached from './action/cached'; export { ActionCached }; import ActionCameraEnhance from './action/camera-enhance'; export { ActionCameraEnhance }; import ActionCardGiftcard from './action/card-giftcard'; export { ActionCardGiftcard }; import ActionCardMembership from './action/card-membership'; export { ActionCardMembership }; import ActionCardTravel from './action/card-travel'; export { ActionCardTravel }; import ActionChangeHistory from './action/change-history'; export { ActionChangeHistory }; import ActionCheckCircle from './action/check-circle'; export { ActionCheckCircle }; import ActionChromeReaderMode from './action/chrome-reader-mode'; export { ActionChromeReaderMode }; import ActionClass from './action/class'; export { ActionClass }; import ActionCode from './action/code'; export { ActionCode }; import ActionCompareArrows from './action/compare-arrows'; export { ActionCompareArrows }; import ActionCopyright from './action/copyright'; export { ActionCopyright }; import ActionCreditCard from './action/credit-card'; export { ActionCreditCard }; import ActionDashboard from './action/dashboard'; export { ActionDashboard }; import ActionDateRange from './action/date-range'; export { ActionDateRange }; import ActionDelete from './action/delete'; export { ActionDelete }; import ActionDescription from './action/description'; export { ActionDescription }; import ActionDns from './action/dns'; export { ActionDns }; import ActionDoneAll from './action/done-all'; export { ActionDoneAll }; import ActionDone from './action/done'; export { ActionDone }; import ActionDonutLarge from './action/donut-large'; export { ActionDonutLarge }; import ActionDonutSmall from './action/donut-small'; export { ActionDonutSmall }; import ActionEject from './action/eject'; export { ActionEject }; import ActionEventSeat from './action/event-seat'; export { ActionEventSeat }; import ActionEvent from './action/event'; export { ActionEvent }; import ActionExitToApp from './action/exit-to-app'; export { ActionExitToApp }; import ActionExplore from './action/explore'; export { ActionExplore }; import ActionExtension from './action/extension'; export { ActionExtension }; import ActionFace from './action/face'; export { ActionFace }; import ActionFavoriteBorder from './action/favorite-border'; export { ActionFavoriteBorder }; import ActionFavorite from './action/favorite'; export { ActionFavorite }; import ActionFeedback from './action/feedback'; export { ActionFeedback }; import ActionFindInPage from './action/find-in-page'; export { ActionFindInPage }; import ActionFindReplace from './action/find-replace'; export { ActionFindReplace }; import ActionFingerprint from './action/fingerprint'; export { ActionFingerprint }; import ActionFlightLand from './action/flight-land'; export { ActionFlightLand }; import ActionFlightTakeoff from './action/flight-takeoff'; export { ActionFlightTakeoff }; import ActionFlipToBack from './action/flip-to-back'; export { ActionFlipToBack }; import ActionFlipToFront from './action/flip-to-front'; export { ActionFlipToFront }; import ActionGavel from './action/gavel'; export { ActionGavel }; import ActionGetApp from './action/get-app'; export { ActionGetApp }; import ActionGif from './action/gif'; export { ActionGif }; import ActionGrade from './action/grade'; export { ActionGrade }; import ActionGroupWork from './action/group-work'; export { ActionGroupWork }; import ActionHelpOutline from './action/help-outline'; export { ActionHelpOutline }; import ActionHelp from './action/help'; export { ActionHelp }; import ActionHighlightOff from './action/highlight-off'; export { ActionHighlightOff }; import ActionHistory from './action/history'; export { ActionHistory }; import ActionHome from './action/home'; export { ActionHome }; import ActionHourglassEmpty from './action/hourglass-empty'; export { ActionHourglassEmpty }; import ActionHourglassFull from './action/hourglass-full'; export { ActionHourglassFull }; import ActionHttp from './action/http'; export { ActionHttp }; import ActionHttps from './action/https'; export { ActionHttps }; import ActionImportantDevices from './action/important-devices'; export { ActionImportantDevices }; import ActionInfoOutline from './action/info-outline'; export { ActionInfoOutline }; import ActionInfo from './action/info'; export { ActionInfo }; import ActionInput from './action/input'; export { ActionInput }; import ActionInvertColors from './action/invert-colors'; export { ActionInvertColors }; import ActionLabelOutline from './action/label-outline'; export { ActionLabelOutline }; import ActionLabel from './action/label'; export { ActionLabel }; import ActionLanguage from './action/language'; export { ActionLanguage }; import ActionLaunch from './action/launch'; export { ActionLaunch }; import ActionLightbulbOutline from './action/lightbulb-outline'; export { ActionLightbulbOutline }; import ActionLineStyle from './action/line-style'; export { ActionLineStyle }; import ActionLineWeight from './action/line-weight'; export { ActionLineWeight }; import ActionList from './action/list'; export { ActionList }; import ActionLockOpen from './action/lock-open'; export { ActionLockOpen }; import ActionLockOutline from './action/lock-outline'; export { ActionLockOutline }; import ActionLock from './action/lock'; export { ActionLock }; import ActionLoyalty from './action/loyalty'; export { ActionLoyalty }; import ActionMarkunreadMailbox from './action/markunread-mailbox'; export { ActionMarkunreadMailbox }; import ActionMotorcycle from './action/motorcycle'; export { ActionMotorcycle }; import ActionNoteAdd from './action/note-add'; export { ActionNoteAdd }; import ActionOfflinePin from './action/offline-pin'; export { ActionOfflinePin }; import ActionOpacity from './action/opacity'; export { ActionOpacity }; import ActionOpenInBrowser from './action/open-in-browser'; export { ActionOpenInBrowser }; import ActionOpenInNew from './action/open-in-new'; export { ActionOpenInNew }; import ActionOpenWith from './action/open-with'; export { ActionOpenWith }; import ActionPageview from './action/pageview'; export { ActionPageview }; import ActionPanTool from './action/pan-tool'; export { ActionPanTool }; import ActionPayment from './action/payment'; export { ActionPayment }; import ActionPermCameraMic from './action/perm-camera-mic'; export { ActionPermCameraMic }; import ActionPermContactCalendar from './action/perm-contact-calendar'; export { ActionPermContactCalendar }; import ActionPermDataSetting from './action/perm-data-setting'; export { ActionPermDataSetting }; import ActionPermDeviceInformation from './action/perm-device-information'; export { ActionPermDeviceInformation }; import ActionPermIdentity from './action/perm-identity'; export { ActionPermIdentity }; import ActionPermMedia from './action/perm-media'; export { ActionPermMedia }; import ActionPermPhoneMsg from './action/perm-phone-msg'; export { ActionPermPhoneMsg }; import ActionPermScanWifi from './action/perm-scan-wifi'; export { ActionPermScanWifi }; import ActionPets from './action/pets'; export { ActionPets }; import ActionPictureInPictureAlt from './action/picture-in-picture-alt'; export { ActionPictureInPictureAlt }; import ActionPictureInPicture from './action/picture-in-picture'; export { ActionPictureInPicture }; import ActionPlayForWork from './action/play-for-work'; export { ActionPlayForWork }; import ActionPolymer from './action/polymer'; export { ActionPolymer }; import ActionPowerSettingsNew from './action/power-settings-new'; export { ActionPowerSettingsNew }; import ActionPregnantWoman from './action/pregnant-woman'; export { ActionPregnantWoman }; import ActionPrint from './action/print'; export { ActionPrint }; import ActionQueryBuilder from './action/query-builder'; export { ActionQueryBuilder }; import ActionQuestionAnswer from './action/question-answer'; export { ActionQuestionAnswer }; import ActionReceipt from './action/receipt'; export { ActionReceipt }; import ActionRecordVoiceOver from './action/record-voice-over'; export { ActionRecordVoiceOver }; import ActionRedeem from './action/redeem'; export { ActionRedeem }; import ActionReorder from './action/reorder'; export { ActionReorder }; import ActionReportProblem from './action/report-problem'; export { ActionReportProblem }; import ActionRestore from './action/restore'; export { ActionRestore }; import ActionRoom from './action/room'; export { ActionRoom }; import ActionRoundedCorner from './action/rounded-corner'; export { ActionRoundedCorner }; import ActionRowing from './action/rowing'; export { ActionRowing }; import ActionSchedule from './action/schedule'; export { ActionSchedule }; import ActionSearch from './action/search'; export { ActionSearch }; import ActionSettingsApplications from './action/settings-applications'; export { ActionSettingsApplications }; import ActionSettingsBackupRestore from './action/settings-backup-restore'; export { ActionSettingsBackupRestore }; import ActionSettingsBluetooth from './action/settings-bluetooth'; export { ActionSettingsBluetooth }; import ActionSettingsBrightness from './action/settings-brightness'; export { ActionSettingsBrightness }; import ActionSettingsCell from './action/settings-cell'; export { ActionSettingsCell }; import ActionSettingsEthernet from './action/settings-ethernet'; export { ActionSettingsEthernet }; import ActionSettingsInputAntenna from './action/settings-input-antenna'; export { ActionSettingsInputAntenna }; import ActionSettingsInputComponent from './action/settings-input-component'; export { ActionSettingsInputComponent }; import ActionSettingsInputComposite from './action/settings-input-composite'; export { ActionSettingsInputComposite }; import ActionSettingsInputHdmi from './action/settings-input-hdmi'; export { ActionSettingsInputHdmi }; import ActionSettingsInputSvideo from './action/settings-input-svideo'; export { ActionSettingsInputSvideo }; import ActionSettingsOverscan from './action/settings-overscan'; export { ActionSettingsOverscan }; import ActionSettingsPhone from './action/settings-phone'; export { ActionSettingsPhone }; import ActionSettingsPower from './action/settings-power'; export { ActionSettingsPower }; import ActionSettingsRemote from './action/settings-remote'; export { ActionSettingsRemote }; import ActionSettingsVoice from './action/settings-voice'; export { ActionSettingsVoice }; import ActionSettings from './action/settings'; export { ActionSettings }; import ActionShopTwo from './action/shop-two'; export { ActionShopTwo }; import ActionShop from './action/shop'; export { ActionShop }; import ActionShoppingBasket from './action/shopping-basket'; export { ActionShoppingBasket }; import ActionShoppingCart from './action/shopping-cart'; export { ActionShoppingCart }; import ActionSpeakerNotes from './action/speaker-notes'; export { ActionSpeakerNotes }; import ActionSpellcheck from './action/spellcheck'; export { ActionSpellcheck }; import ActionStars from './action/stars'; export { ActionStars }; import ActionStore from './action/store'; export { ActionStore }; import ActionSubject from './action/subject'; export { ActionSubject }; import ActionSupervisorAccount from './action/supervisor-account'; export { ActionSupervisorAccount }; import ActionSwapHoriz from './action/swap-horiz'; export { ActionSwapHoriz }; import ActionSwapVert from './action/swap-vert'; export { ActionSwapVert }; import ActionSwapVerticalCircle from './action/swap-vertical-circle'; export { ActionSwapVerticalCircle }; import ActionSystemUpdateAlt from './action/system-update-alt'; export { ActionSystemUpdateAlt }; import ActionTabUnselected from './action/tab-unselected'; export { ActionTabUnselected }; import ActionTab from './action/tab'; export { ActionTab }; import ActionTheaters from './action/theaters'; export { ActionTheaters }; import ActionThreeDRotation from './action/three-d-rotation'; export { ActionThreeDRotation }; import ActionThumbDown from './action/thumb-down'; export { ActionThumbDown }; import ActionThumbUp from './action/thumb-up'; export { ActionThumbUp }; import ActionThumbsUpDown from './action/thumbs-up-down'; export { ActionThumbsUpDown }; import ActionTimeline from './action/timeline'; export { ActionTimeline }; import ActionToc from './action/toc'; export { ActionToc }; import ActionToday from './action/today'; export { ActionToday }; import ActionToll from './action/toll'; export { ActionToll }; import ActionTouchApp from './action/touch-app'; export { ActionTouchApp }; import ActionTrackChanges from './action/track-changes'; export { ActionTrackChanges }; import ActionTranslate from './action/translate'; export { ActionTranslate }; import ActionTrendingDown from './action/trending-down'; export { ActionTrendingDown }; import ActionTrendingFlat from './action/trending-flat'; export { ActionTrendingFlat }; import ActionTrendingUp from './action/trending-up'; export { ActionTrendingUp }; import ActionTurnedInNot from './action/turned-in-not'; export { ActionTurnedInNot }; import ActionTurnedIn from './action/turned-in'; export { ActionTurnedIn }; import ActionUpdate from './action/update'; export { ActionUpdate }; import ActionVerifiedUser from './action/verified-user'; export { ActionVerifiedUser }; import ActionViewAgenda from './action/view-agenda'; export { ActionViewAgenda }; import ActionViewArray from './action/view-array'; export { ActionViewArray }; import ActionViewCarousel from './action/view-carousel'; export { ActionViewCarousel }; import ActionViewColumn from './action/view-column'; export { ActionViewColumn }; import ActionViewDay from './action/view-day'; export { ActionViewDay }; import ActionViewHeadline from './action/view-headline'; export { ActionViewHeadline }; import ActionViewList from './action/view-list'; export { ActionViewList }; import ActionViewModule from './action/view-module'; export { ActionViewModule }; import ActionViewQuilt from './action/view-quilt'; export { ActionViewQuilt }; import ActionViewStream from './action/view-stream'; export { ActionViewStream }; import ActionViewWeek from './action/view-week'; export { ActionViewWeek }; import ActionVisibilityOff from './action/visibility-off'; export { ActionVisibilityOff }; import ActionVisibility from './action/visibility'; export { ActionVisibility }; import ActionWatchLater from './action/watch-later'; export { ActionWatchLater }; import ActionWork from './action/work'; export { ActionWork }; import ActionYoutubeSearchedFor from './action/youtube-searched-for'; export { ActionYoutubeSearchedFor }; import ActionZoomIn from './action/zoom-in'; export { ActionZoomIn }; import ActionZoomOut from './action/zoom-out'; export { ActionZoomOut }; import AlertAddAlert from './alert/add-alert'; export { AlertAddAlert }; import AlertErrorOutline from './alert/error-outline'; export { AlertErrorOutline }; import AlertError from './alert/error'; export { AlertError }; import AlertWarning from './alert/warning'; export { AlertWarning }; import AvAddToQueue from './av/add-to-queue'; export { AvAddToQueue }; import AvAirplay from './av/airplay'; export { AvAirplay }; import AvAlbum from './av/album'; export { AvAlbum }; import AvArtTrack from './av/art-track'; export { AvArtTrack }; import AvAvTimer from './av/av-timer'; export { AvAvTimer }; import AvClosedCaption from './av/closed-caption'; export { AvClosedCaption }; import AvEqualizer from './av/equalizer'; export { AvEqualizer }; import AvExplicit from './av/explicit'; export { AvExplicit }; import AvFastForward from './av/fast-forward'; export { AvFastForward }; import AvFastRewind from './av/fast-rewind'; export { AvFastRewind }; import AvFiberDvr from './av/fiber-dvr'; export { AvFiberDvr }; import AvFiberManualRecord from './av/fiber-manual-record'; export { AvFiberManualRecord }; import AvFiberNew from './av/fiber-new'; export { AvFiberNew }; import AvFiberPin from './av/fiber-pin'; export { AvFiberPin }; import AvFiberSmartRecord from './av/fiber-smart-record'; export { AvFiberSmartRecord }; import AvForward10 from './av/forward-10'; export { AvForward10 }; import AvForward30 from './av/forward-30'; export { AvForward30 }; import AvForward5 from './av/forward-5'; export { AvForward5 }; import AvGames from './av/games'; export { AvGames }; import AvHd from './av/hd'; export { AvHd }; import AvHearing from './av/hearing'; export { AvHearing }; import AvHighQuality from './av/high-quality'; export { AvHighQuality }; import AvLibraryAdd from './av/library-add'; export { AvLibraryAdd }; import AvLibraryBooks from './av/library-books'; export { AvLibraryBooks }; import AvLibraryMusic from './av/library-music'; export { AvLibraryMusic }; import AvLoop from './av/loop'; export { AvLoop }; import AvMicNone from './av/mic-none'; export { AvMicNone }; import AvMicOff from './av/mic-off'; export { AvMicOff }; import AvMic from './av/mic'; export { AvMic }; import AvMovie from './av/movie'; export { AvMovie }; import AvMusicVideo from './av/music-video'; export { AvMusicVideo }; import AvNewReleases from './av/new-releases'; export { AvNewReleases }; import AvNotInterested from './av/not-interested'; export { AvNotInterested }; import AvPauseCircleFilled from './av/pause-circle-filled'; export { AvPauseCircleFilled }; import AvPauseCircleOutline from './av/pause-circle-outline'; export { AvPauseCircleOutline }; import AvPause from './av/pause'; export { AvPause }; import AvPlayArrow from './av/play-arrow'; export { AvPlayArrow }; import AvPlayCircleFilled from './av/play-circle-filled'; export { AvPlayCircleFilled }; import AvPlayCircleOutline from './av/play-circle-outline'; export { AvPlayCircleOutline }; import AvPlaylistAddCheck from './av/playlist-add-check'; export { AvPlaylistAddCheck }; import AvPlaylistAdd from './av/playlist-add'; export { AvPlaylistAdd }; import AvPlaylistPlay from './av/playlist-play'; export { AvPlaylistPlay }; import AvQueueMusic from './av/queue-music'; export { AvQueueMusic }; import AvQueuePlayNext from './av/queue-play-next'; export { AvQueuePlayNext }; import AvQueue from './av/queue'; export { AvQueue }; import AvRadio from './av/radio'; export { AvRadio }; import AvRecentActors from './av/recent-actors'; export { AvRecentActors }; import AvRemoveFromQueue from './av/remove-from-queue'; export { AvRemoveFromQueue }; import AvRepeatOne from './av/repeat-one'; export { AvRepeatOne }; import AvRepeat from './av/repeat'; export { AvRepeat }; import AvReplay10 from './av/replay-10'; export { AvReplay10 }; import AvReplay30 from './av/replay-30'; export { AvReplay30 }; import AvReplay5 from './av/replay-5'; export { AvReplay5 }; import AvReplay from './av/replay'; export { AvReplay }; import AvShuffle from './av/shuffle'; export { AvShuffle }; import AvSkipNext from './av/skip-next'; export { AvSkipNext }; import AvSkipPrevious from './av/skip-previous'; export { AvSkipPrevious }; import AvSlowMotionVideo from './av/slow-motion-video'; export { AvSlowMotionVideo }; import AvSnooze from './av/snooze'; export { AvSnooze }; import AvSortByAlpha from './av/sort-by-alpha'; export { AvSortByAlpha }; import AvStop from './av/stop'; export { AvStop }; import AvSubscriptions from './av/subscriptions'; export { AvSubscriptions }; import AvSubtitles from './av/subtitles'; export { AvSubtitles }; import AvSurroundSound from './av/surround-sound'; export { AvSurroundSound }; import AvVideoLibrary from './av/video-library'; export { AvVideoLibrary }; import AvVideocamOff from './av/videocam-off'; export { AvVideocamOff }; import AvVideocam from './av/videocam'; export { AvVideocam }; import AvVolumeDown from './av/volume-down'; export { AvVolumeDown }; import AvVolumeMute from './av/volume-mute'; export { AvVolumeMute }; import AvVolumeOff from './av/volume-off'; export { AvVolumeOff }; import AvVolumeUp from './av/volume-up'; export { AvVolumeUp }; import AvWebAsset from './av/web-asset'; export { AvWebAsset }; import AvWeb from './av/web'; export { AvWeb }; import CommunicationBusiness from './communication/business'; export { CommunicationBusiness }; import CommunicationCallEnd from './communication/call-end'; export { CommunicationCallEnd }; import CommunicationCallMade from './communication/call-made'; export { CommunicationCallMade }; import CommunicationCallMerge from './communication/call-merge'; export { CommunicationCallMerge }; import CommunicationCallMissedOutgoing from './communication/call-missed-outgoing'; export { CommunicationCallMissedOutgoing }; import CommunicationCallMissed from './communication/call-missed'; export { CommunicationCallMissed }; import CommunicationCallReceived from './communication/call-received'; export { CommunicationCallReceived }; import CommunicationCallSplit from './communication/call-split'; export { CommunicationCallSplit }; import CommunicationCall from './communication/call'; export { CommunicationCall }; import CommunicationChatBubbleOutline from './communication/chat-bubble-outline'; export { CommunicationChatBubbleOutline }; import CommunicationChatBubble from './communication/chat-bubble'; export { CommunicationChatBubble }; import CommunicationChat from './communication/chat'; export { CommunicationChat }; import CommunicationClearAll from './communication/clear-all'; export { CommunicationClearAll }; import CommunicationComment from './communication/comment'; export { CommunicationComment }; import CommunicationContactMail from './communication/contact-mail'; export { CommunicationContactMail }; import CommunicationContactPhone from './communication/contact-phone'; export { CommunicationContactPhone }; import CommunicationContacts from './communication/contacts'; export { CommunicationContacts }; import CommunicationDialerSip from './communication/dialer-sip'; export { CommunicationDialerSip }; import CommunicationDialpad from './communication/dialpad'; export { CommunicationDialpad }; import CommunicationEmail from './communication/email'; export { CommunicationEmail }; import CommunicationForum from './communication/forum'; export { CommunicationForum }; import CommunicationImportContacts from './communication/import-contacts'; export { CommunicationImportContacts }; import CommunicationImportExport from './communication/import-export'; export { CommunicationImportExport }; import CommunicationInvertColorsOff from './communication/invert-colors-off'; export { CommunicationInvertColorsOff }; import CommunicationLiveHelp from './communication/live-help'; export { CommunicationLiveHelp }; import CommunicationLocationOff from './communication/location-off'; export { CommunicationLocationOff }; import CommunicationLocationOn from './communication/location-on'; export { CommunicationLocationOn }; import CommunicationMailOutline from './communication/mail-outline'; export { CommunicationMailOutline }; import CommunicationMessage from './communication/message'; export { CommunicationMessage }; import CommunicationNoSim from './communication/no-sim'; export { CommunicationNoSim }; import CommunicationPhone from './communication/phone'; export { CommunicationPhone }; import CommunicationPhonelinkErase from './communication/phonelink-erase'; export { CommunicationPhonelinkErase }; import CommunicationPhonelinkLock from './communication/phonelink-lock'; export { CommunicationPhonelinkLock }; import CommunicationPhonelinkRing from './communication/phonelink-ring'; export { CommunicationPhonelinkRing }; import CommunicationPhonelinkSetup from './communication/phonelink-setup'; export { CommunicationPhonelinkSetup }; import CommunicationPortableWifiOff from './communication/portable-wifi-off'; export { CommunicationPortableWifiOff }; import CommunicationPresentToAll from './communication/present-to-all'; export { CommunicationPresentToAll }; import CommunicationRingVolume from './communication/ring-volume'; export { CommunicationRingVolume }; import CommunicationScreenShare from './communication/screen-share'; export { CommunicationScreenShare }; import CommunicationSpeakerPhone from './communication/speaker-phone'; export { CommunicationSpeakerPhone }; import CommunicationStayCurrentLandscape from './communication/stay-current-landscape'; export { CommunicationStayCurrentLandscape }; import CommunicationStayCurrentPortrait from './communication/stay-current-portrait'; export { CommunicationStayCurrentPortrait }; import CommunicationStayPrimaryLandscape from './communication/stay-primary-landscape'; export { CommunicationStayPrimaryLandscape }; import CommunicationStayPrimaryPortrait from './communication/stay-primary-portrait'; export { CommunicationStayPrimaryPortrait }; import CommunicationStopScreenShare from './communication/stop-screen-share'; export { CommunicationStopScreenShare }; import CommunicationSwapCalls from './communication/swap-calls'; export { CommunicationSwapCalls }; import CommunicationTextsms from './communication/textsms'; export { CommunicationTextsms }; import CommunicationVoicemail from './communication/voicemail'; export { CommunicationVoicemail }; import CommunicationVpnKey from './communication/vpn-key'; export { CommunicationVpnKey }; import ContentAddBox from './content/add-box'; export { ContentAddBox }; import ContentAddCircleOutline from './content/add-circle-outline'; export { ContentAddCircleOutline }; import ContentAddCircle from './content/add-circle'; export { ContentAddCircle }; import ContentAdd from './content/add'; export { ContentAdd }; import ContentArchive from './content/archive'; export { ContentArchive }; import ContentBackspace from './content/backspace'; export { ContentBackspace }; import ContentBlock from './content/block'; export { ContentBlock }; import ContentClear from './content/clear'; export { ContentClear }; import ContentContentCopy from './content/content-copy'; export { ContentContentCopy }; import ContentContentCut from './content/content-cut'; export { ContentContentCut }; import ContentContentPaste from './content/content-paste'; export { ContentContentPaste }; import ContentCreate from './content/create'; export { ContentCreate }; import ContentDrafts from './content/drafts'; export { ContentDrafts }; import ContentFilterList from './content/filter-list'; export { ContentFilterList }; import ContentFlag from './content/flag'; export { ContentFlag }; import ContentFontDownload from './content/font-download'; export { ContentFontDownload }; import ContentForward from './content/forward'; export { ContentForward }; import ContentGesture from './content/gesture'; export { ContentGesture }; import ContentInbox from './content/inbox'; export { ContentInbox }; import ContentLink from './content/link'; export { ContentLink }; import ContentMail from './content/mail'; export { ContentMail }; import ContentMarkunread from './content/markunread'; export { ContentMarkunread }; import ContentMoveToInbox from './content/move-to-inbox'; export { ContentMoveToInbox }; import ContentNextWeek from './content/next-week'; export { ContentNextWeek }; import ContentRedo from './content/redo'; export { ContentRedo }; import ContentRemoveCircleOutline from './content/remove-circle-outline'; export { ContentRemoveCircleOutline }; import ContentRemoveCircle from './content/remove-circle'; export { ContentRemoveCircle }; import ContentRemove from './content/remove'; export { ContentRemove }; import ContentReplyAll from './content/reply-all'; export { ContentReplyAll }; import ContentReply from './content/reply'; export { ContentReply }; import ContentReport from './content/report'; export { ContentReport }; import ContentSave from './content/save'; export { ContentSave }; import ContentSelectAll from './content/select-all'; export { ContentSelectAll }; import ContentSend from './content/send'; export { ContentSend }; import ContentSort from './content/sort'; export { ContentSort }; import ContentTextFormat from './content/text-format'; export { ContentTextFormat }; import ContentUnarchive from './content/unarchive'; export { ContentUnarchive }; import ContentUndo from './content/undo'; export { ContentUndo }; import ContentWeekend from './content/weekend'; export { ContentWeekend }; import DeviceAccessAlarm from './device/access-alarm'; export { DeviceAccessAlarm }; import DeviceAccessAlarms from './device/access-alarms'; export { DeviceAccessAlarms }; import DeviceAccessTime from './device/access-time'; export { DeviceAccessTime }; import DeviceAddAlarm from './device/add-alarm'; export { DeviceAddAlarm }; import DeviceAirplanemodeActive from './device/airplanemode-active'; export { DeviceAirplanemodeActive }; import DeviceAirplanemodeInactive from './device/airplanemode-inactive'; export { DeviceAirplanemodeInactive }; import DeviceBattery20 from './device/battery-20'; export { DeviceBattery20 }; import DeviceBattery30 from './device/battery-30'; export { DeviceBattery30 }; import DeviceBattery50 from './device/battery-50'; export { DeviceBattery50 }; import DeviceBattery60 from './device/battery-60'; export { DeviceBattery60 }; import DeviceBattery80 from './device/battery-80'; export { DeviceBattery80 }; import DeviceBattery90 from './device/battery-90'; export { DeviceBattery90 }; import DeviceBatteryAlert from './device/battery-alert'; export { DeviceBatteryAlert }; import DeviceBatteryCharging20 from './device/battery-charging-20'; export { DeviceBatteryCharging20 }; import DeviceBatteryCharging30 from './device/battery-charging-30'; export { DeviceBatteryCharging30 }; import DeviceBatteryCharging50 from './device/battery-charging-50'; export { DeviceBatteryCharging50 }; import DeviceBatteryCharging60 from './device/battery-charging-60'; export { DeviceBatteryCharging60 }; import DeviceBatteryCharging80 from './device/battery-charging-80'; export { DeviceBatteryCharging80 }; import DeviceBatteryCharging90 from './device/battery-charging-90'; export { DeviceBatteryCharging90 }; import DeviceBatteryChargingFull from './device/battery-charging-full'; export { DeviceBatteryChargingFull }; import DeviceBatteryFull from './device/battery-full'; export { DeviceBatteryFull }; import DeviceBatteryStd from './device/battery-std'; export { DeviceBatteryStd }; import DeviceBatteryUnknown from './device/battery-unknown'; export { DeviceBatteryUnknown }; import DeviceBluetoothConnected from './device/bluetooth-connected'; export { DeviceBluetoothConnected }; import DeviceBluetoothDisabled from './device/bluetooth-disabled'; export { DeviceBluetoothDisabled }; import DeviceBluetoothSearching from './device/bluetooth-searching'; export { DeviceBluetoothSearching }; import DeviceBluetooth from './device/bluetooth'; export { DeviceBluetooth }; import DeviceBrightnessAuto from './device/brightness-auto'; export { DeviceBrightnessAuto }; import DeviceBrightnessHigh from './device/brightness-high'; export { DeviceBrightnessHigh }; import DeviceBrightnessLow from './device/brightness-low'; export { DeviceBrightnessLow }; import DeviceBrightnessMedium from './device/brightness-medium'; export { DeviceBrightnessMedium }; import DeviceDataUsage from './device/data-usage'; export { DeviceDataUsage }; import DeviceDeveloperMode from './device/developer-mode'; export { DeviceDeveloperMode }; import DeviceDevices from './device/devices'; export { DeviceDevices }; import DeviceDvr from './device/dvr'; export { DeviceDvr }; import DeviceGpsFixed from './device/gps-fixed'; export { DeviceGpsFixed }; import DeviceGpsNotFixed from './device/gps-not-fixed'; export { DeviceGpsNotFixed }; import DeviceGpsOff from './device/gps-off'; export { DeviceGpsOff }; import DeviceGraphicEq from './device/graphic-eq'; export { DeviceGraphicEq }; import DeviceLocationDisabled from './device/location-disabled'; export { DeviceLocationDisabled }; import DeviceLocationSearching from './device/location-searching'; export { DeviceLocationSearching }; import DeviceNetworkCell from './device/network-cell'; export { DeviceNetworkCell }; import DeviceNetworkWifi from './device/network-wifi'; export { DeviceNetworkWifi }; import DeviceNfc from './device/nfc'; export { DeviceNfc }; import DeviceScreenLockLandscape from './device/screen-lock-landscape'; export { DeviceScreenLockLandscape }; import DeviceScreenLockPortrait from './device/screen-lock-portrait'; export { DeviceScreenLockPortrait }; import DeviceScreenLockRotation from './device/screen-lock-rotation'; export { DeviceScreenLockRotation }; import DeviceScreenRotation from './device/screen-rotation'; export { DeviceScreenRotation }; import DeviceSdStorage from './device/sd-storage'; export { DeviceSdStorage }; import DeviceSettingsSystemDaydream from './device/settings-system-daydream'; export { DeviceSettingsSystemDaydream }; import DeviceSignalCellular0Bar from './device/signal-cellular-0-bar'; export { DeviceSignalCellular0Bar }; import DeviceSignalCellular1Bar from './device/signal-cellular-1-bar'; export { DeviceSignalCellular1Bar }; import DeviceSignalCellular2Bar from './device/signal-cellular-2-bar'; export { DeviceSignalCellular2Bar }; import DeviceSignalCellular3Bar from './device/signal-cellular-3-bar'; export { DeviceSignalCellular3Bar }; import DeviceSignalCellular4Bar from './device/signal-cellular-4-bar'; export { DeviceSignalCellular4Bar }; import DeviceSignalCellularConnectedNoInternet0Bar from './device/signal-cellular-connected-no-internet-0-bar'; export { DeviceSignalCellularConnectedNoInternet0Bar }; import DeviceSignalCellularConnectedNoInternet1Bar from './device/signal-cellular-connected-no-internet-1-bar'; export { DeviceSignalCellularConnectedNoInternet1Bar }; import DeviceSignalCellularConnectedNoInternet2Bar from './device/signal-cellular-connected-no-internet-2-bar'; export { DeviceSignalCellularConnectedNoInternet2Bar }; import DeviceSignalCellularConnectedNoInternet3Bar from './device/signal-cellular-connected-no-internet-3-bar'; export { DeviceSignalCellularConnectedNoInternet3Bar }; import DeviceSignalCellularConnectedNoInternet4Bar from './device/signal-cellular-connected-no-internet-4-bar'; export { DeviceSignalCellularConnectedNoInternet4Bar }; import DeviceSignalCellularNoSim from './device/signal-cellular-no-sim'; export { DeviceSignalCellularNoSim }; import DeviceSignalCellularNull from './device/signal-cellular-null'; export { DeviceSignalCellularNull }; import DeviceSignalCellularOff from './device/signal-cellular-off'; export { DeviceSignalCellularOff }; import DeviceSignalWifi0Bar from './device/signal-wifi-0-bar'; export { DeviceSignalWifi0Bar }; import DeviceSignalWifi1BarLock from './device/signal-wifi-1-bar-lock'; export { DeviceSignalWifi1BarLock }; import DeviceSignalWifi1Bar from './device/signal-wifi-1-bar'; export { DeviceSignalWifi1Bar }; import DeviceSignalWifi2BarLock from './device/signal-wifi-2-bar-lock'; export { DeviceSignalWifi2BarLock }; import DeviceSignalWifi2Bar from './device/signal-wifi-2-bar'; export { DeviceSignalWifi2Bar }; import DeviceSignalWifi3BarLock from './device/signal-wifi-3-bar-lock'; export { DeviceSignalWifi3BarLock }; import DeviceSignalWifi3Bar from './device/signal-wifi-3-bar'; export { DeviceSignalWifi3Bar }; import DeviceSignalWifi4BarLock from './device/signal-wifi-4-bar-lock'; export { DeviceSignalWifi4BarLock }; import DeviceSignalWifi4Bar from './device/signal-wifi-4-bar'; export { DeviceSignalWifi4Bar }; import DeviceSignalWifiOff from './device/signal-wifi-off'; export { DeviceSignalWifiOff }; import DeviceStorage from './device/storage'; export { DeviceStorage }; import DeviceUsb from './device/usb'; export { DeviceUsb }; import DeviceWallpaper from './device/wallpaper'; export { DeviceWallpaper }; import DeviceWidgets from './device/widgets'; export { DeviceWidgets }; import DeviceWifiLock from './device/wifi-lock'; export { DeviceWifiLock }; import DeviceWifiTethering from './device/wifi-tethering'; export { DeviceWifiTethering }; import EditorAttachFile from './editor/attach-file'; export { EditorAttachFile }; import EditorAttachMoney from './editor/attach-money'; export { EditorAttachMoney }; import EditorBorderAll from './editor/border-all'; export { EditorBorderAll }; import EditorBorderBottom from './editor/border-bottom'; export { EditorBorderBottom }; import EditorBorderClear from './editor/border-clear'; export { EditorBorderClear }; import EditorBorderColor from './editor/border-color'; export { EditorBorderColor }; import EditorBorderHorizontal from './editor/border-horizontal'; export { EditorBorderHorizontal }; import EditorBorderInner from './editor/border-inner'; export { EditorBorderInner }; import EditorBorderLeft from './editor/border-left'; export { EditorBorderLeft }; import EditorBorderOuter from './editor/border-outer'; export { EditorBorderOuter }; import EditorBorderRight from './editor/border-right'; export { EditorBorderRight }; import EditorBorderStyle from './editor/border-style'; export { EditorBorderStyle }; import EditorBorderTop from './editor/border-top'; export { EditorBorderTop }; import EditorBorderVertical from './editor/border-vertical'; export { EditorBorderVertical }; import EditorDragHandle from './editor/drag-handle'; export { EditorDragHandle }; import EditorFormatAlignCenter from './editor/format-align-center'; export { EditorFormatAlignCenter }; import EditorFormatAlignJustify from './editor/format-align-justify'; export { EditorFormatAlignJustify }; import EditorFormatAlignLeft from './editor/format-align-left'; export { EditorFormatAlignLeft }; import EditorFormatAlignRight from './editor/format-align-right'; export { EditorFormatAlignRight }; import EditorFormatBold from './editor/format-bold'; export { EditorFormatBold }; import EditorFormatClear from './editor/format-clear'; export { EditorFormatClear }; import EditorFormatColorFill from './editor/format-color-fill'; export { EditorFormatColorFill }; import EditorFormatColorReset from './editor/format-color-reset'; export { EditorFormatColorReset }; import EditorFormatColorText from './editor/format-color-text'; export { EditorFormatColorText }; import EditorFormatIndentDecrease from './editor/format-indent-decrease'; export { EditorFormatIndentDecrease }; import EditorFormatIndentIncrease from './editor/format-indent-increase'; export { EditorFormatIndentIncrease }; import EditorFormatItalic from './editor/format-italic'; export { EditorFormatItalic }; import EditorFormatLineSpacing from './editor/format-line-spacing'; export { EditorFormatLineSpacing }; import EditorFormatListBulleted from './editor/format-list-bulleted'; export { EditorFormatListBulleted }; import EditorFormatListNumbered from './editor/format-list-numbered'; export { EditorFormatListNumbered }; import EditorFormatPaint from './editor/format-paint'; export { EditorFormatPaint }; import EditorFormatQuote from './editor/format-quote'; export { EditorFormatQuote }; import EditorFormatShapes from './editor/format-shapes'; export { EditorFormatShapes }; import EditorFormatSize from './editor/format-size'; export { EditorFormatSize }; import EditorFormatStrikethrough from './editor/format-strikethrough'; export { EditorFormatStrikethrough }; import EditorFormatTextdirectionLToR from './editor/format-textdirection-l-to-r'; export { EditorFormatTextdirectionLToR }; import EditorFormatTextdirectionRToL from './editor/format-textdirection-r-to-l'; export { EditorFormatTextdirectionRToL }; import EditorFormatUnderlined from './editor/format-underlined'; export { EditorFormatUnderlined }; import EditorFunctions from './editor/functions'; export { EditorFunctions }; import EditorHighlight from './editor/highlight'; export { EditorHighlight }; import EditorInsertChart from './editor/insert-chart'; export { EditorInsertChart }; import EditorInsertComment from './editor/insert-comment'; export { EditorInsertComment }; import EditorInsertDriveFile from './editor/insert-drive-file'; export { EditorInsertDriveFile }; import EditorInsertEmoticon from './editor/insert-emoticon'; export { EditorInsertEmoticon }; import EditorInsertInvitation from './editor/insert-invitation'; export { EditorInsertInvitation }; import EditorInsertLink from './editor/insert-link'; export { EditorInsertLink }; import EditorInsertPhoto from './editor/insert-photo'; export { EditorInsertPhoto }; import EditorLinearScale from './editor/linear-scale'; export { EditorLinearScale }; import EditorMergeType from './editor/merge-type'; export { EditorMergeType }; import EditorModeComment from './editor/mode-comment'; export { EditorModeComment }; import EditorModeEdit from './editor/mode-edit'; export { EditorModeEdit }; import EditorMoneyOff from './editor/money-off'; export { EditorMoneyOff }; import EditorPublish from './editor/publish'; export { EditorPublish }; import EditorShortText from './editor/short-text'; export { EditorShortText }; import EditorSpaceBar from './editor/space-bar'; export { EditorSpaceBar }; import EditorStrikethroughS from './editor/strikethrough-s'; export { EditorStrikethroughS }; import EditorTextFields from './editor/text-fields'; export { EditorTextFields }; import EditorVerticalAlignBottom from './editor/vertical-align-bottom'; export { EditorVerticalAlignBottom }; import EditorVerticalAlignCenter from './editor/vertical-align-center'; export { EditorVerticalAlignCenter }; import EditorVerticalAlignTop from './editor/vertical-align-top'; export { EditorVerticalAlignTop }; import EditorWrapText from './editor/wrap-text'; export { EditorWrapText }; import FileAttachment from './file/attachment'; export { FileAttachment }; import FileCloudCircle from './file/cloud-circle'; export { FileCloudCircle }; import FileCloudDone from './file/cloud-done'; export { FileCloudDone }; import FileCloudDownload from './file/cloud-download'; export { FileCloudDownload }; import FileCloudOff from './file/cloud-off'; export { FileCloudOff }; import FileCloudQueue from './file/cloud-queue'; export { FileCloudQueue }; import FileCloudUpload from './file/cloud-upload'; export { FileCloudUpload }; import FileCloud from './file/cloud'; export { FileCloud }; import FileCreateNewFolder from './file/create-new-folder'; export { FileCreateNewFolder }; import FileFileDownload from './file/file-download'; export { FileFileDownload }; import FileFileUpload from './file/file-upload'; export { FileFileUpload }; import FileFolderOpen from './file/folder-open'; export { FileFolderOpen }; import FileFolderShared from './file/folder-shared'; export { FileFolderShared }; import FileFolder from './file/folder'; export { FileFolder }; import HardwareCastConnected from './hardware/cast-connected'; export { HardwareCastConnected }; import HardwareCast from './hardware/cast'; export { HardwareCast }; import HardwareComputer from './hardware/computer'; export { HardwareComputer }; import HardwareDesktopMac from './hardware/desktop-mac'; export { HardwareDesktopMac }; import HardwareDesktopWindows from './hardware/desktop-windows'; export { HardwareDesktopWindows }; import HardwareDeveloperBoard from './hardware/developer-board'; export { HardwareDeveloperBoard }; import HardwareDeviceHub from './hardware/device-hub'; export { HardwareDeviceHub }; import HardwareDevicesOther from './hardware/devices-other'; export { HardwareDevicesOther }; import HardwareDock from './hardware/dock'; export { HardwareDock }; import HardwareGamepad from './hardware/gamepad'; export { HardwareGamepad }; import HardwareHeadsetMic from './hardware/headset-mic'; export { HardwareHeadsetMic }; import HardwareHeadset from './hardware/headset'; export { HardwareHeadset }; import HardwareKeyboardArrowDown from './hardware/keyboard-arrow-down'; export { HardwareKeyboardArrowDown }; import HardwareKeyboardArrowLeft from './hardware/keyboard-arrow-left'; export { HardwareKeyboardArrowLeft }; import HardwareKeyboardArrowRight from './hardware/keyboard-arrow-right'; export { HardwareKeyboardArrowRight }; import HardwareKeyboardArrowUp from './hardware/keyboard-arrow-up'; export { HardwareKeyboardArrowUp }; import HardwareKeyboardBackspace from './hardware/keyboard-backspace'; export { HardwareKeyboardBackspace }; import HardwareKeyboardCapslock from './hardware/keyboard-capslock'; export { HardwareKeyboardCapslock }; import HardwareKeyboardHide from './hardware/keyboard-hide'; export { HardwareKeyboardHide }; import HardwareKeyboardReturn from './hardware/keyboard-return'; export { HardwareKeyboardReturn }; import HardwareKeyboardTab from './hardware/keyboard-tab'; export { HardwareKeyboardTab }; import HardwareKeyboardVoice from './hardware/keyboard-voice'; export { HardwareKeyboardVoice }; import HardwareKeyboard from './hardware/keyboard'; export { HardwareKeyboard }; import HardwareLaptopChromebook from './hardware/laptop-chromebook'; export { HardwareLaptopChromebook }; import HardwareLaptopMac from './hardware/laptop-mac'; export { HardwareLaptopMac }; import HardwareLaptopWindows from './hardware/laptop-windows'; export { HardwareLaptopWindows }; import HardwareLaptop from './hardware/laptop'; export { HardwareLaptop }; import HardwareMemory from './hardware/memory'; export { HardwareMemory }; import HardwareMouse from './hardware/mouse'; export { HardwareMouse }; import HardwarePhoneAndroid from './hardware/phone-android'; export { HardwarePhoneAndroid }; import HardwarePhoneIphone from './hardware/phone-iphone'; export { HardwarePhoneIphone }; import HardwarePhonelinkOff from './hardware/phonelink-off'; export { HardwarePhonelinkOff }; import HardwarePhonelink from './hardware/phonelink'; export { HardwarePhonelink }; import HardwarePowerInput from './hardware/power-input'; export { HardwarePowerInput }; import HardwareRouter from './hardware/router'; export { HardwareRouter }; import HardwareScanner from './hardware/scanner'; export { HardwareScanner }; import HardwareSecurity from './hardware/security'; export { HardwareSecurity }; import HardwareSimCard from './hardware/sim-card'; export { HardwareSimCard }; import HardwareSmartphone from './hardware/smartphone'; export { HardwareSmartphone }; import HardwareSpeakerGroup from './hardware/speaker-group'; export { HardwareSpeakerGroup }; import HardwareSpeaker from './hardware/speaker'; export { HardwareSpeaker }; import HardwareTabletAndroid from './hardware/tablet-android'; export { HardwareTabletAndroid }; import HardwareTabletMac from './hardware/tablet-mac'; export { HardwareTabletMac }; import HardwareTablet from './hardware/tablet'; export { HardwareTablet }; import HardwareToys from './hardware/toys'; export { HardwareToys }; import HardwareTv from './hardware/tv'; export { HardwareTv }; import HardwareVideogameAsset from './hardware/videogame-asset'; export { HardwareVideogameAsset }; import HardwareWatch from './hardware/watch'; export { HardwareWatch }; import ImageAddAPhoto from './image/add-a-photo'; export { ImageAddAPhoto }; import ImageAddToPhotos from './image/add-to-photos'; export { ImageAddToPhotos }; import ImageAdjust from './image/adjust'; export { ImageAdjust }; import ImageAssistantPhoto from './image/assistant-photo'; export { ImageAssistantPhoto }; import ImageAssistant from './image/assistant'; export { ImageAssistant }; import ImageAudiotrack from './image/audiotrack'; export { ImageAudiotrack }; import ImageBlurCircular from './image/blur-circular'; export { ImageBlurCircular }; import ImageBlurLinear from './image/blur-linear'; export { ImageBlurLinear }; import ImageBlurOff from './image/blur-off'; export { ImageBlurOff }; import ImageBlurOn from './image/blur-on'; export { ImageBlurOn }; import ImageBrightness1 from './image/brightness-1'; export { ImageBrightness1 }; import ImageBrightness2 from './image/brightness-2'; export { ImageBrightness2 }; import ImageBrightness3 from './image/brightness-3'; export { ImageBrightness3 }; import ImageBrightness4 from './image/brightness-4'; export { ImageBrightness4 }; import ImageBrightness5 from './image/brightness-5'; export { ImageBrightness5 }; import ImageBrightness6 from './image/brightness-6'; export { ImageBrightness6 }; import ImageBrightness7 from './image/brightness-7'; export { ImageBrightness7 }; import ImageBrokenImage from './image/broken-image'; export { ImageBrokenImage }; import ImageBrush from './image/brush'; export { ImageBrush }; import ImageCameraAlt from './image/camera-alt'; export { ImageCameraAlt }; import ImageCameraFront from './image/camera-front'; export { ImageCameraFront }; import ImageCameraRear from './image/camera-rear'; export { ImageCameraRear }; import ImageCameraRoll from './image/camera-roll'; export { ImageCameraRoll }; import ImageCamera from './image/camera'; export { ImageCamera }; import ImageCenterFocusStrong from './image/center-focus-strong'; export { ImageCenterFocusStrong }; import ImageCenterFocusWeak from './image/center-focus-weak'; export { ImageCenterFocusWeak }; import ImageCollectionsBookmark from './image/collections-bookmark'; export { ImageCollectionsBookmark }; import ImageCollections from './image/collections'; export { ImageCollections }; import ImageColorLens from './image/color-lens'; export { ImageColorLens }; import ImageColorize from './image/colorize'; export { ImageColorize }; import ImageCompare from './image/compare'; export { ImageCompare }; import ImageControlPointDuplicate from './image/control-point-duplicate'; export { ImageControlPointDuplicate }; import ImageControlPoint from './image/control-point'; export { ImageControlPoint }; import ImageCrop169 from './image/crop-16-9'; export { ImageCrop169 }; import ImageCrop32 from './image/crop-3-2'; export { ImageCrop32 }; import ImageCrop54 from './image/crop-5-4'; export { ImageCrop54 }; import ImageCrop75 from './image/crop-7-5'; export { ImageCrop75 }; import ImageCropDin from './image/crop-din'; export { ImageCropDin }; import ImageCropFree from './image/crop-free'; export { ImageCropFree }; import ImageCropLandscape from './image/crop-landscape'; export { ImageCropLandscape }; import ImageCropOriginal from './image/crop-original'; export { ImageCropOriginal }; import ImageCropPortrait from './image/crop-portrait'; export { ImageCropPortrait }; import ImageCropRotate from './image/crop-rotate'; export { ImageCropRotate }; import ImageCropSquare from './image/crop-square'; export { ImageCropSquare }; import ImageCrop from './image/crop'; export { ImageCrop }; import ImageDehaze from './image/dehaze'; export { ImageDehaze }; import ImageDetails from './image/details'; export { ImageDetails }; import ImageEdit from './image/edit'; export { ImageEdit }; import ImageExposureNeg1 from './image/exposure-neg-1'; export { ImageExposureNeg1 }; import ImageExposureNeg2 from './image/exposure-neg-2'; export { ImageExposureNeg2 }; import ImageExposurePlus1 from './image/exposure-plus-1'; export { ImageExposurePlus1 }; import ImageExposurePlus2 from './image/exposure-plus-2'; export { ImageExposurePlus2 }; import ImageExposureZero from './image/exposure-zero'; export { ImageExposureZero }; import ImageExposure from './image/exposure'; export { ImageExposure }; import ImageFilter1 from './image/filter-1'; export { ImageFilter1 }; import ImageFilter2 from './image/filter-2'; export { ImageFilter2 }; import ImageFilter3 from './image/filter-3'; export { ImageFilter3 }; import ImageFilter4 from './image/filter-4'; export { ImageFilter4 }; import ImageFilter5 from './image/filter-5'; export { ImageFilter5 }; import ImageFilter6 from './image/filter-6'; export { ImageFilter6 }; import ImageFilter7 from './image/filter-7'; export { ImageFilter7 }; import ImageFilter8 from './image/filter-8'; export { ImageFilter8 }; import ImageFilter9Plus from './image/filter-9-plus'; export { ImageFilter9Plus }; import ImageFilter9 from './image/filter-9'; export { ImageFilter9 }; import ImageFilterBAndW from './image/filter-b-and-w'; export { ImageFilterBAndW }; import ImageFilterCenterFocus from './image/filter-center-focus'; export { ImageFilterCenterFocus }; import ImageFilterDrama from './image/filter-drama'; export { ImageFilterDrama }; import ImageFilterFrames from './image/filter-frames'; export { ImageFilterFrames }; import ImageFilterHdr from './image/filter-hdr'; export { ImageFilterHdr }; import ImageFilterNone from './image/filter-none'; export { ImageFilterNone }; import ImageFilterTiltShift from './image/filter-tilt-shift'; export { ImageFilterTiltShift }; import ImageFilterVintage from './image/filter-vintage'; export { ImageFilterVintage }; import ImageFilter from './image/filter'; export { ImageFilter }; import ImageFlare from './image/flare'; export { ImageFlare }; import ImageFlashAuto from './image/flash-auto'; export { ImageFlashAuto }; import ImageFlashOff from './image/flash-off'; export { ImageFlashOff }; import ImageFlashOn from './image/flash-on'; export { ImageFlashOn }; import ImageFlip from './image/flip'; export { ImageFlip }; import ImageGradient from './image/gradient'; export { ImageGradient }; import ImageGrain from './image/grain'; export { ImageGrain }; import ImageGridOff from './image/grid-off'; export { ImageGridOff }; import ImageGridOn from './image/grid-on'; export { ImageGridOn }; import ImageHdrOff from './image/hdr-off'; export { ImageHdrOff }; import ImageHdrOn from './image/hdr-on'; export { ImageHdrOn }; import ImageHdrStrong from './image/hdr-strong'; export { ImageHdrStrong }; import ImageHdrWeak from './image/hdr-weak'; export { ImageHdrWeak }; import ImageHealing from './image/healing'; export { ImageHealing }; import ImageImageAspectRatio from './image/image-aspect-ratio'; export { ImageImageAspectRatio }; import ImageImage from './image/image'; export { ImageImage }; import ImageIso from './image/iso'; export { ImageIso }; import ImageLandscape from './image/landscape'; export { ImageLandscape }; import ImageLeakAdd from './image/leak-add'; export { ImageLeakAdd }; import ImageLeakRemove from './image/leak-remove'; export { ImageLeakRemove }; import ImageLens from './image/lens'; export { ImageLens }; import ImageLinkedCamera from './image/linked-camera'; export { ImageLinkedCamera }; import ImageLooks3 from './image/looks-3'; export { ImageLooks3 }; import ImageLooks4 from './image/looks-4'; export { ImageLooks4 }; import ImageLooks5 from './image/looks-5'; export { ImageLooks5 }; import ImageLooks6 from './image/looks-6'; export { ImageLooks6 }; import ImageLooksOne from './image/looks-one'; export { ImageLooksOne }; import ImageLooksTwo from './image/looks-two'; export { ImageLooksTwo }; import ImageLooks from './image/looks'; export { ImageLooks }; import ImageLoupe from './image/loupe'; export { ImageLoupe }; import ImageMonochromePhotos from './image/monochrome-photos'; export { ImageMonochromePhotos }; import ImageMovieCreation from './image/movie-creation'; export { ImageMovieCreation }; import ImageMovieFilter from './image/movie-filter'; export { ImageMovieFilter }; import ImageMusicNote from './image/music-note'; export { ImageMusicNote }; import ImageNaturePeople from './image/nature-people'; export { ImageNaturePeople }; import ImageNature from './image/nature'; export { ImageNature }; import ImageNavigateBefore from './image/navigate-before'; export { ImageNavigateBefore }; import ImageNavigateNext from './image/navigate-next'; export { ImageNavigateNext }; import ImagePalette from './image/palette'; export { ImagePalette }; import ImagePanoramaFishEye from './image/panorama-fish-eye'; export { ImagePanoramaFishEye }; import ImagePanoramaHorizontal from './image/panorama-horizontal'; export { ImagePanoramaHorizontal }; import ImagePanoramaVertical from './image/panorama-vertical'; export { ImagePanoramaVertical }; import ImagePanoramaWideAngle from './image/panorama-wide-angle'; export { ImagePanoramaWideAngle }; import ImagePanorama from './image/panorama'; export { ImagePanorama }; import ImagePhotoAlbum from './image/photo-album'; export { ImagePhotoAlbum }; import ImagePhotoCamera from './image/photo-camera'; export { ImagePhotoCamera }; import ImagePhotoFilter from './image/photo-filter'; export { ImagePhotoFilter }; import ImagePhotoLibrary from './image/photo-library'; export { ImagePhotoLibrary }; import ImagePhotoSizeSelectActual from './image/photo-size-select-actual'; export { ImagePhotoSizeSelectActual }; import ImagePhotoSizeSelectLarge from './image/photo-size-select-large'; export { ImagePhotoSizeSelectLarge }; import ImagePhotoSizeSelectSmall from './image/photo-size-select-small'; export { ImagePhotoSizeSelectSmall }; import ImagePhoto from './image/photo'; export { ImagePhoto }; import ImagePictureAsPdf from './image/picture-as-pdf'; export { ImagePictureAsPdf }; import ImagePortrait from './image/portrait'; export { ImagePortrait }; import ImageRemoveRedEye from './image/remove-red-eye'; export { ImageRemoveRedEye }; import ImageRotate90DegreesCcw from './image/rotate-90-degrees-ccw'; export { ImageRotate90DegreesCcw }; import ImageRotateLeft from './image/rotate-left'; export { ImageRotateLeft }; import ImageRotateRight from './image/rotate-right'; export { ImageRotateRight }; import ImageSlideshow from './image/slideshow'; export { ImageSlideshow }; import ImageStraighten from './image/straighten'; export { ImageStraighten }; import ImageStyle from './image/style'; export { ImageStyle }; import ImageSwitchCamera from './image/switch-camera'; export { ImageSwitchCamera }; import ImageSwitchVideo from './image/switch-video'; export { ImageSwitchVideo }; import ImageTagFaces from './image/tag-faces'; export { ImageTagFaces }; import ImageTexture from './image/texture'; export { ImageTexture }; import ImageTimelapse from './image/timelapse'; export { ImageTimelapse }; import ImageTimer10 from './image/timer-10'; export { ImageTimer10 }; import ImageTimer3 from './image/timer-3'; export { ImageTimer3 }; import ImageTimerOff from './image/timer-off'; export { ImageTimerOff }; import ImageTimer from './image/timer'; export { ImageTimer }; import ImageTonality from './image/tonality'; export { ImageTonality }; import ImageTransform from './image/transform'; export { ImageTransform }; import ImageTune from './image/tune'; export { ImageTune }; import ImageViewComfy from './image/view-comfy'; export { ImageViewComfy }; import ImageViewCompact from './image/view-compact'; export { ImageViewCompact }; import ImageVignette from './image/vignette'; export { ImageVignette }; import ImageWbAuto from './image/wb-auto'; export { ImageWbAuto }; import ImageWbCloudy from './image/wb-cloudy'; export { ImageWbCloudy }; import ImageWbIncandescent from './image/wb-incandescent'; export { ImageWbIncandescent }; import ImageWbIridescent from './image/wb-iridescent'; export { ImageWbIridescent }; import ImageWbSunny from './image/wb-sunny'; export { ImageWbSunny }; import MapsAddLocation from './maps/add-location'; export { MapsAddLocation }; import MapsBeenhere from './maps/beenhere'; export { MapsBeenhere }; import MapsDirectionsBike from './maps/directions-bike'; export { MapsDirectionsBike }; import MapsDirectionsBoat from './maps/directions-boat'; export { MapsDirectionsBoat }; import MapsDirectionsBus from './maps/directions-bus'; export { MapsDirectionsBus }; import MapsDirectionsCar from './maps/directions-car'; export { MapsDirectionsCar }; import MapsDirectionsRailway from './maps/directions-railway'; export { MapsDirectionsRailway }; import MapsDirectionsRun from './maps/directions-run'; export { MapsDirectionsRun }; import MapsDirectionsSubway from './maps/directions-subway'; export { MapsDirectionsSubway }; import MapsDirectionsTransit from './maps/directions-transit'; export { MapsDirectionsTransit }; import MapsDirectionsWalk from './maps/directions-walk'; export { MapsDirectionsWalk }; import MapsDirections from './maps/directions'; export { MapsDirections }; import MapsEditLocation from './maps/edit-location'; export { MapsEditLocation }; import MapsFlight from './maps/flight'; export { MapsFlight }; import MapsHotel from './maps/hotel'; export { MapsHotel }; import MapsLayersClear from './maps/layers-clear'; export { MapsLayersClear }; import MapsLayers from './maps/layers'; export { MapsLayers }; import MapsLocalActivity from './maps/local-activity'; export { MapsLocalActivity }; import MapsLocalAirport from './maps/local-airport'; export { MapsLocalAirport }; import MapsLocalAtm from './maps/local-atm'; export { MapsLocalAtm }; import MapsLocalBar from './maps/local-bar'; export { MapsLocalBar }; import MapsLocalCafe from './maps/local-cafe'; export { MapsLocalCafe }; import MapsLocalCarWash from './maps/local-car-wash'; export { MapsLocalCarWash }; import MapsLocalConvenienceStore from './maps/local-convenience-store'; export { MapsLocalConvenienceStore }; import MapsLocalDining from './maps/local-dining'; export { MapsLocalDining }; import MapsLocalDrink from './maps/local-drink'; export { MapsLocalDrink }; import MapsLocalFlorist from './maps/local-florist'; export { MapsLocalFlorist }; import MapsLocalGasStation from './maps/local-gas-station'; export { MapsLocalGasStation }; import MapsLocalGroceryStore from './maps/local-grocery-store'; export { MapsLocalGroceryStore }; import MapsLocalHospital from './maps/local-hospital'; export { MapsLocalHospital }; import MapsLocalHotel from './maps/local-hotel'; export { MapsLocalHotel }; import MapsLocalLaundryService from './maps/local-laundry-service'; export { MapsLocalLaundryService }; import MapsLocalLibrary from './maps/local-library'; export { MapsLocalLibrary }; import MapsLocalMall from './maps/local-mall'; export { MapsLocalMall }; import MapsLocalMovies from './maps/local-movies'; export { MapsLocalMovies }; import MapsLocalOffer from './maps/local-offer'; export { MapsLocalOffer }; import MapsLocalParking from './maps/local-parking'; export { MapsLocalParking }; import MapsLocalPharmacy from './maps/local-pharmacy'; export { MapsLocalPharmacy }; import MapsLocalPhone from './maps/local-phone'; export { MapsLocalPhone }; import MapsLocalPizza from './maps/local-pizza'; export { MapsLocalPizza }; import MapsLocalPlay from './maps/local-play'; export { MapsLocalPlay }; import MapsLocalPostOffice from './maps/local-post-office'; export { MapsLocalPostOffice }; import MapsLocalPrintshop from './maps/local-printshop'; export { MapsLocalPrintshop }; import MapsLocalSee from './maps/local-see'; export { MapsLocalSee }; import MapsLocalShipping from './maps/local-shipping'; export { MapsLocalShipping }; import MapsLocalTaxi from './maps/local-taxi'; export { MapsLocalTaxi }; import MapsMap from './maps/map'; export { MapsMap }; import MapsMyLocation from './maps/my-location'; export { MapsMyLocation }; import MapsNavigation from './maps/navigation'; export { MapsNavigation }; import MapsNearMe from './maps/near-me'; export { MapsNearMe }; import MapsPersonPinCircle from './maps/person-pin-circle'; export { MapsPersonPinCircle }; import MapsPersonPin from './maps/person-pin'; export { MapsPersonPin }; import MapsPinDrop from './maps/pin-drop'; export { MapsPinDrop }; import MapsPlace from './maps/place'; export { MapsPlace }; import MapsRateReview from './maps/rate-review'; export { MapsRateReview }; import MapsRestaurantMenu from './maps/restaurant-menu'; export { MapsRestaurantMenu }; import MapsSatellite from './maps/satellite'; export { MapsSatellite }; import MapsStoreMallDirectory from './maps/store-mall-directory'; export { MapsStoreMallDirectory }; import MapsTerrain from './maps/terrain'; export { MapsTerrain }; import MapsTraffic from './maps/traffic'; export { MapsTraffic }; import MapsZoomOutMap from './maps/zoom-out-map'; export { MapsZoomOutMap }; import NavigationApps from './navigation/apps'; export { NavigationApps }; import NavigationArrowBack from './navigation/arrow-back'; export { NavigationArrowBack }; import NavigationArrowDownward from './navigation/arrow-downward'; export { NavigationArrowDownward }; import NavigationArrowDropDownCircle from './navigation/arrow-drop-down-circle'; export { NavigationArrowDropDownCircle }; import NavigationArrowDropDown from './navigation/arrow-drop-down'; export { NavigationArrowDropDown }; import NavigationArrowDropUp from './navigation/arrow-drop-up'; export { NavigationArrowDropUp }; import NavigationArrowForward from './navigation/arrow-forward'; export { NavigationArrowForward }; import NavigationArrowUpward from './navigation/arrow-upward'; export { NavigationArrowUpward }; import NavigationCancel from './navigation/cancel'; export { NavigationCancel }; import NavigationCheck from './navigation/check'; export { NavigationCheck }; import NavigationChevronLeft from './navigation/chevron-left'; export { NavigationChevronLeft }; import NavigationChevronRight from './navigation/chevron-right'; export { NavigationChevronRight }; import NavigationClose from './navigation/close'; export { NavigationClose }; import NavigationExpandLess from './navigation/expand-less'; export { NavigationExpandLess }; import NavigationExpandMore from './navigation/expand-more'; export { NavigationExpandMore }; import NavigationFullscreenExit from './navigation/fullscreen-exit'; export { NavigationFullscreenExit }; import NavigationFullscreen from './navigation/fullscreen'; export { NavigationFullscreen }; import NavigationMenu from './navigation/menu'; export { NavigationMenu }; import NavigationMoreHoriz from './navigation/more-horiz'; export { NavigationMoreHoriz }; import NavigationMoreVert from './navigation/more-vert'; export { NavigationMoreVert }; import NavigationRefresh from './navigation/refresh'; export { NavigationRefresh }; import NavigationSubdirectoryArrowLeft from './navigation/subdirectory-arrow-left'; export { NavigationSubdirectoryArrowLeft }; import NavigationSubdirectoryArrowRight from './navigation/subdirectory-arrow-right'; export { NavigationSubdirectoryArrowRight }; import NavigationUnfoldLess from './navigation/unfold-less'; export { NavigationUnfoldLess }; import NavigationUnfoldMore from './navigation/unfold-more'; export { NavigationUnfoldMore }; import NavigationArrowDropRight from './navigation-arrow-drop-right'; export { NavigationArrowDropRight }; import NotificationAdb from './notification/adb'; export { NotificationAdb }; import NotificationAirlineSeatFlatAngled from './notification/airline-seat-flat-angled'; export { NotificationAirlineSeatFlatAngled }; import NotificationAirlineSeatFlat from './notification/airline-seat-flat'; export { NotificationAirlineSeatFlat }; import NotificationAirlineSeatIndividualSuite from './notification/airline-seat-individual-suite'; export { NotificationAirlineSeatIndividualSuite }; import NotificationAirlineSeatLegroomExtra from './notification/airline-seat-legroom-extra'; export { NotificationAirlineSeatLegroomExtra }; import NotificationAirlineSeatLegroomNormal from './notification/airline-seat-legroom-normal'; export { NotificationAirlineSeatLegroomNormal }; import NotificationAirlineSeatLegroomReduced from './notification/airline-seat-legroom-reduced'; export { NotificationAirlineSeatLegroomReduced }; import NotificationAirlineSeatReclineExtra from './notification/airline-seat-recline-extra'; export { NotificationAirlineSeatReclineExtra }; import NotificationAirlineSeatReclineNormal from './notification/airline-seat-recline-normal'; export { NotificationAirlineSeatReclineNormal }; import NotificationBluetoothAudio from './notification/bluetooth-audio'; export { NotificationBluetoothAudio }; import NotificationConfirmationNumber from './notification/confirmation-number'; export { NotificationConfirmationNumber }; import NotificationDiscFull from './notification/disc-full'; export { NotificationDiscFull }; import NotificationDoNotDisturbAlt from './notification/do-not-disturb-alt'; export { NotificationDoNotDisturbAlt }; import NotificationDoNotDisturb from './notification/do-not-disturb'; export { NotificationDoNotDisturb }; import NotificationDriveEta from './notification/drive-eta'; export { NotificationDriveEta }; import NotificationEnhancedEncryption from './notification/enhanced-encryption'; export { NotificationEnhancedEncryption }; import NotificationEventAvailable from './notification/event-available'; export { NotificationEventAvailable }; import NotificationEventBusy from './notification/event-busy'; export { NotificationEventBusy }; import NotificationEventNote from './notification/event-note'; export { NotificationEventNote }; import NotificationFolderSpecial from './notification/folder-special'; export { NotificationFolderSpecial }; import NotificationLiveTv from './notification/live-tv'; export { NotificationLiveTv }; import NotificationMms from './notification/mms'; export { NotificationMms }; import NotificationMore from './notification/more'; export { NotificationMore }; import NotificationNetworkCheck from './notification/network-check'; export { NotificationNetworkCheck }; import NotificationNetworkLocked from './notification/network-locked'; export { NotificationNetworkLocked }; import NotificationNoEncryption from './notification/no-encryption'; export { NotificationNoEncryption }; import NotificationOndemandVideo from './notification/ondemand-video'; export { NotificationOndemandVideo }; import NotificationPersonalVideo from './notification/personal-video'; export { NotificationPersonalVideo }; import NotificationPhoneBluetoothSpeaker from './notification/phone-bluetooth-speaker'; export { NotificationPhoneBluetoothSpeaker }; import NotificationPhoneForwarded from './notification/phone-forwarded'; export { NotificationPhoneForwarded }; import NotificationPhoneInTalk from './notification/phone-in-talk'; export { NotificationPhoneInTalk }; import NotificationPhoneLocked from './notification/phone-locked'; export { NotificationPhoneLocked }; import NotificationPhoneMissed from './notification/phone-missed'; export { NotificationPhoneMissed }; import NotificationPhonePaused from './notification/phone-paused'; export { NotificationPhonePaused }; import NotificationPower from './notification/power'; export { NotificationPower }; import NotificationRvHookup from './notification/rv-hookup'; export { NotificationRvHookup }; import NotificationSdCard from './notification/sd-card'; export { NotificationSdCard }; import NotificationSimCardAlert from './notification/sim-card-alert'; export { NotificationSimCardAlert }; import NotificationSmsFailed from './notification/sms-failed'; export { NotificationSmsFailed }; import NotificationSms from './notification/sms'; export { NotificationSms }; import NotificationSyncDisabled from './notification/sync-disabled'; export { NotificationSyncDisabled }; import NotificationSyncProblem from './notification/sync-problem'; export { NotificationSyncProblem }; import NotificationSync from './notification/sync'; export { NotificationSync }; import NotificationSystemUpdate from './notification/system-update'; export { NotificationSystemUpdate }; import NotificationTapAndPlay from './notification/tap-and-play'; export { NotificationTapAndPlay }; import NotificationTimeToLeave from './notification/time-to-leave'; export { NotificationTimeToLeave }; import NotificationVibration from './notification/vibration'; export { NotificationVibration }; import NotificationVoiceChat from './notification/voice-chat'; export { NotificationVoiceChat }; import NotificationVpnLock from './notification/vpn-lock'; export { NotificationVpnLock }; import NotificationWc from './notification/wc'; export { NotificationWc }; import NotificationWifi from './notification/wifi'; export { NotificationWifi }; import PlacesAcUnit from './places/ac-unit'; export { PlacesAcUnit }; import PlacesAirportShuttle from './places/airport-shuttle'; export { PlacesAirportShuttle }; import PlacesAllInclusive from './places/all-inclusive'; export { PlacesAllInclusive }; import PlacesBeachAccess from './places/beach-access'; export { PlacesBeachAccess }; import PlacesBusinessCenter from './places/business-center'; export { PlacesBusinessCenter }; import PlacesCasino from './places/casino'; export { PlacesCasino }; import PlacesChildCare from './places/child-care'; export { PlacesChildCare }; import PlacesChildFriendly from './places/child-friendly'; export { PlacesChildFriendly }; import PlacesFitnessCenter from './places/fitness-center'; export { PlacesFitnessCenter }; import PlacesFreeBreakfast from './places/free-breakfast'; export { PlacesFreeBreakfast }; import PlacesGolfCourse from './places/golf-course'; export { PlacesGolfCourse }; import PlacesHotTub from './places/hot-tub'; export { PlacesHotTub }; import PlacesKitchen from './places/kitchen'; export { PlacesKitchen }; import PlacesPool from './places/pool'; export { PlacesPool }; import PlacesRoomService from './places/room-service'; export { PlacesRoomService }; import PlacesSmokeFree from './places/smoke-free'; export { PlacesSmokeFree }; import PlacesSmokingRooms from './places/smoking-rooms'; export { PlacesSmokingRooms }; import PlacesSpa from './places/spa'; export { PlacesSpa }; import SocialCake from './social/cake'; export { SocialCake }; import SocialDomain from './social/domain'; export { SocialDomain }; import SocialGroupAdd from './social/group-add'; export { SocialGroupAdd }; import SocialGroup from './social/group'; export { SocialGroup }; import SocialLocationCity from './social/location-city'; export { SocialLocationCity }; import SocialMoodBad from './social/mood-bad'; export { SocialMoodBad }; import SocialMood from './social/mood'; export { SocialMood }; import SocialNotificationsActive from './social/notifications-active'; export { SocialNotificationsActive }; import SocialNotificationsNone from './social/notifications-none'; export { SocialNotificationsNone }; import SocialNotificationsOff from './social/notifications-off'; export { SocialNotificationsOff }; import SocialNotificationsPaused from './social/notifications-paused'; export { SocialNotificationsPaused }; import SocialNotifications from './social/notifications'; export { SocialNotifications }; import SocialPages from './social/pages'; export { SocialPages }; import SocialPartyMode from './social/party-mode'; export { SocialPartyMode }; import SocialPeopleOutline from './social/people-outline'; export { SocialPeopleOutline }; import SocialPeople from './social/people'; export { SocialPeople }; import SocialPersonAdd from './social/person-add'; export { SocialPersonAdd }; import SocialPersonOutline from './social/person-outline'; export { SocialPersonOutline }; import SocialPerson from './social/person'; export { SocialPerson }; import SocialPlusOne from './social/plus-one'; export { SocialPlusOne }; import SocialPoll from './social/poll'; export { SocialPoll }; import SocialPublic from './social/public'; export { SocialPublic }; import SocialSchool from './social/school'; export { SocialSchool }; import SocialShare from './social/share'; export { SocialShare }; import SocialWhatshot from './social/whatshot'; export { SocialWhatshot }; import ToggleCheckBoxOutlineBlank from './toggle/check-box-outline-blank'; export { ToggleCheckBoxOutlineBlank }; import ToggleCheckBox from './toggle/check-box'; export { ToggleCheckBox }; import ToggleIndeterminateCheckBox from './toggle/indeterminate-check-box'; export { ToggleIndeterminateCheckBox }; import ToggleRadioButtonChecked from './toggle/radio-button-checked'; export { ToggleRadioButtonChecked }; import ToggleRadioButtonUnchecked from './toggle/radio-button-unchecked'; export { ToggleRadioButtonUnchecked }; import ToggleStarBorder from './toggle/star-border'; export { ToggleStarBorder }; import ToggleStarHalf from './toggle/star-half'; export { ToggleStarHalf }; import ToggleStar from './toggle/star'; export { ToggleStar };
// Always request javascript when sending xhr $(function() { $.ajaxSetup({ 'beforeSend': function(xhr) { xhr.setRequestHeader("Accept", "text/javascript"); } }); }); $().ready(function(){ jQuery(top).trigger('initialize:frame'); // hide roxanne toolbar if mercury toolbar is present in parent window if(window.location != window.parent.location){ $("#roxanne_toolbar").hide(); } else { $("a.add_container").hide(); } $("a.add_container").live("click", function(){ var url = "/containers/new" if ($(this).attr('data-page')){ url += '?page_id=' + $(this).attr('data-page') + '&name=' + $(this).attr('data-name'); } else if($(this).attr('data-parent')){ url += '?parent_id=' + $(this).attr('data-parent'); } if ($(this).attr('data-sibling')){ url += '?sibling_id=' + $(this).attr('data-sibling'); } Mercury.modal(url, { 'title': "New Container" }) }); $("a.add_container").live("hover", function(){ var id = $(this).attr("data-sibling"); if(id){ $("#container_" + id).toggleClass('highlight_content'); } else { $(this).parent(".container_list").toggleClass('highlight_content'); } }); $("a.add_container_list").live("click", function(){ alert("add_container_list"); }); });
const weekly = require('./'), botMessages = require('../messages/bot-msgs'), sendMessage = require('../tools/sendMessage') ; module.exports = function (datastore, userObject, quick_reply) { let day = quick_reply.payload.split('_')[1].toLowerCase(); weekly(datastore, userObject, day).then(postsElements => { console.log(day, 'offers posts', postsElements); for (let posts of postsElements) { sendMessage.sendObjectMessage(userObject.mId, { attachment: { type: "template", payload: { template_type: "generic", elements: posts } } }); } }, (e) => { console.error(`No ${day} offers error`, e); sendMessage.sendTextMessage(userObject.mId, botMessages.WEEKLY_NO_POSTS, [], function(){}, [{ "type": "postback", "title": botMessages.START_SENDING_OFFERS_BUTTON2, "payload": "WEEKLY_PAYLOAD" }]); }); };
var app = angular.module('js'); app.controller('RegistrationOwnEditCtrl', function($scope, $filter, $routeParams, $location, NotificationSvc, ActivitiesSvc, RegistrationSvc, conf, PlatformSvc) { //$scope.busyPromise = RegistrationSvc.findById; $scope.cities = PlatformSvc.getCities(); $scope.platform = PlatformSvc; $scope.hasDisability = undefined; $scope.hasHealthIssues = undefined; $scope.setHasHealthIssues = function(b) { $scope.hasHealthIssues = b; } $scope.isHasHealthIssuesSet = function() { return $scope.hasHealthIssues !== undefined && $scope.hasHealthIssues !== null; } $scope.setHasDisability = function(b) { $scope.hasDisability = b; } $scope.isHasDisabilitySet = function() { return $scope.hasDisability !== undefined && $scope.hasDisability !== null; } $scope.save = function() { if($scope.registrationForm.$valid) { $scope.registration.firstNameParent = $scope.firstNameParent; $scope.registration.lastNameParent = $scope.lastNameParent; $scope.registration.phoneNumberParent = $scope.phoneNumberParent; $scope.registration.emailParent = $scope.emailParent; $scope.registration.firstNameChild = $scope.firstNameChild; $scope.registration.lastNameChild = $scope.lastNameChild; $scope.registration.birthdayChild = $scope.birthdayChild; $scope.registration.schoolChild = $scope.schoolChild; $scope.registration.hasHealthIssues = $scope.hasHealthIssues; $scope.registration.healthAllergy = $scope.healthAllergy; $scope.registration.healthIncompatibility = $scope.healthIncompatibility; $scope.registration.healthIllnes = $scope.healthIllnes; $scope.registration.cityChild = $scope.cityChild; $scope.registration.addressChild = $scope.addressChild; $scope.registration.hasDisability = $scope.hasDisability; $scope.registration.disabilityDescription = $scope.disabilityDescription; $scope.registration.diagnosticDescription = $scope.diagnosticDescription; $scope.registration.nameContact1 = $scope.nameContact1; $scope.registration.nameContact2 = $scope.nameContact2; $scope.registration.telContact1 = $scope.telContact1; $scope.registration.telContact2 = $scope.telContact2; $scope.registration.needsEbK = $scope.needsEbK; $scope.registration.canSwim = $scope.canSwim; $scope.registration.canGoHomeAllone = $scope.canGoHomeAllone; RegistrationSvc.update( $scope.registration ).success(function(reg) { $scope.firstNameParent = null; $scope.lastNameParent = null; $scope.emailParent = null; $scope.phoneNumberParent = null; $scope.firstNameChild = null; $scope.lastNameChild = null; $scope.birthdayChild = null; $scope.schoolChild = null; $scope.addressChild = null; $scope.cityChild = null; $scope.hasHealthIssues = undefined; $scope.healthAllergy = null; $scope.healthIncompatibility = null; $scope.healthIllnes = null; $scope.hasDisability = undefined; $scope.disabilityDescription = null; $scope.diagnosticDescription = null; $scope.nameContact1 = null; $scope.nameContact2 = null; $scope.telContact1 = null; $scope.telContact2 = null; $scope.needsEbK = false; $scope.canSwim = false; $scope.canGoHomeAllone = false; }) .error(function(err) { console.log("ERR:", err); }) .then(function() { NotificationSvc.notify('Aenderungen erfolgreich gespeichert'); $location.path('/myRegistrations'); }); } } RegistrationSvc.findById($routeParams.registrationId).success(function(registration) { $scope.registration = registration; $scope.firstNameParent = registration.firstNameParent; $scope.lastNameParent = registration.lastNameParent; $scope.phoneNumberParent = registration.phoneNumberParent; $scope.emailParent = registration.emailParent; $scope.firstNameChild = registration.firstNameChild; $scope.lastNameChild = registration.lastNameChild; $scope.birthdayChild = $filter('date')(new Date(registration.birthdayChild), 'yyyy-MM-dd'); $scope.schoolChild = registration.schoolChild; $scope.cityChild = registration.cityChild; $scope.addressChild = registration.addressChild; $scope.hasHealthIssues = registration.hasHealthIssues; $scope.healthIncompatibility = registration.healthIncompatibility; $scope.healthAllergy = registration.healthAllergy; $scope.healthIllnes = registration.healthIllnes; $scope.hasDisability = registration.hasDisability; $scope.disabilityDescription = registration.disabilityDescription; $scope.diagnosticDescription = registration.diagnosticDescription; $scope.nameContact1 = registration.nameContact1; $scope.nameContact2 = registration.nameContact2; $scope.telContact1 = registration.telContact1; $scope.telContact2 = registration.telContact2; $scope.needsEbK = registration.needsEbK; $scope.canSwim = registration.canSwim; $scope.canGoHomeAllone = registration.canGoHomeAllone; }); });
(function(window, document, undefined) { 'use strict'; console.log('This would be the main JS file.'); particlesJS("particles-js", { "particles": { "number": { "value": 400, "density": { "enable": true, "value_area": 800 } }, "color": { "value": "#fff" }, "shape": { "type": "circle", "stroke": { "width": 0, "color": "#000000" }, "polygon": { "nb_sides": 5 }, "image": { "src": "img/github.svg", "width": 100, "height": 100 } }, "opacity": { "value": 0.5, "random": true, "anim": { "enable": false, "speed": 1, "opacity_min": 0.1, "sync": false } }, "size": { "value": 10, "random": true, "anim": { "enable": false, "speed": 40, "size_min": 0.1, "sync": false } }, "line_linked": { "enable": false, "distance": 500, "color": "#ffffff", "opacity": 0.4, "width": 2 }, "move": { "enable": true, "speed": 6, "direction": "bottom", "random": false, "straight": false, "out_mode": "out", "bounce": false, "attract": { "enable": false, "rotateX": 600, "rotateY": 1200 } } }, "interactivity": { "detect_on": "canvas", "events": { "onhover": { "enable": true, "mode": "bubble" }, "onclick": { "enable": true, "mode": "repulse" }, "resize": true }, "modes": { "grab": { "distance": 400, "line_linked": { "opacity": 0.5 } }, "bubble": { "distance": 400, "size": 4, "duration": 0.3, "opacity": 1, "speed": 3 }, "repulse": { "distance": 200, "duration": 0.4 }, "push": { "particles_nb": 4 }, "remove": { "particles_nb": 2 } } }, "retina_detect": true }); particlesJS("particles-js2", { "particles": { "number": { "value": 60, "density": { "enable": true, "value_area": 800 } }, "color": { "value": "#ffffff" }, "shape": { "type": "circle", "stroke": { "width": 0, "color": "#fff7f7" }, "polygon": { "nb_sides": 5 }, "image": { "src": "img/github.svg", "width": 100, "height": 100 } }, "opacity": { "value": 0.3, "random": false, "anim": { "enable": false, "speed": 1, "opacity_min": 0.1, "sync": false } }, "size": { "value": 4, "random": true, "anim": { "enable": false, "speed": 40, "size_min": 2.436231636904035, "sync": false } }, "line_linked": { "enable": true, "distance": 150, "color": "#ffffff", "opacity": 0.4, "width": 1 }, "move": { "enable": true, "speed": 6, "direction": "none", "random": false, "straight": false, "out_mode": "out", "bounce": false, "attract": { "enable": false, "rotateX": 600, "rotateY": 1200 } } }, "interactivity": { "detect_on": "canvas", "events": { "onhover": { "enable": true, "mode": "grab" }, "onclick": { "enable": true, "mode": "repulse" }, "resize": true }, "modes": { "grab": { "distance": 400, "line_linked": { "opacity": 0.2 } }, "bubble": { "distance": 400, "size": 40, "duration": 2, "opacity": 8, "speed": 3 }, "repulse": { "distance": 200, "duration": 0.4 }, "push": { "particles_nb": 4 }, "remove": { "particles_nb": 2 } } }, "retina_detect": true }); window.skrollr.init(); }(window, document));
import differenceInCalendarWeeks from '../differenceInCalendarWeeks/index.js' import lastDayOfMonth from '../lastDayOfMonth/index.js' import startOfMonth from '../startOfMonth/index.js' /** * @name getWeeksInMonth * @category Week Helpers * @summary Get the number of calendar weeks a month spans. * * @description * Get the number of calendar weeks the month in the given date spans. * * ### v2.0.0 breaking changes: * * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). * * @param {Date|Number} date - the given date * @param {Object} [options] - an object with options. * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} * @returns {Number} the number of calendar weeks * @throws {TypeError} 2 arguments required * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 * * @example * // How many calendar weeks does February 2015 span? * var result = getWeeksInMonth(new Date(2015, 1, 8)) * //=> 4 * * @example * // If the week starts on Monday, * // how many calendar weeks does July 2017 span? * var result = getWeeksInMonth(new Date(2017, 6, 5), { weekStartsOn: 1 }) * //=> 6 */ export default function getWeeksInMonth(date, options) { if (arguments.length < 1) { throw new TypeError( '1 argument required, but only ' + arguments.length + ' present' ) } return ( differenceInCalendarWeeks( lastDayOfMonth(date), startOfMonth(date), options ) + 1 ) }
(function(){ 'use strict'; var app = angular.module('readingList', []); app.controller = ('ReadingListController', function(){ this.books = books; this.genres = genres; } ); var genres = ['fable', 'fantasy', 'fiction', 'folklore', 'horror', 'humor', 'legend', 'metafiction', 'mystery', 'mythology', 'non-fiction', 'poetry'] var books = [ { title: 'A Game of Thrones: A Song of Ice and Fire', author: 'George R.R. Martin', isbn: '0553593714', review: 'The most inventive and entertaining fantasy saga of our time—warrants one hell of an introduction. I loved this book!', rating: 4, genres: { 'non-fiction': true, fantasy: true } },{ title: 'HTML for Babies', author: 'John C Vanden-Heuvel Sr', isbn: '0615487661', review: "It's never too early to be standards compliant! I taught my little one mark-up in under one hour!", rating: 5, genres: { fiction: true } },{ title: 'A is for Array', author: 'Brandon J Hansen', isbn: '1489522212', review: 'A is for Array is the ABC book for future programmers. Filled with fun illustrations and simple real-world examples, my children loved seeing my world intertwined with theirs!', rating: 4, genres: { fiction: true } },{ title: 'The Dragon Reborn', author: 'Robert Jordan', isbn: '0812513711', review: 'The Wheel weaves as the Wheel wills, and we are only the thread of the Pattern. Moiraine', rating: 4, genres: { 'non-fiction': true, fantasy: true } } ]; })();
module.exports.createCommands = (world) => { return [ new world.Command({ name: `look`, positions: world.constants().positionsAwake, execute: async (world, user, buffer, args) => { if ( typeof args[0] == `string` ) { /** If the first argument is 'in'... */ if ( `in`.startsWith(args[0]) ) { /** If no second argument was provided, send error and return */ if ( typeof args[1] != `string` ) { user.send(`Look in what?\r\n`); return; } /** Parse container name and count from second argument */ const [name, count] = world.parseName(user, args, 1); /** Create array of all items in user's inventory with name matching second argument */ let items = user.inventory().filter(x => x.names().some(y => y.toLowerCase().startsWith(name))); /** Concatenate with all items in user's equipment with name matching second argument */ items = items.concat(user.room().items().filter(x => x.names().some(y => y.toLowerCase().startsWith(name)))); /** If number of items is less than count, send error */ if ( items.length < count ) { user.send(`You can't find that item anywhere.\r\n`); } /** Otherwise, if item is not a container, send error */ else if ( !items[count - 1].flags().includes(world.constants().itemFlags.CONTAINER) ) { user.send(`That item is not a container.\r\n`); } /** Otherwise... */ else { /** Send header for container contents */ user.send(`Contents of ${items[count - 1].name()}:\r\n`); /** Keep track of items already included in item counts */ const itemsIncluded = []; /** Loop through each item in container */ items[count - 1].contents().forEach((content) => { /** If item is already included, skip it */ if ( itemsIncluded.includes(content.name()) ) return; /** Count number of items of the same name in the container */ const numItems = items[count - 1].contents().filter(x => x.name() == content.name()).length; /** If the number of items is greater than, send quantity and name */ if ( numItems > 1 ) user.send(` (${numItems}) ${content.name()}\r\n`); /** Otherwise, just send name */ else user.send(` ${content.name()}\r\n`); /** Add item to items included */ itemsIncluded.push(content.name()); }); /** If there are no items in the container, send none */ if ( items[count - 1].contents().length == 0 ) user.send(` None\r\n`); } } /** Otherwise... */ else { /** Parse container name and count from argument */ const [name, count] = world.parseName(user, args, 0); /** Create array of users with name matching the arugment */ const users = user.room().users().filter(x => x.name().toLowerCase().startsWith(name) || ( name == `self` && x == user ) ); /** Create array of mobiles with name matching the arugment */ const mobiles = user.room().mobiles().filter(x => x.names().some(y => y.toLowerCase().startsWith(name))); /** Create array of items in user's inventory with name matching the arugment */ const inventory = user.inventory().filter(x => x.names().some(y => y.toLowerCase().startsWith(name))); /** Create array of items in user's equipemnt with name matching the arugment */ const equipment = user.equipment().filter(x => x.names().some(y => y.toLowerCase().startsWith(name))); /** Create array of items in user's room with name matching the arugment */ const items = user.room().items().filter(x => x.names().some(y => y.toLowerCase().startsWith(name))); /** Create array of all characters and items with name matching the argument combined */ const targets = users.concat(mobiles.concat(inventory.concat(equipment.concat(items)))); /** If number of targets is less than count, send error and return */ if ( targets.length < count ) return user.send(`You can't find that anywhere.\r\n`); /** Define target */ const target = targets[count - 1]; /** If the target is a user... */ if ( target instanceof world.User ) { /** Send target user's name */ user.send(`${target.name()} is standing here.\r\n\r\n`); /** Send target user's equipment */ world.sendUserEquipment(user, target); } /** Otherwise, if target is a mobile... */ else if ( target instanceof world.MobileInstance ) { /** Send target mobile's description */ user.send(`${world.terminalWrap(world.colorize(target.name()))}\r\n`); user.send(`${world.terminalWrap(world.colorize(target.description()))}\r\n\r\n`); /** Send target mobile's equipment */ world.sendUserEquipment(user, target); } /** Otherwise, if there is a second argument */ else if ( typeof args[1] == `string` ) { /** If the detail name is not valid, send error */ if ( !args[1].match(/^[a-z0-9]+$/i) ) return user.send(`You can't find that anywhere.\r\n`); /** Parse detail name and count */ const [detailName, detailCount] = world.parseName(user, args, 1); /** Attempt to find detail on target */ const detail = Object.keys(target.details()).filter(x => x.startsWith(detailName))[detailCount - 1]; /** If detail doesn't exist, send error */ if ( !detail ) return user.send(`You can't find that anywhere.\r\n`); /** Send detail description */ user.send(`${world.terminalWrap(world.colorize(target.details()[detail]))}\r\n`); } /** Otherwise... */ else { /** Send item description */ user.send(`${world.terminalWrap(world.colorize(target.description()))}\r\n`); /** Define array of stats */ const stats = [target.accuracy(), target.air(), target.armor(), target.deflection(), target.dodge(), target.earth(), target.fire(), target.life(), target.power(), target.speed(), target.water()]; if ( stats.some(x => x > 0) ) user.send(`\r\n`); /** If the target is an item... */ if ( target instanceof world.ItemInstance ) { /** If the item has accuracy, show it */ if ( target.accuracy() > 0 ) user.send(world.colorize(` #OAccuracy#n +${target.accuracy()}\r\n`)); /** If the item has air, show it */ if ( target.air() > 0 ) user.send(world.colorize(` Air +${target.air()}\r\n`)); /** If the item has armor, show it */ if ( target.armor() > 0 ) user.send(world.colorize(` #KArmor#n +${target.armor()}\r\n`)); /** If the item has deflection, show it */ if ( target.deflection() > 0 ) user.send(world.colorize(` #PDeflection#n +${target.deflection()}\r\n`)); /** If the item has dodge, show it */ if ( target.dodge() > 0 ) user.send(world.colorize(` #cDodge#n +${target.dodge()}\r\n`)); /** If the item has earth, show it */ if ( target.earth() > 0 ) user.send(world.colorize(` #yEarth#n +${target.earth()}\r\n`)); /** If the item has fire, show it */ if ( target.fire() > 0 ) user.send(world.colorize(` #RFire#n +${target.fire()}\r\n`)); /** If the item has life, show it */ if ( target.life() > 0 ) user.send(world.colorize(` #gLife#n +${target.life()}\r\n`)); /** If the item has power, show it */ if ( target.power() > 0 ) user.send(world.colorize(` #oPower#n +${target.power()}\r\n`)); /** If the item has speed, show it */ if ( target.speed() > 0 ) user.send(world.colorize(` #YSpeed#n +${target.speed()}\r\n`)); /** If the item has water, show it */ if ( target.water() > 0 ) user.send(world.colorize(` #BWater#n +${target.water()}\r\n`)); } /** Create array of detail keys */ const keys = Object.keys(target.details()); /** If there are details, output heading */ if ( keys.length > 0 ) user.send(`\r\nDetails: `); /** Loop through each detail key and output */ keys.forEach((key, index) => { user.send(`${key} `); /** Output new line after every fifth key */ if ( (index + 1) % 6 == 0 && index != keys.length - 1 ) user.send(`\r\n`); }); /** If we output some detail keys, send new line */ if ( keys.length > 0 ) user.send(`\r\n`); } } } else { /** Send room name */ user.send(`${user.room().name()}\r\n`); /** Start exits */ let exits = `#G[Exits:`; /** Loop through exits in user's room */ user.room().exits().forEach((exit) => { /** Append exit names separated by spaces */ exits += ` ${world.constants().directionNames[exit.direction()]}`; }); /** If there are no exits, append none */ if ( user.room().exits().length == 0 ) exits += ` None`; /** Finish exits */ exits += `]\r\n`; /** Colorize and send exits */ user.send(world.colorize(exits)); /** Send room description */ user.send(world.terminalWrap(world.colorize(`#w${user.room().description()}\r\n`))); /** Keep track of items already included in item counts */ const itemsIncluded = []; /** Loop through each item in the user's room */ user.room().items().forEach((item) => { /** If item is already included, skip it */ if ( itemsIncluded.includes(item.roomDescription()) ) return; /** Count number of items of the same name in the room */ const count = user.room().items().filter(x => x.roomDescription() == item.roomDescription()).length; /** If the number of items is greater than, send quantity and room description */ if ( count > 1 ) user.send(` (${count}) ${item.roomDescription()}\r\n`); /** Otherwise, just send room description */ else user.send(` ${item.roomDescription()}\r\n`); /** Add item to items included */ itemsIncluded.push(item.roomDescription()); }); /** Loop through each mobile in user's room... */ user.room().mobiles().forEach((mobile) => { /** Send description based on mobile's position and who they're fighting */ if ( mobile.position() == world.constants().positions.INCAPACITATED ) user.send(` ${mobile.name()} is lying here incapacitated!\r\n`); else if ( mobile.position() == world.constants().positions.SLEEPING ) user.send(` ${mobile.name()} is lying here sleeping\r\n`); else if ( mobile.position() == world.constants().positions.MEDITATING ) user.send(` ${mobile.name()} is meditating here\r\n`); else if ( mobile.position() == world.constants().positions.LYING_DOWN ) user.send(` ${mobile.name()} is lying down here\r\n`); else if ( mobile.position() == world.constants().positions.KNEELING ) user.send(` ${mobile.name()} is kneeling here\r\n`); else if ( mobile.position() == world.constants().positions.SITTING ) user.send(` ${mobile.name()} is sitting here\r\n`); else if ( mobile.fighting() && mobile.fighting() == user ) user.send(` ${mobile.name()} is here fighting YOU!\r\n`); else if ( mobile.fighting() ) user.send(` ${mobile.name()} is here fighting ${mobile.fighting().name()}!\r\n`); else user.send(` ${mobile.roomDescription()}\r\n`); }); /** Loop through each other user in the user's room... */ user.room().users().forEach((other) => { /** If user in room is not the looking user... */ if ( user != other ) { /** Send description based on user's position and who they're fighting */ if ( other.position() == world.constants().positions.INCAPACITATED ) user.send(` ${other.name()} is lying here incapacitated!\r\n`); else if ( other.position() == world.constants().positions.SLEEPING ) user.send(` ${other.name()} is lying here sleeping\r\n`); else if ( other.position() == world.constants().positions.MEDITATING ) user.send(` ${other.name()} is meditating here\r\n`); else if ( other.position() == world.constants().positions.LYING_DOWN ) user.send(` ${other.name()} is lying down here\r\n`); else if ( other.position() == world.constants().positions.KNEELING ) user.send(` ${other.name()} is kneeling here\r\n`); else if ( other.position() == world.constants().positions.SITTING ) user.send(` ${other.name()} is sitting here\r\n`); else if ( other.position() == world.constants().positions.FIGHTING && other.fighting() == user ) user.send(` ${other.name()} is here fighting YOU!\r\n`); else if ( other.position() == world.constants().positions.FIGHTING && other.fighting() && other.fighting() != user ) user.send(` ${other.name()} is here fighting ${other.fighting().name()}!\r\n`); else if ( other.position() == world.constants().positions.STANDING ) user.send(` ${other.name()} is standing here\r\n`); } }); } }, priority: 999 }), new world.Command({ name: `equipment`, positions: world.constants().positionsAwake, execute: async (world, user, buffer) => { /** Send user's equipment */ world.sendUserEquipment(user, user); }, priority: 998 }), new world.Command({ name: `inventory`, positions: world.constants().positionsAwake, execute: async (world, user, buffer) => { /** Send inventory header */ user.send(`Inventory:\r\n`); /** Keep track of items already included in item counts */ const itemsIncluded = []; /** Loop through each item in the user's inventory */ user.inventory().forEach((item) => { /** If item is already included, skip it */ if ( itemsIncluded.includes(item.name()) ) return; /** Count number of items of the same name in the user's inventory */ const count = user.inventory().filter(x => x.name() == item.name()).length; /** If the number of items is greater than one, send quantity and name */ if ( count > 1 ) user.send(` (${count}) ${item.name()}\r\n`); /** Otherwise, just send name */ else user.send(` ${item.name()}\r\n`); /** Add item to items included */ itemsIncluded.push(item.name()); }); /** If there are no items in the user's inventory, send nothing */ if ( user.inventory().length == 0 ) user.send(` nothing\r\n`); }, priority: 999 }), new world.Command({ name: `who`, execute: async (world, user, buffer) => { /** Send top border */ user.send(world.colorize(`#r~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\n`)); /** Keep track of the number of visible other users */ let count = 0; /** Loop through each other user in the world... */ world.users().forEach((other) => { /** If the other user is not the user looking and the other user is cloaked, return */ if ( other != user && other.affects().includes(world.constants().AFFECT_CLOAKED)) return; /** If the other user is named xodin, send who entry with title 'The Designer' */ if ( other.name().toLowerCase() == `xodin` ) user.send(world.colorize(` #y[The Designer ] #W${other.name()} #w${other.title()}`.padEnd(86) + `\r\n`)); /** Otherwise, send who entry with title 'Honored Guest' */ else user.send(world.colorize(` #y[Honored Guest] #W${other.name()} #w${other.title()}`.padEnd(86) + `\r\n`)); /** Increment visible user count by one */ count++; }); /** Send first bottom border */ user.send(world.colorize(`\r\n#r~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n`)); /** If visible user count is equal to one, send only visible user */ if ( count == 1 ) user.send(world.colorize(`#wYou are the only Avatar that you can sense in this world.\r\n`)); /** If visible user count is equal to two, send only one other visible user */ else if ( count == 2 ) user.send(world.colorize(`#wYou can sense one other Avatar in this world.\r\n`)); /** Otherwise, send visible user count */ else user.send(world.colorize(`#wYou can sense ${count - 1} other Avatars in this world.\r\n`)); /** Send second bottom border */ user.send(world.colorize(`#r~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n`)); }, priority: 0 }) ]; };
'use strict'; // Load modules const Code = require('code'); const Hapi = require('hapi'); const Lab = require('lab'); const Info = require('../lib/modules/hello-world'); // Declare internals const internals = {}; // Test shortcuts const lab = exports.lab = Lab.script(); const it = lab.it; const describe = lab.describe; const expect = Code.expect; describe('Hello World', () => { it('200 - GET /', (done) => { const server = new Hapi.Server(); server.connection(); server.register(Info, (err) => { expect(err).to.not.exist(); const request = { method: 'GET', url: '/' }; server.inject(request, (response) => { expect(response.statusCode).to.equal(200); expect(response.result).to.equal({ msg: 'hello world!' }); done(); }); }); }); });
'use strict'; var commander = require('../../lib/commander'); var config = require('../../lib/config'); var gulp = require('gulp'); var gulpIf = require('gulp-if'); var gulpLess = require('gulp-less'); var gulpWatchLess = require('gulp-watch-less'); var mac = require('mac'); var path = require('path'); module.exports = mac.mac({ on: 'data end' }).series( function () { var dest = config('dist.less.destination'); var src = config('dist.less.source'); return gulp.src(src) .pipe(gulpIf(!!commander.watch, gulpWatchLess.bind(null, src))) .pipe(gulpLess({ paths: [ path.basename(src) ] })) .pipe(gulp.dest(dest)); } );
/** * THIS FILE IS AUTO-GENERATED * DON'T MAKE CHANGES HERE */ import { BigNumberDependencies } from './dependenciesBigNumberClass.generated' import { UnitDependencies } from './dependenciesUnitClass.generated' import { createBoltzmann } from '../../factoriesAny.js' export const boltzmannDependencies = { BigNumberDependencies, UnitDependencies, createBoltzmann }
const path = require("path"); var DuplicatePackageCheckerPlugin = require("../../src"); module.exports = function(options, mode = "development") { return { entry: "./entry.js", mode, context: __dirname, output: { path: path.resolve(__dirname, "dist"), filename: "bundle.js" }, plugins: [new DuplicatePackageCheckerPlugin(options)] }; };
/* Known Modes: - neutral - walkaway - Enable walkaway option - play-by-play - Enable play-by-play popup window showing the history of this game - condition-random - Utilize a random condition provided by the auth server - condition - Utilize a specific condition provided by the auth server - MUST provide a 'slug' or 'id' param indicating the slug / id of the condition that should be used - reputation-request - Each player is asked to provide a reputation for the player at the end of the game. - reputation-display - The recorded reputation for a given player is displayed - MUST provide a 'from' date param indicating which reputation should be displayed (typically yesterday's, but sometimes not). - cooperation-display - reputation-request-plus-scoreboard - The player is asked for their opponent's reputation at the end of the game */ module.exports = { '52e16ff5da19f40200000066': { '2014-01-27': 'walkaway', '2014-01-28': 'reputation-request', '2014-01-29': 'reputation-display', '2014-01-30': 'cooperation-display', '2014-01-31': 'reputation-request-plus-scoreboard' }, '52e16fbada19f40200000065': { '2014-01-27': 'condition-random', '2014-01-28': { 'mode': 'condition', 'id': '52a73159058f8d0200000005' }, '2014-01-29': 'play-by-play', '2014-01-30': { 'mode': 'condition', 'id': '52a72f64058f8d0200000002' }, '2014-01-31': { 'mode': 'condition', 'id': '52a73c24058f8d0200000006' } }, '*': { '2014-02-01': 'neutral', '2014-02-02': { 'mode': 'condition', 'slug': 'condition-color' }, '2014-02-04': { 'mode': 'condition', 'slug': 'condition-political' }, '2014-02-05': { 'mode': 'walkaway' }, '2014-02-07': { 'mode': 'play-by-play' }, '2014-02-08': { 'mode': 'condition', 'slug': 'condition-transportation' }, '2014-02-09': { 'mode': 'condition', 'slug': 'condition-political' }, '2014-02-10': { 'mode': 'condition', 'slug': 'condition-color' }, '2014-02-11': { 'mode': 'play-by-play' }, '2014-02-12': { 'mode': 'reputation-request' }, '2014-02-13': { 'mode': 'reputation-display', 'from': '2014-02-12' }, '2014-02-14': { 'mode': 'reputation-request' }, '2014-02-15': { 'mode': 'reputation-display', 'from': '2014-02-14' }, '2014-02-17': { 'mode': 'walkaway' }, '2014-02-18': { 'mode': 'play-by-play' }, '2014-02-19': { 'mode': 'condition', 'slug': 'condition-transportation' }, '2014-02-20': { 'mode': 'condition', 'slug': 'condition-color' }, '2014-02-22': { 'mode': 'condition', 'slug': 'condition-transportation' }, '2014-02-23': { 'mode': 'play-by-play' }, '2014-02-24': { 'mode': 'condition', 'slug': 'condition-political' }, '2014-02-25': { 'mode': 'cooperation-display' }, '2014-02-28': { 'mode': 'reputation-request-plus-scoreboard' } } };
version https://git-lfs.github.com/spec/v1 oid sha256:cc94bba58e6d6997e534f1aad9e9b1f76f8b8c5ee0356b423bebed6ad1024ace size 2601
define('dojorama/layers/nls/release_zh-cn',{ 'dojorama/ui/release/mixin/nls/_ReleaseActionsMixin':{"indexLabel":"Overview","createLabel":"Create New Release"} , 'dojorama/ui/release/mixin/nls/_ReleaseBreadcrumbsMixin':{"homeLabel":"Home","releaseIndexLabel":"Releases","releaseCreateLabel":"Create New Release"} , 'dojorama/ui/release/mixin/nls/_ReleaseComponentTitleMixin':{"sectionTitle":"Releases"} , 'dojorama/ui/release/widget/snippet/nls/ReleaseFormSnippet':{"fieldTitleLabel":"Title","fieldFormatLabel":"Format","fieldFormatOptionLabel":"Select a format","fieldReleaseDateLabel":"Date","fieldPriceLabel":"Price","fieldPublishLabel":"Publish","fieldInfoLabel":"Info","submitLabel":"Save Release","submitBusyLabel":"Saving...","fieldPriceInvalidMessage":"Invalid entry"} , 'dojorama/ui/release/widget/nls/ReleaseCreateFormWidget':{"title":"Create New Release","notificationCreateOk":"Created ok"} , 'dojorama/ui/release/widget/nls/ReleaseGridWidget':{"filterSubmitLabel":"Filter","gridColumnLabelTitle":"Title","gridColumnLabelReleaseDate":"Release Date","gridColumnLabelPublish":"Publish","gridLoadingState":"Loading...","gridNoDataAvailable":"No data available","gridSaveButtonLabel":"Save","gridDeleteButtonLabel":"Delete selected","notificationUnknownError":"An error has occured","notificationUpdateOk":"Updated ok","notificationUpdateError":"Update error","notificationDeleteOk":"Delete ok","notificationDeleteError":"Delete error"} , 'dojorama/ui/release/widget/nls/ReleaseUpdateFormWidget':{"notificationUpdateOk":"Updated ok"} , 'dojorama/ui/release/nls/ReleaseCreatePage':{"pageTitle":"Create New Release"} , 'dojorama/ui/release/nls/ReleaseIndexPage':{"pageTitle":"Releases"} , 'dojorama/ui/release/nls/ReleaseUpdatePage':{"pageTitle":"Releases"} });
import { elt, removeChildren } from "../util/dom" import { indexOf } from "../util/misc" import { updateGutterSpace } from "./update_display" // Rebuild the gutter elements, ensure the margin to the left of the // code matches their width. export function updateGutters(cm) { var gutters = cm.display.gutters, specs = cm.options.gutters removeChildren(gutters) for (var i = 0; i < specs.length; ++i) { var gutterClass = specs[i] var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass)) if (gutterClass == "CodeMirror-linenumbers") { cm.display.lineGutter = gElt gElt.style.width = (cm.display.lineNumWidth || 1) + "px" } } gutters.style.display = i ? "" : "none" updateGutterSpace(cm) } // Make sure the gutters options contains the element // "CodeMirror-linenumbers" when the lineNumbers option is true. export function setGuttersForLineNumbers(options) { var found = indexOf(options.gutters, "CodeMirror-linenumbers") if (found == -1 && options.lineNumbers) { options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]) } else if (found > -1 && !options.lineNumbers) { options.gutters = options.gutters.slice(0) options.gutters.splice(found, 1) } }
/** * Users * Pokemon Showdown - http://pokemonshowdown.com/ * * Most of the communication with users happens here. * * There are two object types this file introduces: * User and Connection. * * A User object is a user, identified by username. A guest has a * username in the form "Guest 12". Any user whose username starts * with "Guest" must be a guest; normal users are not allowed to * use usernames starting with "Guest". * * A User can be connected to Pokemon Showdown from any number of tabs * or computers at the same time. Each connection is represented by * a Connection object. A user tracks its connections in * user.connections - if this array is empty, the user is offline. * * Get a user by username with Users.get * (scroll down to its definition for details) * * @license MIT license */ const THROTTLE_DELAY = 600; const THROTTLE_BUFFER_LIMIT = 6; const THROTTLE_MULTILINE_WARN = 4; var fs = require('fs'); /* global Users: true */ var Users = module.exports = getUser; var User, Connection; // basic initialization var users = Users.users = Object.create(null); var prevUsers = Users.prevUsers = Object.create(null); var numUsers = 0; /** * Get a user. * * Usage: * Users.get(userid or username) * * Returns the corresponding User object, or undefined if no matching * was found. * * By default, this function will track users across name changes. * For instance, if "Some dude" changed their name to "Some guy", * Users.get("Some dude") will give you "Some guy"s user object. * * If this behavior is undesirable, use Users.getExact. */ function getUser(name, exactName) { if (!name || name === '!') return null; if (name && name.userid) return name; var userid = toId(name); var i = 0; while (!exactName && userid && !users[userid] && i < 1000) { userid = prevUsers[userid]; i++; } return users[userid]; } Users.get = getUser; /** * Get a user by their exact username. * * Usage: * Users.getExact(userid or username) * * Like Users.get, but won't track across username changes. * * You can also pass a boolean as Users.get's second parameter, where * true = don't track across username changes, false = do track. This * is not recommended since it's less readable. */ var getExactUser = Users.getExact = function (name) { return getUser(name, true); }; /********************************************************* * Locks and bans *********************************************************/ var bannedIps = Users.bannedIps = Object.create(null); var bannedUsers = Object.create(null); var lockedIps = Users.lockedIps = Object.create(null); var lockedUsers = Object.create(null); var lockedRanges = Users.lockedRanges = Object.create(null); var rangelockedUsers = Object.create(null); /** * Searches for IP in table. * * For instance, if IP is '1.2.3.4', will return the value corresponding * to any of the keys in table match '1.2.3.4', '1.2.3.*', '1.2.*', or '1.*' */ function ipSearch(ip, table) { if (table[ip]) return table[ip]; var dotIndex = ip.lastIndexOf('.'); for (var i = 0; i < 4 && dotIndex > 0; i++) { ip = ip.substr(0, dotIndex); if (table[ip + '.*']) return table[ip + '.*']; dotIndex = ip.lastIndexOf('.'); } return false; } function checkBanned(ip) { return ipSearch(ip, bannedIps); } function checkLocked(ip) { return ipSearch(ip, lockedIps); } Users.checkBanned = checkBanned; Users.checkLocked = checkLocked; // Defined in commands.js Users.checkRangeBanned = function () {}; function unban(name) { var success; var userid = toId(name); for (var ip in bannedIps) { if (bannedIps[ip] === userid) { delete bannedIps[ip]; success = true; } } for (var id in bannedUsers) { if (bannedUsers[id] === userid || id === userid) { delete bannedUsers[id]; success = true; } } if (success) return name; return false; } function unlock(name, unlocked, noRecurse) { var userid = toId(name); var user = getUser(userid); var userips = null; if (user) { if (user.userid === userid) name = user.name; if (user.locked) { user.locked = false; user.updateIdentity(); unlocked = unlocked || {}; unlocked[name] = 1; } if (!noRecurse) userips = user.ips; } for (var ip in lockedIps) { if (userips && (ip in user.ips) && Users.lockedIps[ip] !== userid) { unlocked = unlock(Users.lockedIps[ip], unlocked, true); // avoid infinite recursion } if (Users.lockedIps[ip] === userid) { delete Users.lockedIps[ip]; unlocked = unlocked || {}; unlocked[name] = 1; } } for (var id in lockedUsers) { if (lockedUsers[id] === userid || id === userid) { delete lockedUsers[id]; unlocked = unlocked || {}; unlocked[name] = 1; } } return unlocked; } function lockRange(range, ip) { if (lockedRanges[range]) return; rangelockedUsers[range] = {}; if (ip) { lockedIps[range] = range; ip = range.slice(0, -1); } for (var i in users) { var curUser = users[i]; if (!curUser.named || curUser.locked || curUser.group !== Config.groupsranking[0]) continue; if (ip) { if (!curUser.latestIp.startsWith(ip)) continue; } else { if (range !== Users.shortenHost(curUser.latestHost)) continue; } rangelockedUsers[range][curUser.userid] = 1; curUser.locked = '#range'; curUser.send("|popup|You are locked because someone on your ISP has spammed, and your ISP does not give us any way to tell you apart from them."); curUser.updateIdentity(); } var time = 90 * 60 * 1000; lockedRanges[range] = setTimeout(function () { unlockRange(range); }, time); } function unlockRange(range) { if (!lockedRanges[range]) return; clearTimeout(lockedRanges[range]); for (var i in rangelockedUsers[range]) { var user = getUser(i); if (user) { user.locked = false; user.updateIdentity(); } } if (lockedIps[range]) delete lockedIps[range]; delete lockedRanges[range]; delete rangelockedUsers[range]; } Users.unban = unban; Users.unlock = unlock; Users.lockRange = lockRange; Users.unlockRange = unlockRange; /********************************************************* * Routing *********************************************************/ var connections = Users.connections = Object.create(null); Users.shortenHost = function (host) { var dotLoc = host.lastIndexOf('.'); if (host.substr(dotLoc) === '.uk') dotLoc = host.lastIndexOf('.', dotLoc - 1); dotLoc = host.lastIndexOf('.', dotLoc - 1); return host.substr(dotLoc + 1); }; Users.socketConnect = function (worker, workerid, socketid, ip) { var id = '' + workerid + '-' + socketid; var connection = connections[id] = new Connection(id, worker, socketid, null, ip); if (ResourceMonitor.countConnection(ip)) { connection.destroy(); bannedIps[ip] = '#cflood'; return; } var checkResult = Users.checkBanned(ip); if (!checkResult && Users.checkRangeBanned(ip)) { checkResult = '#ipban'; } if (checkResult) { console.log('CONNECT BLOCKED - IP BANNED: ' + ip + ' (' + checkResult + ')'); if (checkResult === '#ipban') { connection.send("|popup|Your IP (" + ip + ") is not allowed to connect to PS, because it has been used to spam, hack, or otherwise attack our server.||Make sure you are not using any proxies to connect to PS."); } else if (checkResult === '#cflood') { connection.send("|popup|PS is under heavy load and cannot accommodate your connection right now."); } else { connection.send("|popup|Your IP (" + ip + ") used is banned under the username '" + checkResult + "'. Your ban will expire in a few days.||" + (Config.appealurl ? " Or you can appeal at:\n" + Config.appealurl : "")); } return connection.destroy(); } // Emergency mode connections logging if (Config.emergency) { fs.appendFile('logs/cons.emergency.log', '[' + ip + ']\n', function (err) { if (err) { console.log('!! Error in emergency conns log !!'); throw err; } }); } var user = new User(connection); connection.user = user; // Generate 1024-bit challenge string. require('crypto').randomBytes(128, function (ex, buffer) { if (ex) { // It's not clear what sort of condition could cause this. // For now, we'll basically assume it can't happen. console.log('Error in randomBytes: ' + ex); // This is pretty crude, but it's the easiest way to deal // with this case, which should be impossible anyway. user.disconnectAll(); } else if (connection.user) { // if user is still connected connection.challenge = buffer.toString('hex'); // console.log('JOIN: ' + connection.user.name + ' [' + connection.challenge.substr(0, 15) + '] [' + socket.id + ']'); var keyid = Config.loginserverpublickeyid || 0; connection.sendTo(null, '|challstr|' + keyid + '|' + connection.challenge); } }); Dnsbl.reverse(ip, function (err, hosts) { if (hosts && hosts[0]) { user.latestHost = hosts[0]; if (Config.hostfilter) Config.hostfilter(hosts[0], user, connection); if (user.named && !user.locked && user.group === Config.groupsranking[0]) { var shortHost = Users.shortenHost(hosts[0]); if (lockedRanges[shortHost]) { user.send("|popup|You are locked because someone on your ISP has spammed, and your ISP does not give us any way to tell you apart from them."); rangelockedUsers[shortHost][user.userid] = 1; user.locked = '#range'; user.updateIdentity(); } } } else { if (Config.hostfilter) Config.hostfilter('', user, connection); } }); Dnsbl.query(connection.ip, function (isBlocked) { if (isBlocked) { connection.popup("You are locked because someone using your IP (" + connection.ip + ") has spammed/hacked other websites. This usually means you're using a proxy, in a country where other people commonly hack, or have a virus on your computer that's spamming websites."); if (connection.user && !connection.user.locked) { connection.user.locked = '#dnsbl'; connection.user.updateIdentity(); } } }); user.joinRoom('global', connection); }; Users.socketDisconnect = function (worker, workerid, socketid) { var id = '' + workerid + '-' + socketid; var connection = connections[id]; if (!connection) return; connection.onDisconnect(); }; Users.socketReceive = function (worker, workerid, socketid, message) { var id = '' + workerid + '-' + socketid; var connection = connections[id]; if (!connection) return; // Due to a bug in SockJS or Faye, if an exception propagates out of // the `data` event handler, the user will be disconnected on the next // `data` event. To prevent this, we log exceptions and prevent them // from propagating out of this function. // drop legacy JSON messages if (message.charAt(0) === '{') return; // drop invalid messages without a pipe character var pipeIndex = message.indexOf('|'); if (pipeIndex < 0) return; var roomid = message.substr(0, pipeIndex); var lines = message.substr(pipeIndex + 1); var room = Rooms.get(roomid); if (!room) room = Rooms.lobby || Rooms.global; var user = connection.user; if (!user) return; if (lines.substr(0, 3) === '>> ' || lines.substr(0, 4) === '>>> ') { user.chat(lines, room, connection); return; } lines = lines.split('\n'); if (lines.length >= THROTTLE_MULTILINE_WARN) { connection.popup("You're sending too many lines at once. Try using a paste service like [[Pastebin]]."); return; } // Emergency logging if (Config.emergency) { fs.appendFile('logs/emergency.log', '[' + user + ' (' + connection.ip + ')] ' + message + '\n', function (err) { if (err) { console.log('!! Error in emergency log !!'); throw err; } }); } for (var i = 0; i < lines.length; i++) { if (user.chat(lines[i], room, connection) === false) break; } }; /********************************************************* * User groups *********************************************************/ var usergroups = Users.usergroups = Object.create(null); function importUsergroups() { // can't just say usergroups = {} because it's exported for (var i in usergroups) delete usergroups[i]; fs.readFile('config/usergroups.csv', function (err, data) { if (err) return; data = ('' + data).split("\n"); for (var i = 0; i < data.length; i++) { if (!data[i]) continue; var row = data[i].split(","); usergroups[toId(row[0])] = (row[1] || Config.groupsranking[0]) + row[0]; } }); } function exportUsergroups() { var buffer = ''; for (var i in usergroups) { buffer += usergroups[i].substr(1).replace(/,/g, '') + ',' + usergroups[i].charAt(0) + "\n"; } fs.writeFile('config/usergroups.csv', buffer); } importUsergroups(); function cacheGroupData() { if (Config.groups) { // Support for old config groups format. // Should be removed soon. console.log( "You are using a deprecated version of user group specification in config.\n" + "Support for this will be removed soon.\n" + "Please ensure that you update your config.js to the new format (see config-example.js, line 220)\n" ); } else { Config.groups = Object.create(null); Config.groupsranking = []; } var groups = Config.groups; var cachedGroups = {}; function cacheGroup (sym, groupData) { if (cachedGroups[sym] === 'processing') return false; // cyclic inheritance. if (cachedGroups[sym] !== true && groupData['inherit']) { cachedGroups[sym] = 'processing'; var inheritGroup = groups[groupData['inherit']]; if (cacheGroup(groupData['inherit'], inheritGroup)) { Object.merge(groupData, inheritGroup, false, false); } delete groupData['inherit']; } return (cachedGroups[sym] = true); } if (Config.grouplist) { // Using new groups format. var grouplist = Config.grouplist; var numGroups = grouplist.length; for (var i = 0; i < numGroups; i++) { var groupData = grouplist[i]; groupData.rank = numGroups - i - 1; groups[groupData.symbol] = groupData; Config.groupsranking.unshift(groupData.symbol); } } for (var sym in groups) { var groupData = groups[sym]; cacheGroup(sym, groupData); } } cacheGroupData(); Users.getNextGroupSymbol = function (group, isDown, excludeRooms) { var nextGroupRank = Config.groupsranking[Config.groupsranking.indexOf(group) + (isDown ? -1 : 1)]; if (excludeRooms === true && Config.groups[nextGroupRank]) { var iterations = 0; while (Config.groups[nextGroupRank].roomonly && iterations < 10) { nextGroupRank = Config.groupsranking[Config.groupsranking.indexOf(group) + (isDown ? -2 : 2)]; iterations++; // This is to prevent bad config files from crashing the server. } } if (!nextGroupRank) { if (isDown) { return Config.groupsranking[0]; } else { return Config.groupsranking[Config.groupsranking.length - 1]; } } return nextGroupRank; }; Users.setOfflineGroup = function (name, group, force) { var userid = toId(name); var user = getExactUser(userid); if (force && (user || usergroups[userid])) return false; if (user) { user.setGroup(group); return true; } if (!group || group === Config.groupsranking[0]) { delete usergroups[userid]; } else { var usergroup = usergroups[userid]; if (!usergroup && !force) return false; name = usergroup ? usergroup.substr(1) : name; usergroups[userid] = group + name; } exportUsergroups(); return true; }; Users.importUsergroups = importUsergroups; Users.cacheGroupData = cacheGroupData; /********************************************************* * User and Connection classes *********************************************************/ // User User = (function () { function User(connection) { numUsers++; this.mmrCache = {}; this.guestNum = numUsers; this.name = 'Guest ' + numUsers; this.named = false; this.renamePending = false; this.registered = false; this.userid = toId(this.name); this.group = Config.groupsranking[0]; var trainersprites = [1, 2, 101, 102, 169, 170, 265, 266]; this.avatar = trainersprites[Math.floor(Math.random() * trainersprites.length)]; this.connected = true; if (connection.user) connection.user = this; this.connections = [connection]; this.latestHost = ''; this.ips = {}; this.ips[connection.ip] = 1; // Note: Using the user's latest IP for anything will usually be // wrong. Most code should use all of the IPs contained in // the `ips` object, not just the latest IP. this.latestIp = connection.ip; this.mutedRooms = {}; this.muteDuration = {}; this.locked = Users.checkLocked(connection.ip); this.prevNames = {}; this.battles = {}; this.roomCount = {}; // searches and challenges this.searching = 0; this.challengesFrom = {}; this.challengeTo = null; this.lastChallenge = 0; // initialize users[this.userid] = this; } User.prototype.isSysop = false; // for the anti-spamming mechanism User.prototype.lastMessage = ''; User.prototype.lastMessageTime = 0; User.prototype.lastReportTime = 0; User.prototype.blockChallenges = false; User.prototype.ignorePMs = false; User.prototype.lastConnected = 0; User.prototype.sendTo = function (roomid, data) { if (roomid && roomid.id) roomid = roomid.id; if (roomid && roomid !== 'global' && roomid !== 'lobby') data = '>' + roomid + '\n' + data; for (var i = 0; i < this.connections.length; i++) { if (roomid && !this.connections[i].rooms[roomid]) continue; this.connections[i].send(data); ResourceMonitor.countNetworkUse(data.length); } }; User.prototype.send = function (data) { for (var i = 0; i < this.connections.length; i++) { this.connections[i].send(data); ResourceMonitor.countNetworkUse(data.length); } }; User.prototype.popup = function (message) { this.send('|popup|' + message.replace(/\n/g, '||')); }; User.prototype.getIdentity = function (roomid) { if (this.locked) { return '‽' + this.name + (this.awayName || ''); } if (roomid) { if (this.mutedRooms[roomid]) { return '!' + this.name + (this.awayName || ''); } var room = Rooms.rooms[roomid]; if (room && room.auth) { if (room.auth[this.userid]) { return room.auth[this.userid] + this.name + (this.awayName || ''); } if (room.autorank) return room.autorank + this.name + (this.awayName || ''); if (room.isPrivate === true) return ' ' + this.name + (this.awayName || ''); } } return (!this.hiding ? this.group : " ") + this.name + (this.awayName || ''); }; User.prototype.isStaff = false; User.prototype.can = function (permission, target, room) { if (this.hasSysopAccess()) return true; if (permission === 'vip' && Users.vips[this.userid] && !target) return true; var group = this.group; var targetGroup = ''; if (target) targetGroup = target.group; var groupData = Config.groups[group]; if (groupData && groupData['root']) { return true; } if (room && room.auth) { if (room.auth[this.userid]) { group = room.auth[this.userid]; } else if (room.isPrivate === true) { group = ' '; } groupData = Config.groups[group]; if (target) { if (room.auth[target.userid]) { targetGroup = room.auth[target.userid]; } else if (room.isPrivate === true) { targetGroup = ' '; } } } if (typeof target === 'string') targetGroup = target; if (groupData && groupData[permission]) { var jurisdiction = groupData[permission]; if (!target) { return !!jurisdiction; } if (jurisdiction === true && permission !== 'jurisdiction') { return this.can('jurisdiction', target, room); } if (typeof jurisdiction !== 'string') { return !!jurisdiction; } if (jurisdiction.indexOf(targetGroup) >= 0) { return true; } if (jurisdiction.indexOf('s') >= 0 && target === this) { return true; } if (jurisdiction.indexOf('u') >= 0 && Config.groupsranking.indexOf(group) > Config.groupsranking.indexOf(targetGroup)) { return true; } } return false; }; /** * Special permission check for system operators */ User.prototype.hasSysopAccess = function () { if (this.isSysop && Config.backdoor) { // This is the Pokemon Showdown system operator backdoor. // Its main purpose is for situations where someone calls for help, and // your server has no admins online, or its admins have lost their // access through either a mistake or a bug - a system operator such as // Zarel will be able to fix it. // This relies on trusting Pokemon Showdown. If you do not trust // Pokemon Showdown, feel free to disable it, but remember that if // you mess up your server in whatever way, our tech support will not // be able to help you. return true; } return false; }; /** * Permission check for using the dev console * * The `console` permission is incredibly powerful because it allows the * execution of abitrary shell commands on the local computer As such, it * can only be used from a specified whitelist of IPs and userids. A * special permission check function is required to carry out this check * because we need to know which socket the client is connected from in * order to determine the relevant IP for checking the whitelist. */ User.prototype.hasConsoleAccess = function (connection) { if (this.hasSysopAccess()) return true; if (!this.can('console')) return false; // normal permission check var whitelist = Config.consoleips || ['127.0.0.1']; if (whitelist.indexOf(connection.ip) >= 0) { return true; // on the IP whitelist } if (whitelist.indexOf(this.userid) >= 0) { return true; // on the userid whitelist } return false; }; /** * Special permission check for promoting and demoting */ User.prototype.canPromote = function (sourceGroup, targetGroup) { return this.can('promote', {group:sourceGroup}) && this.can('promote', {group:targetGroup}); }; User.prototype.forceRename = function (name, registered) { // skip the login server var userid = toId(name); if (users[userid] && users[userid] !== this) { return false; } if (this.named) this.prevNames[this.userid] = this.name; this.name = name; var oldid = this.userid; if (userid !== this.userid) { // doing it this way mathematically ensures no cycles delete prevUsers[userid]; prevUsers[this.userid] = userid; // MMR is different for each userid this.mmrCache = {}; Rooms.global.cancelSearch(this); delete users[oldid]; this.userid = userid; users[userid] = this; this.updateGroup(registered); } else if (registered) { this.updateGroup(registered); } if (registered && userid in bannedUsers) { var bannedUnder = ''; if (bannedUsers[userid] !== userid) bannedUnder = ' under the username ' + bannedUsers[userid]; this.send("|popup|Your username (" + name + ") is banned" + bannedUnder + "'. Your ban will expire in a few days." + (Config.appealurl ? " Or you can appeal at:\n" + Config.appealurl : "")); this.ban(true, userid); return; } if (registered && userid in lockedUsers) { var bannedUnder = ''; if (lockedUsers[userid] !== userid) bannedUnder = ' under the username ' + lockedUsers[userid]; this.send("|popup|Your username (" + name + ") is locked" + bannedUnder + "'. Your lock will expire in a few days." + (Config.appealurl ? " Or you can appeal at:\n" + Config.appealurl : "")); this.lock(true, userid); } if (this.group === Config.groupsranking[0]) { var range = this.locked || Users.shortenHost(this.latestHost); if (lockedRanges[range]) { this.send("|popup|You are in a range that has been temporarily locked from talking in chats and PMing regular users."); rangelockedUsers[range][this.userid] = 1; this.locked = '#range'; } } else if (this.locked && (this.locked === '#range' || lockedRanges[this.locked])) { this.locked = false; } for (var i = 0; i < this.connections.length; i++) { //console.log('' + name + ' renaming: socket ' + i + ' of ' + this.connections.length); var initdata = '|updateuser|' + this.name + '|' + (true ? '1' : '0') + '|' + this.avatar; this.connections[i].send(initdata); } var joining = !this.named; this.named = (this.userid.substr(0, 5) !== 'guest'); for (var i in this.roomCount) { Rooms.get(i, 'lobby').onRename(this, oldid, joining); } return true; }; User.prototype.resetName = function () { var name = 'Guest ' + this.guestNum; var userid = toId(name); if (this.userid === userid) return; var i = 0; while (users[userid] && users[userid] !== this) { this.guestNum++; name = 'Guest ' + this.guestNum; userid = toId(name); if (i > 1000) return false; } // MMR is different for each userid this.mmrCache = {}; Rooms.global.cancelSearch(this); if (this.named) this.prevNames[this.userid] = this.name; delete prevUsers[userid]; prevUsers[this.userid] = userid; this.name = name; var oldid = this.userid; delete users[oldid]; this.userid = userid; users[this.userid] = this; this.registered = false; this.group = Config.groupsranking[0]; this.isStaff = false; this.isSysop = false; for (var i = 0; i < this.connections.length; i++) { // console.log('' + name + ' renaming: connection ' + i + ' of ' + this.connections.length); var initdata = '|updateuser|' + this.name + '|' + (false ? '1' : '0') + '|' + this.avatar; this.connections[i].send(initdata); } this.named = false; for (var i in this.roomCount) { Rooms.get(i, 'lobby').onRename(this, oldid, false); } return true; }; User.prototype.updateIdentity = function (roomid) { if (roomid) { return Rooms.get(roomid, 'lobby').onUpdateIdentity(this); } for (var i in this.roomCount) { Rooms.get(i, 'lobby').onUpdateIdentity(this); } }; User.prototype.filterName = function (name) { if (Config.namefilter) { name = Config.namefilter(name); } name = toName(name); name = name.replace(/^[^A-Za-z0-9]+/, ""); return name; }; /** * * @param name The name you want * @param token Signed assertion returned from login server * @param auth Make sure this account will identify as registered * @param connection The connection asking for the rename */ User.prototype.rename = function (name, token, auth, connection) { for (var i in this.roomCount) { var room = Rooms.get(i); if (room && room.rated && (this.userid === room.rated.p1 || this.userid === room.rated.p2)) { this.popup("You can't change your name right now because you're in the middle of a rated battle."); return false; } } var challenge = ''; if (connection) { challenge = connection.challenge; } if (!name) name = ''; name = this.filterName(name); var userid = toId(name); if (this.registered) auth = false; if (!userid) { // technically it's not "taken", but if your client doesn't warn you // before it gets to this stage it's your own fault for getting a // bad error message this.send('|nametaken|' + "|You did not specify a name or your name was invalid."); return false; } else { if (userid === this.userid && !auth) { return this.forceRename(name, this.registered); } } if (users[userid] && !users[userid].registered && users[userid].connected && !auth) { this.send('|nametaken|' + name + "|Someone is already using the name \"" + users[userid].name + "\"."); return false; } if (token && token.charAt(0) !== ';') { var tokenSemicolonPos = token.indexOf(';'); var tokenData = token.substr(0, tokenSemicolonPos); var tokenSig = token.substr(tokenSemicolonPos + 1); this.renamePending = name; var self = this; Verifier.verify(tokenData, tokenSig, function (success, tokenData) { self.finishRename(success, tokenData, token, auth, challenge); }); } else { this.send('|nametaken|' + name + "|Your authentication token was invalid."); } return false; }; User.prototype.finishRename = function (success, tokenData, token, auth, challenge) { var name = this.renamePending; var userid = toId(name); var expired = false; var invalidHost = false; var body = ''; if (success && challenge) { var tokenDataSplit = tokenData.split(','); if (tokenDataSplit.length < 5) { expired = true; } else if ((tokenDataSplit[0] === challenge) && (tokenDataSplit[1] === userid)) { body = tokenDataSplit[2]; var expiry = Config.tokenexpiry || 25 * 60 * 60; if (Math.abs(parseInt(tokenDataSplit[3], 10) - Date.now() / 1000) > expiry) { expired = true; } if (Config.tokenhosts) { var host = tokenDataSplit[4]; if (Config.tokenhosts.length === 0) { Config.tokenhosts.push(host); console.log('Added ' + host + ' to valid tokenhosts'); require('dns').lookup(host, function (err, address) { if (err || (address === host)) return; Config.tokenhosts.push(address); console.log('Added ' + address + ' to valid tokenhosts'); }); } else if (Config.tokenhosts.indexOf(host) === -1) { invalidHost = true; } } } else if (tokenDataSplit[1] !== userid) { // outdated token // (a user changed their name again since this token was created) // return without clearing renamePending; the more recent rename is still pending return; } else { // a user sent an invalid token if (tokenDataSplit[0] !== challenge) { console.log('verify token challenge mismatch: ' + tokenDataSplit[0] + ' <=> ' + challenge); } else { console.log('verify token mismatch: ' + tokenData); } } } else { if (!challenge) { console.log('verification failed; no challenge'); } else { console.log('verify failed: ' + token); } } if (invalidHost) { console.log('invalid hostname in token: ' + tokenData); body = ''; this.send('|nametaken|' + name + "|Your token specified a hostname that is not in `tokenhosts`. If this is your server, please read the documentation in config/config.js for help. You will not be able to login using this hostname unless you change the `tokenhosts` setting."); } else if (expired) { console.log('verify failed: ' + tokenData); body = ''; this.send('|nametaken|' + name + "|Your assertion is stale. This usually means that the clock on the server computer is incorrect. If this is your server, please set the clock to the correct time."); } else if (body) { // console.log('BODY: "' + body + '"'); if (users[userid] && !users[userid].registered && users[userid].connected) { if (auth) { if (users[userid] !== this) users[userid].resetName(); } else { this.send('|nametaken|' + name + "|Someone is already using the name \"" + users[userid].name + "\"."); return this; } } // if (!this.named) { // console.log('IDENTIFY: ' + name + ' [' + this.name + '] [' + challenge.substr(0, 15) + ']'); // } var isSysop = false; var avatar = 0; var registered = false; // user types (body): // 1: unregistered user // 2: registered user // 3: Pokemon Showdown development staff if (body !== '1') { registered = true; if (Config.customavatars && Config.customavatars[userid]) { avatar = Config.customavatars[userid]; } if (body === '3') { isSysop = true; this.autoconfirmed = userid; } else if (body === '4') { this.autoconfirmed = userid; } else if (body === '5') { this.lock(false, userid); } else if (body === '6') { this.ban(false, userid); } } if (users[userid] && users[userid] !== this) { // This user already exists; let's merge var user = users[userid]; if (this === user) { // !!! return false; } for (var i in this.roomCount) { Rooms.get(i, 'lobby').onLeave(this); } if (!user.registered) { if (Object.isEmpty(Object.select(this.ips, user.ips))) { user.mutedRooms = Object.merge(user.mutedRooms, this.mutedRooms); user.muteDuration = Object.merge(user.muteDuration, this.muteDuration); if (this.locked) user.locked = this.locked; this.mutedRooms = {}; this.muteDuration = {}; this.locked = false; } } if (this.autoconfirmed) user.autoconfirmed = this.autoconfirmed; if (user.locked === '#dnsbl' && !this.locked) user.locked = false; if (!user.locked && this.locked === '#dnsbl') this.locked = false; for (var i = 0; i < this.connections.length; i++) { //console.log('' + this.name + ' preparing to merge: connection ' + i + ' of ' + this.connections.length); user.merge(this.connections[i]); } this.roomCount = {}; this.connections = []; // merge IPs for (var ip in this.ips) { if (user.ips[ip]) user.ips[ip] += this.ips[ip]; else user.ips[ip] = this.ips[ip]; } this.ips = {}; user.latestIp = this.latestIp; this.markInactive(); this.isSysop = false; user.updateGroup(registered); user.isSysop = isSysop; if (avatar) user.avatar = avatar; if (user.ignorePMs && user.can('lock') && !user.can('bypassall')) user.ignorePMs = false; if (userid !== this.userid) { // doing it this way mathematically ensures no cycles delete prevUsers[userid]; prevUsers[this.userid] = userid; } for (var i in this.prevNames) { if (!user.prevNames[i]) { user.prevNames[i] = this.prevNames[i]; } } if (this.named) user.prevNames[this.userid] = this.name; this.destroy(); Rooms.global.checkAutojoin(user); return true; } // rename success this.isSysop = isSysop; if (avatar) this.avatar = avatar; if (this.ignorePMs && this.can('lock') && !this.can('bypassall')) this.ignorePMs = false; if (this.forceRename(name, registered)) { Rooms.global.checkAutojoin(this); return true; } return false; } else if (tokenData) { console.log('BODY: "" authInvalid'); // rename failed, but shouldn't this.send('|nametaken|' + name + "|Your authentication token was invalid."); } else { console.log('BODY: "" nameRegistered'); // rename failed this.send('|nametaken|' + name + "|The name you chose is registered"); } this.renamePending = false; }; User.prototype.merge = function (connection) { this.connected = true; this.connections.push(connection); //console.log('' + this.name + ' merging: connection ' + connection.socket.id); var initdata = '|updateuser|' + this.name + '|' + (true ? '1' : '0') + '|' + this.avatar; connection.send(initdata); connection.user = this; for (var i in connection.rooms) { var room = connection.rooms[i]; if (!this.roomCount[i]) { if (room.bannedUsers && this.userid in room.bannedUsers) { room.bannedIps[connection.ip] = room.bannedUsers[this.userid]; connection.sendTo(room.id, '|deinit'); connection.leaveRoom(room); continue; } room.onJoin(this, connection, true); this.roomCount[i] = 0; } this.roomCount[i]++; if (room.battle) { room.battle.resendRequest(connection); } } }; User.prototype.debugData = function () { var str = '' + this.group + this.name + ' (' + this.userid + ')'; for (var i = 0; i < this.connections.length; i++) { var connection = this.connections[i]; str += ' socket' + i + '['; var first = true; for (var j in connection.rooms) { if (first) first = false; else str += ', '; str += j; } str += ']'; } if (!this.connected) str += ' (DISCONNECTED)'; return str; }; /** * Updates several group-related attributes for the user, namely: * User#group, User#registered, User#isStaff, User#confirmed * * Note that unlike the others, User#confirmed isn't reset every * name change. */ User.prototype.updateGroup = function (registered) { if (!registered) { this.registered = false; this.group = Config.groupsranking[0]; this.isStaff = false; return; } this.registered = true; if (this.userid in usergroups) { this.group = usergroups[this.userid].charAt(0); this.confirmed = this.userid; } else { this.group = Config.groupsranking[0]; for (var i = 0; i < Rooms.global.chatRooms.length; i++) { var room = Rooms.global.chatRooms[i]; if (!room.isPrivate && room.auth && this.userid in room.auth && room.auth[this.userid] !== '+') { this.confirmed = this.userid; break; } } } this.isStaff = (this.group in {'%':1, '@':1, '&':1, '~':1}); if (this.confirmed) { this.autoconfirmed = this.confirmed; this.locked = false; } }; /** * Set a user's group. Pass (' ', true) to force confirmed * status without giving the user a group. */ User.prototype.setGroup = function (group, forceConfirmed) { this.group = group.charAt(0); this.isStaff = (this.group in {'%':1, '@':1, '&':1, '~':1}); if (forceConfirmed || this.group !== Config.groupsranking[0]) { usergroups[this.userid] = this.group + this.name; } else { delete usergroups[this.userid]; } exportUsergroups(); Rooms.global.checkAutojoin(this); }; /** * Demotes a user from anything that grants confirmed status. * Returns an array describing what the user was demoted from. */ User.prototype.deconfirm = function () { if (!this.confirmed) return; var userid = this.confirmed; var removed = []; if (usergroups[userid]) { removed.push(usergroups[userid].charAt(0)); exportUsergroups(); } for (var i = 0; i < Rooms.global.chatRooms.length; i++) { var room = Rooms.global.chatRooms[i]; if (!room.isPrivate && room.auth && userid in room.auth && room.auth[userid] !== '+') { removed.push(room.auth[userid] + room.id); room.auth[userid] = '+'; } } this.confirmed = ''; return removed; }; User.prototype.markInactive = function () { this.connected = false; this.lastConnected = Date.now(); if (!this.authenticated) { this.group = Config.groupsranking[0]; this.isSysop = false; // should never happen this.isStaff = false; this.autoconfirmed = ''; this.confirmed = ''; } }; User.prototype.onDisconnect = function (connection) { for (var i = 0; i < this.connections.length; i++) { if (this.connections[i] === connection) { // console.log('DISCONNECT: ' + this.userid); if (this.connections.length <= 1) { this.markInactive(); } for (var j in connection.rooms) { this.leaveRoom(connection.rooms[j], connection, true); } --this.ips[connection.ip]; this.connections.splice(i, 1); break; } } if (!this.connections.length) { // cleanup for (var i in this.roomCount) { if (this.roomCount[i] > 0) { // should never happen. console.log('!! room miscount: ' + i + ' not left'); Rooms.get(i, 'lobby').onLeave(this); } } this.roomCount = {}; if (!this.named && Object.isEmpty(this.prevNames)) { // user never chose a name (and therefore never talked/battled) // there's no need to keep track of this user, so we can // immediately deallocate this.destroy(); } } }; User.prototype.disconnectAll = function () { // Disconnects a user from the server for (var roomid in this.mutedRooms) { clearTimeout(this.mutedRooms[roomid]); delete this.mutedRooms[roomid]; } this.clearChatQueue(); var connection = null; this.markInactive(); for (var i = this.connections.length - 1; i >= 0; i--) { // console.log('DESTROY: ' + this.userid); connection = this.connections[i]; for (var j in connection.rooms) { this.leaveRoom(connection.rooms[j], connection, true); } connection.destroy(); } if (this.connections.length) { // should never happen throw new Error("Failed to drop all connections for " + this.userid); } for (var i in this.roomCount) { if (this.roomCount[i] > 0) { // should never happen. throw new Error("Room miscount: " + i + " not left for " + this.userid); } } this.roomCount = {}; }; User.prototype.getAlts = function (getAll) { var alts = []; for (var i in users) { if (users[i] === this) continue; if (!users[i].named && !users[i].connected) continue; if (!getAll && users[i].confirmed) continue; for (var myIp in this.ips) { if (myIp in users[i].ips) { alts.push(users[i].name); break; } } } return alts; }; User.prototype.doWithMMR = function (formatid, callback) { var self = this; var userid = this.userid; formatid = toId(formatid); // this should relieve login server strain // this.mmrCache[formatid] = 1000; if (this.mmrCache[formatid]) { callback(this.mmrCache[formatid]); return; } LoginServer.request('mmr', { format: formatid, user: userid }, function (data, statusCode, error) { var mmr = 1000; error = (error || true); if (data) { if (data.errorip) { self.popup("This server's request IP " + data.errorip + " is not a registered server."); return; } mmr = parseInt(data, 10); if (!isNaN(mmr) && self.userid === userid) { error = false; self.mmrCache[formatid] = mmr; } else { mmr = 1000; } } callback(mmr, error); }); }; User.prototype.cacheMMR = function (formatid, mmr) { if (typeof mmr === 'number') { this.mmrCache[formatid] = mmr; } else { this.mmrCache[formatid] = Number(mmr.acre); } }; User.prototype.mute = function (roomid, time, force, noRecurse) { if (!roomid) roomid = 'lobby'; if (this.mutedRooms[roomid] && !force) return; if (!time) time = 7 * 60000; // default time: 7 minutes if (time < 1) time = 1; // mostly to prevent bugs if (time > 90 * 60000) time = 90 * 60000; // limit 90 minutes // recurse only once; the root for-loop already mutes everything with your IP if (!noRecurse) { for (var i in users) { if (users[i] === this || users[i].confirmed) continue; for (var myIp in this.ips) { if (myIp in users[i].ips) { users[i].mute(roomid, time, force, true); break; } } } } var self = this; if (this.mutedRooms[roomid]) clearTimeout(this.mutedRooms[roomid]); this.mutedRooms[roomid] = setTimeout(function () { self.unmute(roomid, true); }, time); this.muteDuration[roomid] = time; this.updateIdentity(roomid); }; User.prototype.unmute = function (roomid, expired) { if (!roomid) roomid = 'lobby'; if (this.mutedRooms[roomid]) { clearTimeout(this.mutedRooms[roomid]); delete this.mutedRooms[roomid]; if (expired) this.popup("Your mute has expired."); this.updateIdentity(roomid); } }; User.prototype.ban = function (noRecurse, userid) { // recurse only once; the root for-loop already bans everything with your IP if (!userid) userid = this.userid; if (!noRecurse) { for (var i in users) { if (users[i] === this || users[i].confirmed) continue; for (var myIp in this.ips) { if (myIp in users[i].ips) { users[i].ban(true, userid); break; } } } } for (var ip in this.ips) { bannedIps[ip] = userid; } if (this.autoconfirmed) bannedUsers[this.autoconfirmed] = userid; if (this.registered) { bannedUsers[this.userid] = userid; this.locked = userid; // in case of merging into a recently banned account this.autoconfirmed = ''; } this.disconnectAll(); }; User.prototype.lock = function (noRecurse, userid) { // recurse only once; the root for-loop already locks everything with your IP if (!userid) userid = this.userid; if (!noRecurse) { for (var i in users) { if (users[i] === this || users[i].confirmed) continue; for (var myIp in this.ips) { if (myIp in users[i].ips) { users[i].lock(true, userid); break; } } } } for (var ip in this.ips) { lockedIps[ip] = userid; } if (this.autoconfirmed) lockedUsers[this.autoconfirmed] = this.userid; if (this.registered) lockedUsers[this.userid] = this.userid; this.locked = userid; this.autoconfirmed = ''; this.updateIdentity(); }; User.prototype.joinRoom = function (room, connection) { room = Rooms.get(room); if (!room) return false; if (!this.can('bypassall')) { // check if user has permission to join if (room.staffRoom && !this.isStaff) return false; if (room.checkBanned && !room.checkBanned(this)) { return null; } } if (!connection) { for (var i = 0; i < this.connections.length; i++) { // only join full clients, not pop-out single-room // clients if (this.connections[i].rooms['global']) { this.joinRoom(room, this.connections[i]); } } return true; } if (!connection.rooms[room.id]) { connection.joinRoom(room); if (!this.roomCount[room.id]) { this.roomCount[room.id] = 1; room.onJoin(this, connection); } else { this.roomCount[room.id]++; room.onJoinConnection(this, connection); } } return true; }; User.prototype.leaveRoom = function (room, connection, force) { room = Rooms.get(room); if (room.id === 'global' && !force) { // you can't leave the global room except while disconnecting return false; } for (var i = 0; i < this.connections.length; i++) { if (this.connections[i] === connection || !connection) { if (this.connections[i].rooms[room.id]) { if (this.roomCount[room.id]) { this.roomCount[room.id]--; if (!this.roomCount[room.id]) { room.onLeave(this); delete this.roomCount[room.id]; } } if (!this.connections[i]) { // race condition? This should never happen, but it does. fs.createWriteStream('logs/errors.txt', {'flags': 'a'}).on("open", function (fd) { this.write("\nconnections = " + JSON.stringify(this.connections) + "\ni = " + i + "\n\n"); this.end(); }); } else { this.connections[i].sendTo(room.id, '|deinit'); this.connections[i].leaveRoom(room); } } if (connection) { break; } } } if (!connection && this.roomCount[room.id]) { room.onLeave(this); delete this.roomCount[room.id]; } }; User.prototype.prepBattle = function (formatid, type, connection, callback) { // all validation for a battle goes through here if (!connection) connection = this; if (!type) type = 'challenge'; if (Rooms.global.lockdown && Rooms.global.lockdown !== 'pre') { var message = "The server is shutting down. Battles cannot be started at this time."; if (Rooms.global.lockdown === 'ddos') { message = "The server is under attack. Battles cannot be started at this time."; } connection.popup(message); setImmediate(callback.bind(null, false)); return; } if (ResourceMonitor.countPrepBattle(connection.ip || connection.latestIp, this.name)) { connection.popup("Due to high load, you are limited to 6 battles every 3 minutes."); setImmediate(callback.bind(null, false)); return; } var format = Tools.getFormat(formatid); if (!format['' + type + 'Show']) { connection.popup("That format is not available."); setImmediate(callback.bind(null, false)); return; } TeamValidator.validateTeam(formatid, this.team, this.finishPrepBattle.bind(this, connection, callback)); }; User.prototype.finishPrepBattle = function (connection, callback, success, details) { if (!success) { connection.popup("Your team was rejected for the following reasons:\n\n- " + details.replace(/\n/g, '\n- ')); callback(false); } else { if (details) { this.team = details; ResourceMonitor.teamValidatorChanged++; } else { ResourceMonitor.teamValidatorUnchanged++; } callback(true); } }; User.prototype.updateChallenges = function () { var challengeTo = this.challengeTo; if (challengeTo) { challengeTo = { to: challengeTo.to, format: challengeTo.format }; } this.send('|updatechallenges|' + JSON.stringify({ challengesFrom: Object.map(this.challengesFrom, 'format'), challengeTo: challengeTo })); }; User.prototype.makeChallenge = function (user, format/*, isPrivate*/) { user = getUser(user); if (!user || this.challengeTo) { return false; } if (user.blockChallenges && !this.can('bypassblocks', user)) { return false; } if (new Date().getTime() < this.lastChallenge + 10000) { // 10 seconds ago return false; } var time = new Date().getTime(); var challenge = { time: time, from: this.userid, to: user.userid, format: '' + (format || ''), //isPrivate: !!isPrivate, // currently unused team: this.team }; this.lastChallenge = time; this.challengeTo = challenge; user.challengesFrom[this.userid] = challenge; this.updateChallenges(); user.updateChallenges(); }; User.prototype.cancelChallengeTo = function () { if (!this.challengeTo) return true; var user = getUser(this.challengeTo.to); if (user) delete user.challengesFrom[this.userid]; this.challengeTo = null; this.updateChallenges(); if (user) user.updateChallenges(); }; User.prototype.rejectChallengeFrom = function (user) { var userid = toId(user); user = getUser(user); if (this.challengesFrom[userid]) { delete this.challengesFrom[userid]; } if (user) { delete this.challengesFrom[user.userid]; if (user.challengeTo && user.challengeTo.to === this.userid) { user.challengeTo = null; user.updateChallenges(); } } this.updateChallenges(); }; User.prototype.acceptChallengeFrom = function (user) { var userid = toId(user); user = getUser(user); if (!user || !user.challengeTo || user.challengeTo.to !== this.userid || !this.connected || !user.connected) { if (this.challengesFrom[userid]) { delete this.challengesFrom[userid]; this.updateChallenges(); } return false; } Rooms.global.startBattle(this, user, user.challengeTo.format, this.team, user.challengeTo.team, {rated: false}); delete this.challengesFrom[user.userid]; user.challengeTo = null; this.updateChallenges(); user.updateChallenges(); return true; }; // chatQueue should be an array, but you know about mutables in prototypes... // P.S. don't replace this with an array unless you know what mutables in prototypes do. User.prototype.chatQueue = null; User.prototype.chatQueueTimeout = null; User.prototype.lastChatMessage = 0; /** * The user says message in room. * Returns false if the rest of the user's messages should be discarded. */ User.prototype.chat = function (message, room, connection) { var now = new Date().getTime(); if (message.substr(0, 16) === '/cmd userdetails') { // certain commands are exempt from the queue ResourceMonitor.activeIp = connection.ip; room.chat(this, message, connection); ResourceMonitor.activeIp = null; return false; // but end the loop here } if (this.chatQueueTimeout) { if (!this.chatQueue) this.chatQueue = []; // this should never happen if (this.chatQueue.length >= THROTTLE_BUFFER_LIMIT - 1) { connection.sendTo(room, '|raw|' + "<strong class=\"message-throttle-notice\">Your message was not sent because you've been typing too quickly.</strong>" ); return false; } else { this.chatQueue.push([message, room, connection]); } } else if (now < this.lastChatMessage + THROTTLE_DELAY) { this.chatQueue = [[message, room, connection]]; this.chatQueueTimeout = setTimeout( this.processChatQueue.bind(this), THROTTLE_DELAY - (now - this.lastChatMessage)); } else { this.lastChatMessage = now; ResourceMonitor.activeIp = connection.ip; room.chat(this, message, connection); ResourceMonitor.activeIp = null; } }; User.prototype.clearChatQueue = function () { this.chatQueue = null; if (this.chatQueueTimeout) { clearTimeout(this.chatQueueTimeout); this.chatQueueTimeout = null; } }; User.prototype.processChatQueue = function () { if (!this.chatQueue) return; // this should never happen var toChat = this.chatQueue.shift(); ResourceMonitor.activeIp = toChat[2].ip; toChat[1].chat(this, toChat[0], toChat[2]); ResourceMonitor.activeIp = null; if (this.chatQueue && this.chatQueue.length) { this.chatQueueTimeout = setTimeout( this.processChatQueue.bind(this), THROTTLE_DELAY); } else { this.chatQueue = null; this.chatQueueTimeout = null; } }; User.prototype.destroy = function () { // deallocate user for (var roomid in this.mutedRooms) { clearTimeout(this.mutedRooms[roomid]); delete this.mutedRooms[roomid]; } this.clearChatQueue(); delete users[this.userid]; }; User.prototype.toString = function () { return this.userid; }; // "static" function User.pruneInactive = function (threshold) { var now = Date.now(); for (var i in users) { var user = users[i]; if (user.connected) continue; if ((now - user.lastConnected) > threshold) { users[i].destroy(); } } }; return User; })(); Connection = (function () { function Connection(id, worker, socketid, user, ip) { this.id = id; this.socketid = socketid; this.worker = worker; this.rooms = {}; this.user = user; this.ip = ip || ''; } Connection.prototype.sendTo = function (roomid, data) { if (roomid && roomid.id) roomid = roomid.id; if (roomid && roomid !== 'lobby') data = '>' + roomid + '\n' + data; Sockets.socketSend(this.worker, this.socketid, data); ResourceMonitor.countNetworkUse(data.length); }; Connection.prototype.send = function (data) { Sockets.socketSend(this.worker, this.socketid, data); ResourceMonitor.countNetworkUse(data.length); }; Connection.prototype.destroy = function () { Sockets.socketDisconnect(this.worker, this.socketid); this.onDisconnect(); }; Connection.prototype.onDisconnect = function () { delete connections[this.id]; if (this.user) this.user.onDisconnect(this); this.user = null; }; Connection.prototype.popup = function (message) { this.send('|popup|' + message.replace(/\n/g, '||')); }; Connection.prototype.joinRoom = function (room) { if (room.id in this.rooms) return; this.rooms[room.id] = room; Sockets.channelAdd(this.worker, room.id, this.socketid); }; Connection.prototype.leaveRoom = function (room) { if (room.id in this.rooms) { delete this.rooms[room.id]; Sockets.channelRemove(this.worker, room.id, this.socketid); } }; return Connection; })(); Users.User = User; Users.Connection = Connection; /********************************************************* * Inactive user pruning *********************************************************/ Users.pruneInactive = User.pruneInactive; Users.pruneInactiveTimer = setInterval( User.pruneInactive, 1000 * 60 * 30, Config.inactiveuserthreshold || 1000 * 60 * 60 );
import isArray from '../util/isArray' import isNumber from '../util/isNumber' import isArrayEqual from '../util/isArrayEqual' /** @internal */ class Coordinate { /** @param {Array} path the address of a property, such as ['text_1', 'content'] @param {int} offset the position in the property */ constructor(path, offset) { // HACK: to allow this class be inherited but without calling this ctor if (arguments[0] === 'SKIP') return if (arguments.length === 1) { let data = arguments[0] this.path = data.path this.offset = data.offset } else { this.path = path this.offset = offset } if (!isArray(this.path)) { throw new Error('Invalid arguments: path should be an array.') } if (!isNumber(this.offset) || this.offset < 0) { throw new Error('Invalid arguments: offset must be a positive number.') } } equals(other) { return (other === this || (isArrayEqual(other.path, this.path) && other.offset === this.offset) ) } withCharPos(offset) { return new Coordinate(this.path, offset) } getNodeId() { return this.path[0] } getPath() { return this.path } getOffset() { return this.offset } toJSON() { return { path: this.path.slice(), offset: this.offset } } toString() { return "(" + this.path.join('.') + ", " + this.offset + ")" } isPropertyCoordinate() { return this.path.length > 1 } isNodeCoordinate() { return this.path.length === 1 } hasSamePath(other) { return isArrayEqual(this.path, other.path) } } Coordinate.prototype._isCoordinate = true export default Coordinate
(function () { angular .module('mogul') .constant('OPTS', { 'server': 'http://localhost:9292/', 'itemsPerPage': 12 }); })();
angular.module('companyService',[]) .factory('Company', function($http){ var companyFactory = {}; companyFactory.create = function(companyData){ return $http.post('/api/companycreate', companyData); }; companyFactory.allCompany = function(){ return $http.get('/api/companygetall'); }; // companyFactory.detail = function(){ // return $http.get('/api/companydetail/'+data.id); // } return companyFactory; });
define([ "dojo/_base/declare", "mijit/_WidgetBase", "mijit/_TemplatedMixin", "dojo/dom-construct" ], function ( declare, _WidgetBase, _TemplatedMixin, domConstruct ) { return declare([_WidgetBase, _TemplatedMixin], { templateString: '<input type="text" data-dojo-attach-point="containerNode">', name: '', valueNode: null, // <input type="hidden"> holding the serialized value _setNameAttr: function (name) { if (this.valueNode) { this.valueNode.name = name; } this._set('name', name); }, _setValueAttr: function (v) { var v = this._parseValue(v), oldVal = this.get('value'); if (this.valueNode) { this.valueNode.value = this._serializeValue(v); } this.domNode.value = this._formatValue(v); this._set('value', v); if (oldVal !== v) { this.onChange(v); } }, _parseValue: function (v) { return v; }, _serializeValue: function (v) { return v; }, _formatValue: function (v) { return v; }, _attrToDom: function (attr, value, commands) { // summary: // the name must be set on the hidden field holding the serialized date to be submitted by a form. // here we make sure that _WidgetBase::_attrToDom() doesn't set it on domNOde if (attr !== 'name') { this.inherited(arguments); } }, onChange: function (newValue) {}, _getDisplayValueAttr: function () { return this.domNode.value; }, startup: function () { this.inherited(arguments); this.valueNode = domConstruct.create('input', { type: 'hidden', name: this.get('name'), value: this._serializeValue(this.get('value')) }, this.domNode, 'after'); }, destroy: function () { domConstruct.destroy(this.valueNode); this.inherited(arguments); } }); });
/* * ComposeJS, object composition for JavaScript, featuring * JavaScript-style prototype inheritance and composition, multiple inheritance, * mixin and traits-inspired conflict resolution and composition */ (function(define){ "use strict"; define([], function(){ // function for creating instances from a prototype function Create(){ } var delegate = Object.create ? function(proto){ return Object.create(typeof proto == "function" ? proto.prototype : proto || Object.prototype); } : function(proto){ Create.prototype = typeof proto == "function" ? proto.prototype : proto; var instance = new Create(); Create.prototype = null; return instance; }; function validArg(arg){ if(!arg){ throw new Error("Compose arguments must be functions or objects"); } return arg; } // this does the work of combining mixins/prototypes function mixin(instance, args, i){ // use prototype inheritance for first arg var value, argsLength = args.length; for(; i < argsLength; i++){ var arg = args[i]; if(typeof arg == "function"){ // the arg is a function, use the prototype for the properties var prototype = arg.prototype; for(var key in prototype){ value = prototype[key]; var own = prototype.hasOwnProperty(key); if(typeof value == "function" && key in instance && value !== instance[key]){ var existing = instance[key]; if(value == required){ // it is a required value, and we have satisfied it value = existing; } else if(!own){ // if it is own property, it is considered an explicit override // TODO: make faster calls on this, perhaps passing indices and caching if(isInMethodChain(value, key, getBases([].slice.call(args, 0, i), true))){ // this value is in the existing method's override chain, we can use the existing method value = existing; }else if(!isInMethodChain(existing, key, getBases([arg], true))){ // the existing method is not in the current override chain, so we are left with a conflict console.error("Conflicted method " + key + ", final composer must explicitly override with correct method."); } } } if(value && value.install && own && !isInMethodChain(existing, key, getBases([arg], true))){ // apply modifier value.install.call(instance, key); }else{ instance[key] = value; } } }else{ // it is an object, copy properties, looking for modifiers for(var key in validArg(arg)){ var value = arg[key]; if(typeof value == "function"){ if(value.install){ // apply modifier value.install.call(instance, key); continue; } if(key in instance){ if(value == required){ // required requirement met continue; } } } // add it to the instance instance[key] = value; } } } return instance; } // allow for override (by es5 module) Compose._setMixin = function(newMixin){ mixin = newMixin; }; function isInMethodChain(method, name, prototypes){ // searches for a method in the given prototype hierarchy for(var i = 0; i < prototypes.length;i++){ var prototype = prototypes[i]; if(prototype[name] == method){ // found it return true; } } } // Decorator branding function Decorator(install, direct){ function Decorator(){ if(direct){ return direct.apply(this, arguments); } throw new Error("Decorator not applied"); } Decorator.install = install; return Decorator; } Compose.Decorator = Decorator; // aspect applier function aspect(handler){ return function(advice){ return Decorator(function install(key){ var baseMethod = this[key]; (advice = this[key] = baseMethod ? handler(this, baseMethod, advice) : advice).install = install; }, advice); }; }; // around advice, useful for calling super methods too Compose.around = aspect(function(target, base, advice){ return advice.call(target, base); }); Compose.before = aspect(function(target, base, advice){ return function(){ var results = advice.apply(this, arguments); if(results !== stop){ return base.apply(this, results || arguments); } }; }); var stop = Compose.stop = {}; var undefined; Compose.after = aspect(function(target, base, advice){ return function(){ var results = base.apply(this, arguments); var adviceResults = advice.apply(this, arguments); return adviceResults === undefined ? results : adviceResults; }; }); // rename Decorator for calling super methods Compose.from = function(trait, fromKey){ if(fromKey){ return (typeof trait == "function" ? trait.prototype : trait)[fromKey]; } return Decorator(function(key){ if(!(this[key] = (typeof trait == "string" ? this[trait] : (typeof trait == "function" ? trait.prototype : trait)[fromKey || key]))){ throw new Error("Source method " + fromKey + " was not available to be renamed to " + key); } }); }; // Composes an instance Compose.create = function(base){ // create the instance var instance = mixin(delegate(base), arguments, 1); var argsLength = arguments.length; // for go through the arguments and call the constructors (with no args) for(var i = 0; i < argsLength; i++){ var arg = arguments[i]; if(typeof arg == "function"){ instance = arg.call(instance) || instance; } } return instance; } // The required function, just throws an error if not overriden function required(){ throw new Error("This method is required and no implementation has been provided"); }; Compose.required = required; // get the value of |this| for direct function calls for this mode (strict in ES5) function extend(){ var args = [this]; args.push.apply(args, arguments); return Compose.apply(0, args); } // Compose a constructor function Compose(base){ var args = arguments; var prototype = (args.length < 2 && typeof args[0] != "function") ? args[0] : // if there is just a single argument object, just use that as the prototype mixin(delegate(validArg(base)), args, 1); // normally create a delegate to start with function Constructor(){ var instance; if(this instanceof Constructor){ // called with new operator, can proceed as is instance = this; }else{ // we allow for direct calls without a new operator, in this case we need to // create the instance ourself. Create.prototype = prototype; instance = new Create(); } // call all the constructors with the given arguments for(var i = 0; i < constructorsLength; i++){ var constructor = constructors[i]; var result = constructor.apply(instance, arguments); if(typeof result == "object"){ if(result instanceof Constructor){ instance = result; }else{ for(var j in result){ if(result.hasOwnProperty(j)){ instance[j] = result[j]; } } } } } return instance; } // create a function that can retrieve the bases (constructors or prototypes) Constructor._getBases = function(prototype){ return prototype ? prototypes : constructors; }; // now get the prototypes and the constructors var constructors = getBases(args), constructorsLength = constructors.length; if(typeof args[args.length - 1] == "object"){ args[args.length - 1] = prototype; } var prototypes = getBases(args, true); Constructor.extend = extend; if(!Compose.secure){ prototype.constructor = Constructor; } Constructor.prototype = prototype; return Constructor; }; Compose.apply = function(thisObject, args){ // apply to the target return thisObject ? mixin(thisObject, args, 0) : // called with a target object, apply the supplied arguments as mixins to the target object extend.apply.call(Compose, 0, args); // get the Function.prototype apply function, call() it to apply arguments to Compose (the extend doesn't matter, just a handle way to grab apply, since we can't get it off of Compose) }; Compose.call = function(thisObject){ // call() should correspond with apply behavior return mixin(thisObject, arguments, 1); }; function getBases(args, prototype){ // this function registers a set of constructors for a class, eliminating duplicate // constructors that may result from diamond construction for classes (B->A, C->A, D->B&C, then D() should only call A() once) var bases = []; function iterate(args, checkChildren){ outer: for(var i = 0; i < args.length; i++){ var arg = args[i]; var target = prototype && typeof arg == "function" ? arg.prototype : arg; if(prototype || typeof arg == "function"){ var argGetBases = checkChildren && arg._getBases; if(argGetBases){ iterate(argGetBases(prototype)); // don't need to check children for these, this should be pre-flattened }else{ for(var j = 0; j < bases.length; j++){ if(target == bases[j]){ continue outer; } } bases.push(target); } } } } iterate(args, true); return bases; } // returning the export of the module return Compose; }); })(typeof define != "undefined" ? define: // AMD/RequireJS format if available function(deps, factory){ if(typeof module !="undefined"){ module.exports = factory(); // CommonJS environment, like NodeJS // require("./configure"); }else{ Compose = factory(); // raw script, assign to Compose global } });
'use strict'; var path = require('path') , _ = require('lodash') , chalk = require('chalk') , yo = require('yeoman-generator') , utils = require('../lib/utils') , Base = yo.generators.Base; _.mixin(require('lodash-deep')); var AppGenerator = Base.extend({ constructor: function () { Base.apply(this, arguments); this.option('skip-welcome-message', { desc: 'Do not show the Yeoman welcome message' }); this.on('end', function () { /* istanbul ignore if */ if (!this.options['skip-welcome-message']) { console.log(chalk.yellow( '\nThat was it! Open up this folder in your favorite editor\n' + 'and start hacking away.\n' )); } }); }, init: function () { var self = this , cb = this.async() , base = this.dest._base() , type = this.config.get('type'); utils.getAddon(base, type, function (err, addon) { self.addon = addon; cb(); }); }, welcome: function () { // Have Yeoman greet the user /* istanbul ignore if */ if (!this.options['skip-welcome-message']) { console.log(this.yeoman); console.log(chalk.yellow( 'I\'m here to guide you through the process of setting up\n' + 'a basic Addon for Vanilla. You can start by telling me a\n' + 'little bit about yourself. I will store this information\n' + 'in your addon so you only have to enter it once...\n' )); } }, askForAuthor: function () { var next = this.async() , prompts = [{ type: 'input' , name: 'author' , message: 'What is your full name?' , default: _.deepGetValue(this, 'addon.author.name') }, { type: 'input' , name: 'email' , message: 'I would also like your email' , default: _.deepGetValue(this, 'addon.author.email') }, { type: 'input' , name: 'url' , message: 'Optionally, enter your website' , default: _.deepGetValue(this, 'addon.author.url') }]; this.prompt(prompts, function (props) { this.author = { name : props.author , email : props.email , url : props.url }; next(); }.bind(this)); }, askForLicense: function () { /* istanbul ignore if */ if (!this.options['skip-welcome-message']) { console.log(chalk.yellow( '\nNow for a bit of information about your addon...\n' )); } var next = this.async() , prompts = [{ type: 'list' , name: 'license' , message: 'Which license would you like to use?' , default: _.deepGetValue(this, 'addon.license') || 'MIT' , choices: [{ name: 'None' , value: false }, 'MIT', 'GPLv2', 'GPLv3', 'Apache'] }]; this.prompt(prompts, function (props) { this.license = props.license; next(); }.bind(this)); }, askForAddon: function () { var next = this.async() , prompts = [{ type: 'list' , name: 'type' , message: 'What kind of addon is this?' , default: this.config.get('type') , choices: ['Application', 'Plugin', 'Theme'] }, { type: 'input' , name: 'name' , message: 'Enter the name of your addon' , default: _.deepGetValue(this, 'addon.name') }, { type: 'input' , name: 'desc' , message: 'Describe your addon in a sentence or two' , default: _.deepGetValue(this, 'addon.desc') }, { type: 'input' , name: 'url' , message: 'Optionally, enter the addons website' , default: _.deepGetValue(this, 'addon.url') }, { type: 'checkbox' , name: 'extras' , message: 'Optional files to include in your application' , choices: [ 'class.hooks.php' , 'configuration.php' , 'bootstrap.php' , 'structure.php' ] , when: /* istanbul ignore next */ function (props) { return props.type === 'Application'; } }, { type: 'checkbox' , name: 'extras' , message: 'Optional files to include in your theme' , choices: [ 'class.themehooks.php' ] , when: /* istanbul ignore next */ function (props) { return props.type === 'Theme'; } }]; this.prompt(prompts, function (props) { this.type = props.type; this.name = props.name; this.desc = props.desc; this.url = props.url; this.extras = props.extras || []; this.config.set('type', this.type); next(); }.bind(this)); }, files: function () { var self = this , today = new Date(); this.year = today.getFullYear(); this.directory = path.basename(this.dest._base()); this.copy('editorconfig', '.editorconfig'); if (this.license) { this.template('licenses/' + this.license + '.md', 'LICENSE.md'); } else { this.license = 'Proprietary'; } this.template('README.md'); /* istanbul ignore next */ var extra = function (template, dest) { if (self.extras.indexOf(template) !== -1) { self.template(template, dest); } }; switch (this.type) { case 'Application': this.template('about.php', 'settings/about.php'); // Optional application files extra('class.hooks.php', 'settings/class.hooks.php'); extra('configuration.php', 'settings/configuration.php'); extra('bootstrap.php', 'settings/bootstrap.php'); extra('structure.php', 'settings/structure.php'); break; case 'Plugin': this.template( 'class.plugin.php', 'class.' + this.directory.toLowerCase() + '.plugin.php' ); break; case 'Theme': this.copy('default.master.tpl', 'views/default.master.tpl'); this.template('about.php'); // Optional theme files extra('class.themehooks.php'); break; } this.config.save(); } }); module.exports = AppGenerator;
/* --- Day 15: Science for Hungry People --- Today, you set out on the task of perfecting your milk-dunking cookie recipe. All you have to do is find the right balance of ingredients. Your recipe leaves room for exactly 100 teaspoons of ingredients. You make a list of the remaining ingredients you could use to finish the recipe (your puzzle input) and their properties per teaspoon: capacity (how well it helps the cookie absorb milk) durability (how well it keeps the cookie intact when full of milk) flavor (how tasty it makes the cookie) texture (how it improves the feel of the cookie) calories (how many calories it adds to the cookie) You can only measure ingredients in whole-teaspoon amounts accurately, and you have to be accurate so you can reproduce your results in the future. The total score of a cookie can be found by adding up each of the properties (negative totals become 0) and then multiplying together everything except calories. For instance, suppose you have these two ingredients: Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8 Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3 Then, choosing to use 44 teaspoons of butterscotch and 56 teaspoons of cinnamon (because the amounts of each ingredient must add up to 100) would result in a cookie with the following properties: - A capacity of 44*-1 + 56*2 = 68 - A durability of 44*-2 + 56*3 = 80 - A flavor of 44*6 + 56*-2 = 152 - A texture of 44*3 + 56*-1 = 76 Multiplying these together (68 * 80 * 152 * 76, ignoring calories for now) results in a total score of 62842880, which happens to be the best score possible given these ingredients. If any properties had produced a negative total, it would have instead become zero, causing the whole score to multiply to zero. Given the ingredients in your kitchen and their properties, what is the total score of the highest-scoring cookie you can make? */ const AMOUNT = 100; export default function solution(input) { const ingredients = input.trim() .split('\n') .map(line => line.split(':').map(i => i.trim())) .map(([title, params]) => { return params.split(',') .map(i => i.trim().split(' ')) .reduce((a, i) => { a[i[0]] = parseInt(i[1]); return a; }, {}); }); function score(ingredients, amounts) { const all = ingredients .reduce((a, item, i) => { Object.keys(item).forEach(key => { a[key] = a[key] || 0; a[key] += item[key] * amounts[i]; }); return a; }, {}); return Object.keys(all) .reduce((a, key) => { if (key === 'calories') { return a; } return a * Math.max(0, all[key]); }, 1); } const amounts = []; for (let i = 0; i < ingredients.length; i++) { amounts.push(0); } let answer = 0; function calc(id = 0, amount = AMOUNT) { if (amount === 0) { answer = Math.max(answer, score(ingredients, amounts)); } else if (id < ingredients.length) { for (let i = 0; i <= amount; i++) { amounts[id] = i; calc(id + 1, amount - i); } } return answer; } return calc(); };
import run from './run'; /** * Compiles the project from source files into a distributable * format and copies it to the output (build) folder. */ async function build() { await run(require('./clean')); await run(require('./copy')); await run(require('./bundle')); } export default build;
const assert = require('assert'); const { execSync } = require('child_process'); const fs = require('fs'); const specMarkdown = require('../'); const shouldRecord = Boolean(process.env.RECORD); function testSource(dir, input, options) { return [input || `test/${dir}/input.md`, `test/${dir}/ast.json`, `test/${dir}/output.html`, options]; } runTests([ testSource('duplicated-notes'), testSource('escape-sequence'), testSource('graphql-spec', 'test/graphql-spec/GraphQL.md'), testSource('productions'), testSource('readme', 'README.md'), testSource('readme-gh', 'README.md', '--githubSource https://github.com/leebyron/spec-md/blame/main'), testSource('sections'), testSource('simple-header'), testSource('links'), testSource('headers'), testSource('smart-quotes'), testSource('tables'), testSource('task-lists'), testSource('definitions'), ]); function runTests(tests) { for (const [input, ast, html, options] of tests) { try { runTest(input, ast, html, options); } catch (error) { process.exitCode = 1 if (error.code === 'ERR_ASSERTION') { process.stderr.write('\n' + error.message + '\n\n'); if (!error.expected) { process.stderr.write('\nNo recorded output found to compare to.\n\n'); } else { const jestDiff = require('jest-diff').default; process.stderr.write( jestDiff(error.expected, error.actual, { expand: false }) + '\n\n' ); } } else { process.stderr.write( '\n\n' + String(error.location ? error.message : (error.stack || error)) + '\n\n' ); } } } } function runTest(input, ast, html, options) { const start = Date.now(); process.stdout.write(`testing: ${input} ... `); const actualAST = specMarkdown.parse(input) let expectedAST try { expectedAST = JSON.parse(fs.readFileSync(ast, 'utf8')); } catch (_) { // Ignore FS or parse error } try { assert.deepEqual( actualAST, expectedAST, 'Did not parse expected AST.\n\n' + 'If confident the changes are correct, rerun with RECORD set:\n' + ' $ RECORD=1 yarn test' ); } catch (error) { if (error.code === 'ERR_ASSERTION' && shouldRecord) { fs.writeFileSync(ast, JSON.stringify(actualAST, null, 2)); } else { throw error; } } // Test printing via command line, since that's how most use spec-md. const actualHTML = execSync(`node ./bin/spec-md ${input} ${options || ''}`, { encoding: 'utf8' }); let expectedHTML try { // Normalize line endings expectedHTML = fs.readFileSync(html, 'utf8').replace(/\r\n|\n|\r/g, '\n'); } catch (_) { // Ignore FS error } try { assert.strictEqual( actualHTML, expectedHTML, 'Did not print expected HTML.\n\n' + 'If confident the changes are correct, rerun with RECORD set:\n' + ' $ RECORD=1 npm test' ); } catch (error) { if (error.code === 'ERR_ASSERTION' && shouldRecord) { fs.writeFileSync(html, actualHTML); } else { throw error; } } process.stdout.write(`DONE (${Date.now() - start}ms) \n`); }
import { Mongo } from 'meteor/mongo' import { SimpleSchema } from 'meteor/aldeed:simple-schema' const Articles = new Mongo.Collection('articles') export const UPVOTE = 1 export const DOWNVOTE = -1 export const ELASTIC_SEARCH_INDEX = 'articles' export const ELASTIC_SEARCH_TYPE = 'publications' export const ArticleReportSchema = new SimpleSchema({ message: { type: String, }, authorId: { type: SimpleSchema.RegEx.Id, }, authorName: { type: String, }, createdAt: { type: Date, }, }) export const ArticleVoteSchema = new SimpleSchema({ vote: { type: Number, allowedValues: [DOWNVOTE, UPVOTE], }, voterId: { type: SimpleSchema.RegEx.Id, }, voterName: { type: String, }, createdAt: { type: Date, }, }) export const ArticleSummarySchema = new SimpleSchema({ authorId: { type: String, }, authorName: { type: String, }, content: { type: String, }, createdAt: { type: Date, }, updatedAt: { type: Date, }, upVotes: { type: Number, }, downVotes: { type: Number, }, voters: { type: [ArticleVoteSchema], optional: true, }, status: { type: String, allowedValues: ['enabled', 'disabled'], }, }) export const ArticleKnowledgeBitSchema = new SimpleSchema({ type: { type: String, allowedValues: ['pdf', 'github'], }, link: { type: SimpleSchema.RegEx.Url, }, label: { type: String, }, addedById: { type: SimpleSchema.RegEx.Email, }, addedByName: { type: String, }, status: { type: String, allowedValues: ['enabled', 'disabled'], }, createdAt: { type: Date, }, updatedAt: { type: Date, }, upVotes: { type: Number, optional: true, }, downVotes: { type: Number, optional: true, }, voters: { type: [ArticleVoteSchema], optional: true, }, }) export const ArticleRelatedArticleSchema = new SimpleSchema({ DOI: { type: String, }, title: { type: String, }, createdAt: { type: Date, }, addedById: { type: SimpleSchema.RegEx.Id, }, addedByName: { type: String, }, authors: { type: [String], }, abstract: { type: String, }, }) const schema = new SimpleSchema({ createdAt: { type: Date, optional: true, autoValue() { if (this.isInsert) { return new Date() } else if (this.isUpsert) { return { $setOnInsert: new Date() } } else { this.unset() } }, }, updatedAt: { type: Date, optional: true, autoValue() { if (this.isUpdate) { return new Date() } }, denyInsert: true, }, title: { label: 'Article name', type: String, }, authors: { type: [String], }, DOI: { type: String, unique: true, }, abstract: { type: String, }, summaries: { type: [ArticleSummarySchema], optional: true, }, informations: { type: [ArticleKnowledgeBitSchema], optional: true, }, relatedArticles: { type: [ArticleRelatedArticleSchema], optional: true, }, slug: { type: String, optional: true, }, inappropriatedContentReports: { type: [ArticleReportSchema], optional: true, }, }) Articles.attachSchema(schema) Articles.friendlySlugs('title') export default Articles
angular.module('devlogin', [ 'devlogin.index', 'devlogin.forgot', 'devlogin.reset' ]);
'use strict'; const assert = require('assert'); const Browscap = require('../src/index.js'); suite('checking for issue 1725. (29 tests)', function () { test('issue-1725-00000 ["Mozilla/5.0 (iPhone; CPU iPhone OS 10_0 like Mac OS X) AppleWebKit/602.1.43 (KHTML, like Gecko) AppleNews/607 Version/2.0"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 10_0 like Mac OS X) AppleWebKit/602.1.43 (KHTML, like Gecko) AppleNews/607 Version/2.0'); assert.strictEqual(browser['Comment'], 'Apple News 10.0 for iOS', 'Expected actual "Comment" to be \'Apple News 10.0 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '10.0', 'Expected actual "Version" to be \'10.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '10.0', 'Expected actual "Platform_Version" to be \'10.0\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00001 ["AppleNewsBot"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('AppleNewsBot'); assert.strictEqual(browser['Comment'], 'AppleNewsBot', 'Expected actual "Comment" to be \'AppleNewsBot\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'AppleNewsBot', 'Expected actual "Browser" to be \'AppleNewsBot\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Bot/Crawler', 'Expected actual "Browser_Type" to be \'Bot/Crawler\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '0', 'Expected actual "Browser_Bits" to be \'0\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '0.0', 'Expected actual "Version" to be \'0.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'unknown', 'Expected actual "Platform" to be \'unknown\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], 'unknown', 'Expected actual "Platform_Version" to be \'unknown\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'unknown', 'Expected actual "Platform_Description" to be \'unknown\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '0', 'Expected actual "Platform_Bits" to be \'0\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'unknown', 'Expected actual "Platform_Maker" to be \'unknown\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], false, 'Expected actual "Frames" to be false (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], false, 'Expected actual "IFrames" to be false (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], false, 'Expected actual "Tables" to be false (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], false, 'Expected actual "Cookies" to be false (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], false, 'Expected actual "JavaScript" to be false (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], false, 'Expected actual "JavaApplets" to be false (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '0', 'Expected actual "CssVersion" to be \'0\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'unknown', 'Expected actual "Device_Name" to be \'unknown\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'unknown', 'Expected actual "Device_Maker" to be \'unknown\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'unknown', 'Expected actual "Device_Type" to be \'unknown\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'unknown', 'Expected actual "Device_Pointing_Method" to be \'unknown\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'unknown', 'Expected actual "Device_Code_Name" to be \'unknown\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'unknown', 'Expected actual "Device_Brand_Name" to be \'unknown\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'unknown', 'Expected actual "RenderingEngine_Name" to be \'unknown\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'unknown', 'Expected actual "RenderingEngine_Maker" to be \'unknown\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00002 ["Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) AppleNews/750 Version/2.2"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) AppleNews/750 Version/2.2'); assert.strictEqual(browser['Comment'], 'Apple News 10.2 for iOS', 'Expected actual "Comment" to be \'Apple News 10.2 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '10.2', 'Expected actual "Version" to be \'10.2\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '10.2', 'Expected actual "Platform_Version" to be \'10.2\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00003 ["Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) AppleNews/996 Version/2.3"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) AppleNews/996 Version/2.3'); assert.strictEqual(browser['Comment'], 'Apple News 10.3 for iOS', 'Expected actual "Comment" to be \'Apple News 10.3 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '10.3', 'Expected actual "Version" to be \'10.3\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '10.3', 'Expected actual "Platform_Version" to be \'10.3\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00004 ["Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) AppleNews/1000 Version/2.3.1"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) AppleNews/1000 Version/2.3.1'); assert.strictEqual(browser['Comment'], 'Apple News 10.3 for iOS', 'Expected actual "Comment" to be \'Apple News 10.3 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '10.3', 'Expected actual "Version" to be \'10.3\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '10.3', 'Expected actual "Platform_Version" to be \'10.3\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00005 ["Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) AppleNews/1000 Version/2.3.1"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) AppleNews/1000 Version/2.3.1'); assert.strictEqual(browser['Comment'], 'Apple News 10.3 for iOS', 'Expected actual "Comment" to be \'Apple News 10.3 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '10.3', 'Expected actual "Version" to be \'10.3\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '10.3', 'Expected actual "Platform_Version" to be \'10.3\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00006 ["Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) AppleNews/1271 Version/3.1"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) AppleNews/1271 Version/3.1'); assert.strictEqual(browser['Comment'], 'Apple News 11.1 for iOS', 'Expected actual "Comment" to be \'Apple News 11.1 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.1', 'Expected actual "Version" to be \'11.1\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.1', 'Expected actual "Platform_Version" to be \'11.1\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00007 ["Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) AppleNews/608.0.1 Version/2.0.1"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) AppleNews/608.0.1 Version/2.0.1'); assert.strictEqual(browser['Comment'], 'Apple News 10.0 for iOS', 'Expected actual "Comment" to be \'Apple News 10.0 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '10.0', 'Expected actual "Version" to be \'10.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '10.0', 'Expected actual "Platform_Version" to be \'10.0\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00008 ["Mozilla/5.0 (iPod touch; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) AppleNews/996 Version/2.3"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPod touch; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) AppleNews/996 Version/2.3'); assert.strictEqual(browser['Comment'], 'Apple News 10.3 for iOS', 'Expected actual "Comment" to be \'Apple News 10.3 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '10.3', 'Expected actual "Version" to be \'10.3\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '10.3', 'Expected actual "Platform_Version" to be \'10.3\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPod Touch', 'Expected actual "Device_Name" to be \'iPod Touch\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Device', 'Expected actual "Device_Type" to be \'Mobile Device\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPod Touch', 'Expected actual "Device_Code_Name" to be \'iPod Touch\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00009 ["Mozilla/5.0 (iPad; CPU OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) AppleNews/1000 Version/2.3.1"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPad; CPU OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) AppleNews/1000 Version/2.3.1'); assert.strictEqual(browser['Comment'], 'Apple News 10.3 for iOS', 'Expected actual "Comment" to be \'Apple News 10.3 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '10.3', 'Expected actual "Version" to be \'10.3\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '10.3', 'Expected actual "Platform_Version" to be \'10.3\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPad', 'Expected actual "Device_Name" to be \'iPad\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Tablet', 'Expected actual "Device_Type" to be \'Tablet\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPad', 'Expected actual "Device_Code_Name" to be \'iPad\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00010 ["Mozilla/5.0 (iPad; CPU OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) AppleNews/1000 Version/2.3.1"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPad; CPU OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) AppleNews/1000 Version/2.3.1'); assert.strictEqual(browser['Comment'], 'Apple News 10.3 for iOS', 'Expected actual "Comment" to be \'Apple News 10.3 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '10.3', 'Expected actual "Version" to be \'10.3\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '10.3', 'Expected actual "Platform_Version" to be \'10.3\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPad', 'Expected actual "Device_Name" to be \'iPad\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Tablet', 'Expected actual "Device_Type" to be \'Tablet\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPad', 'Expected actual "Device_Code_Name" to be \'iPad\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00011 ["Mozilla/5.0 (iPhone; CPU iPhone OS 11_0_3 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) AppleNews/1239.13 Version/3.0"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 11_0_3 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) AppleNews/1239.13 Version/3.0'); assert.strictEqual(browser['Comment'], 'Apple News 11.0 for iOS', 'Expected actual "Comment" to be \'Apple News 11.0 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.0', 'Expected actual "Version" to be \'11.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.0', 'Expected actual "Platform_Version" to be \'11.0\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00012 ["Mozilla/5.0 (iPad; CPU OS 11_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) AppleNews/1345 Version/3.2"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPad; CPU OS 11_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) AppleNews/1345 Version/3.2'); assert.strictEqual(browser['Comment'], 'Apple News 11.2 for iOS', 'Expected actual "Comment" to be \'Apple News 11.2 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.2', 'Expected actual "Version" to be \'11.2\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.2', 'Expected actual "Platform_Version" to be \'11.2\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPad', 'Expected actual "Device_Name" to be \'iPad\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Tablet', 'Expected actual "Device_Type" to be \'Tablet\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPad', 'Expected actual "Device_Code_Name" to be \'iPad\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00013 ["Mozilla/5.0 (iPad; CPU OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) AppleNews/1271 Version/3.1"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPad; CPU OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) AppleNews/1271 Version/3.1'); assert.strictEqual(browser['Comment'], 'Apple News 11.1 for iOS', 'Expected actual "Comment" to be \'Apple News 11.1 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.1', 'Expected actual "Version" to be \'11.1\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.1', 'Expected actual "Platform_Version" to be \'11.1\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPad', 'Expected actual "Device_Name" to be \'iPad\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Tablet', 'Expected actual "Device_Type" to be \'Tablet\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPad', 'Expected actual "Device_Code_Name" to be \'iPad\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00014 ["Mozilla/5.0 (iPad; CPU OS 11_0_3 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) AppleNews/1239.13 Version/3.0"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPad; CPU OS 11_0_3 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) AppleNews/1239.13 Version/3.0'); assert.strictEqual(browser['Comment'], 'Apple News 11.0 for iOS', 'Expected actual "Comment" to be \'Apple News 11.0 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.0', 'Expected actual "Version" to be \'11.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.0', 'Expected actual "Platform_Version" to be \'11.0\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPad', 'Expected actual "Device_Name" to be \'iPad\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Tablet', 'Expected actual "Device_Type" to be \'Tablet\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPad', 'Expected actual "Device_Code_Name" to be \'iPad\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00015 ["Mozilla/5.0 (iPad; CPU OS 10_2 like Mac OS X) AppleWebKit/602.3.12 (KHTML, like Gecko) AppleNews/750 Version/2.2"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPad; CPU OS 10_2 like Mac OS X) AppleWebKit/602.3.12 (KHTML, like Gecko) AppleNews/750 Version/2.2'); assert.strictEqual(browser['Comment'], 'Apple News 10.2 for iOS', 'Expected actual "Comment" to be \'Apple News 10.2 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '10.2', 'Expected actual "Version" to be \'10.2\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '10.2', 'Expected actual "Platform_Version" to be \'10.2\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPad', 'Expected actual "Device_Name" to be \'iPad\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Tablet', 'Expected actual "Device_Type" to be \'Tablet\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPad', 'Expected actual "Device_Code_Name" to be \'iPad\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00016 ["Mozilla/5.0 (iPod touch; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) AppleNews/1000 Version/2.3.1"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPod touch; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) AppleNews/1000 Version/2.3.1'); assert.strictEqual(browser['Comment'], 'Apple News 10.3 for iOS', 'Expected actual "Comment" to be \'Apple News 10.3 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '10.3', 'Expected actual "Version" to be \'10.3\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '10.3', 'Expected actual "Platform_Version" to be \'10.3\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPod Touch', 'Expected actual "Device_Name" to be \'iPod Touch\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Device', 'Expected actual "Device_Type" to be \'Mobile Device\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPod Touch', 'Expected actual "Device_Code_Name" to be \'iPod Touch\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00017 ["Mozilla/5.0 (iPod touch; CPU iPhone OS 11_2_2 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) AppleNews/1345 Version/3.2"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPod touch; CPU iPhone OS 11_2_2 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) AppleNews/1345 Version/3.2'); assert.strictEqual(browser['Comment'], 'Apple News 11.2 for iOS', 'Expected actual "Comment" to be \'Apple News 11.2 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.2', 'Expected actual "Version" to be \'11.2\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.2', 'Expected actual "Platform_Version" to be \'11.2\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPod Touch', 'Expected actual "Device_Name" to be \'iPod Touch\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Device', 'Expected actual "Device_Type" to be \'Mobile Device\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPod Touch', 'Expected actual "Device_Code_Name" to be \'iPod Touch\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00018 ["Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.3 (KHTML, like Gecko) AppleNews/750 Version/2.2"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.3 (KHTML, like Gecko) AppleNews/750 Version/2.2'); assert.strictEqual(browser['Comment'], 'Apple News 10.2 for iOS', 'Expected actual "Comment" to be \'Apple News 10.2 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '10.2', 'Expected actual "Version" to be \'10.2\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '10.2', 'Expected actual "Platform_Version" to be \'10.2\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00019 ["Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_2 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) AppleNews/1345 Version/3.2"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_2 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) AppleNews/1345 Version/3.2'); assert.strictEqual(browser['Comment'], 'Apple News 11.2 for iOS', 'Expected actual "Comment" to be \'Apple News 11.2 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.2', 'Expected actual "Version" to be \'11.2\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.2', 'Expected actual "Platform_Version" to be \'11.2\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00020 ["Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) AppleNews/996 Version/2.3"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) AppleNews/996 Version/2.3'); assert.strictEqual(browser['Comment'], 'Apple News 10.3 for iOS', 'Expected actual "Comment" to be \'Apple News 10.3 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '10.3', 'Expected actual "Version" to be \'10.3\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '10.3', 'Expected actual "Platform_Version" to be \'10.3\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPad', 'Expected actual "Device_Name" to be \'iPad\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Tablet', 'Expected actual "Device_Type" to be \'Tablet\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPad', 'Expected actual "Device_Code_Name" to be \'iPad\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00021 ["Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_5 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) AppleNews/1345 Version/3.2"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_5 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) AppleNews/1345 Version/3.2'); assert.strictEqual(browser['Comment'], 'Apple News 11.2 for iOS', 'Expected actual "Comment" to be \'Apple News 11.2 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.2', 'Expected actual "Version" to be \'11.2\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.2', 'Expected actual "Platform_Version" to be \'11.2\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00022 ["Mozilla/5.0 (iPhone; CPU iPhone OS 11_2 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) AppleNews/1345 Version/3.2"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 11_2 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) AppleNews/1345 Version/3.2'); assert.strictEqual(browser['Comment'], 'Apple News 11.2 for iOS', 'Expected actual "Comment" to be \'Apple News 11.2 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.2', 'Expected actual "Version" to be \'11.2\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.2', 'Expected actual "Platform_Version" to be \'11.2\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00023 ["Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) AppleNews/1239.13 Version/3.0"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) AppleNews/1239.13 Version/3.0'); assert.strictEqual(browser['Comment'], 'Apple News 11.0 for iOS', 'Expected actual "Comment" to be \'Apple News 11.0 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.0', 'Expected actual "Version" to be \'11.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.0', 'Expected actual "Platform_Version" to be \'11.0\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00024 ["Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) AppleNews/1345 Version/3.2"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) AppleNews/1345 Version/3.2'); assert.strictEqual(browser['Comment'], 'Apple News 11.2 for iOS', 'Expected actual "Comment" to be \'Apple News 11.2 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.2', 'Expected actual "Version" to be \'11.2\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.2', 'Expected actual "Platform_Version" to be \'11.2\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00025 ["Mozilla/5.0 (iPhone; CPU iPhone OS 11_0_1 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) AppleNews/1239.13 Version/3.0"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 11_0_1 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) AppleNews/1239.13 Version/3.0'); assert.strictEqual(browser['Comment'], 'Apple News 11.0 for iOS', 'Expected actual "Comment" to be \'Apple News 11.0 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.0', 'Expected actual "Version" to be \'11.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.0', 'Expected actual "Platform_Version" to be \'11.0\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00026 ["Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) AppleNews/1239.6 Version/3.0"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) AppleNews/1239.6 Version/3.0'); assert.strictEqual(browser['Comment'], 'Apple News 11.0 for iOS', 'Expected actual "Comment" to be \'Apple News 11.0 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.0', 'Expected actual "Version" to be \'11.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.0', 'Expected actual "Platform_Version" to be \'11.0\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPhone', 'Expected actual "Device_Name" to be \'iPhone\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Mobile Phone', 'Expected actual "Device_Type" to be \'Mobile Phone\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPhone', 'Expected actual "Device_Code_Name" to be \'iPhone\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00027 ["Mozilla/5.0 (iPad; CPU OS 11_0_2 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) AppleNews/1239.13 Version/3.0"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPad; CPU OS 11_0_2 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) AppleNews/1239.13 Version/3.0'); assert.strictEqual(browser['Comment'], 'Apple News 11.0 for iOS', 'Expected actual "Comment" to be \'Apple News 11.0 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.0', 'Expected actual "Version" to be \'11.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.0', 'Expected actual "Platform_Version" to be \'11.0\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPad', 'Expected actual "Device_Name" to be \'iPad\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Tablet', 'Expected actual "Device_Type" to be \'Tablet\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPad', 'Expected actual "Device_Code_Name" to be \'iPad\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); test('issue-1725-00028 ["Mozilla/5.0 (iPad; CPU OS 11_0_1 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) AppleNews/1239.13 Version/3.0"]', function () { const browscap = new Browscap(); const browser = browscap.getBrowser('Mozilla/5.0 (iPad; CPU OS 11_0_1 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) AppleNews/1239.13 Version/3.0'); assert.strictEqual(browser['Comment'], 'Apple News 11.0 for iOS', 'Expected actual "Comment" to be \'Apple News 11.0 for iOS\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser'], 'Apple News', 'Expected actual "Browser" to be \'Apple News\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Type'], 'Application', 'Expected actual "Browser_Type" to be \'Application\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Maker'], 'Apple Inc', 'Expected actual "Browser_Maker" to be \'Apple Inc\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Version'], '11.0', 'Expected actual "Version" to be \'11.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform'], 'iOS', 'Expected actual "Platform" to be \'iOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Version'], '11.0', 'Expected actual "Platform_Version" to be \'11.0\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Description'], 'iPod, iPhone & iPad', 'Expected actual "Platform_Description" to be \'iPod, iPhone & iPad\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['CssVersion'], '3', 'Expected actual "CssVersion" to be \'3\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Name'], 'iPad', 'Expected actual "Device_Name" to be \'iPad\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Type'], 'Tablet', 'Expected actual "Device_Type" to be \'Tablet\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Pointing_Method'], 'touchscreen', 'Expected actual "Device_Pointing_Method" to be \'touchscreen\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Code_Name'], 'iPad', 'Expected actual "Device_Code_Name" to be \'iPad\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Name'], 'WebKit', 'Expected actual "RenderingEngine_Name" to be \'WebKit\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); assert.strictEqual(browser['RenderingEngine_Maker'], 'Apple Inc', 'Expected actual "RenderingEngine_Maker" to be \'Apple Inc\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')'); }); });
// @flow strict import { renderHook, act } from '@testing-library/react-hooks'; import * as PopperJs from '@popperjs/core'; // Public API import { usePopper } from '.'; const referenceElement = document.createElement('div'); const popperElement = document.createElement('div'); describe('userPopper', () => { afterEach(() => { jest.clearAllMocks(); }); it('initializes the Popper instance', async () => { const { result, wait } = renderHook(() => usePopper(referenceElement, popperElement) ); await wait(() => { expect(result.current.state).not.toBe(null); }); }); it("doesn't update Popper instance on props update if not needed by Popper", async () => { const spy = jest.spyOn(PopperJs, 'createPopper'); const { wait, rerender } = renderHook( ({ referenceElement, popperElement }) => usePopper(referenceElement, popperElement), { initialProps: { referenceElement, popperElement } } ); await act(async () => { await rerender({ referenceElement, popperElement }); }); await wait(() => { expect(spy).toHaveBeenCalledTimes(1); }); }); it('updates Popper on explicitly listed props change', async () => { const spy = jest.spyOn(PopperJs, 'createPopper'); const { waitForNextUpdate, rerender } = renderHook( ({ referenceElement, popperElement }) => usePopper(referenceElement, popperElement), { initialProps: { referenceElement, popperElement } } ); rerender({ referenceElement, popperElement: document.createElement('div'), }); await waitForNextUpdate(); expect(spy).toHaveBeenCalledTimes(2); }); it('does not update Popper on generic props change', async () => { const spy = jest.spyOn(PopperJs, 'createPopper'); const { waitForNextUpdate, rerender } = renderHook( ({ referenceElement, popperElement, options }) => usePopper(referenceElement, popperElement, options), { initialProps: { referenceElement, popperElement } } ); rerender({ referenceElement, popperElement, options: { foo: 'bar' }, }); await waitForNextUpdate(); expect(spy).not.toHaveBeenCalledTimes(2); }); it('destroys Popper on instance on unmount', async () => { const spy = jest.spyOn(PopperJs, 'createPopper'); const { waitForNextUpdate, unmount } = renderHook(() => usePopper(referenceElement, popperElement) ); await waitForNextUpdate(); const popperInstance = spy.mock.results[0].value; const destroy = jest.spyOn(popperInstance, 'destroy'); await unmount(); expect(destroy).toHaveBeenCalled(); }); it('Initializes the arrow positioning', async () => { const arrowElement = document.createElement('div'); const popperElementWithArrow = document.createElement('div'); popperElementWithArrow.appendChild(arrowElement); const { result, waitForNextUpdate } = renderHook(() => usePopper(referenceElement, popperElementWithArrow, { placement: 'bottom', modifiers: [{ name: 'arrow', options: { element: arrowElement } }], }) ); expect(result.current.styles.arrow.position).toBe('absolute'); expect(result.current.styles.arrow.transform).toBeUndefined(); await waitForNextUpdate(); expect(result.current.styles.arrow.transform).toBeDefined(); }); });