code stringlengths 2 1.05M | repo_name stringlengths 5 114 | path stringlengths 4 991 | language stringclasses 1 value | license stringclasses 15 values | size int32 2 1.05M |
|---|---|---|---|---|---|
var assert = require("assert")
var validate = require("../index")
var schema = validate({
foo: {
bar: String
, baz: [Number]
}
})
var correct = schema({ foo: { bar: "foo", baz: [1, 2, 3] } })
var wrong = schema({ foo: "baz" })
var wrong2 = schema({ foo: { bar: 42, baz: {} } })
assert.equal(null, correct)
assert.deepEqual([
"foo.value cannot be validated"
], wrong)
assert.deepEqual([
"foo.bar is not a string"
, "foo.baz is not an array"
], wrong2)
console.log("correct", correct, "wrong", wrong, "wrong2", wrong2)
| Colingo/valid-schema | examples/nested-objects.js | JavaScript | mit | 556 |
var express = require('express');
var path = require('path');
var logger = require('morgan');
var bodyParser = require('body-parser');
var index = require('./routes/index');
//var fs = require('fs');
//var rfs = require('rotating-file-stream');
var app = express();
// view engine setup
var hbs = require('hbs');
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'hbs');
hbs.registerHelper('ifSame', function(value1, value2, options) {
if(value1 === value2) {
return options.fn(this);
} else {
return options.inverse(this);
}
});
hbs.registerHelper('ifAny', function() {
var value1 = arguments[0];
var options = arguments[arguments.length - 1];
for (var i = 1; i < arguments.length - 1; i++) {
if(value1 === arguments[i]) {
return options.fn(this);
}
}
});
/* Uncomment to enable request-logging
var logDirectory = path.join(__dirname, 'log');
// ensure log directory exists
fs.existsSync(logDirectory) || fs.mkdirSync(logDirectory);
// create a rotating write stream
var accessLogStream = rfs('access.log', {
interval: '1d',
path: logDirectory
});
// setup the logger
app.use(logger('combined', {stream: accessLogStream}));
*/
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', index);
// catch 404
app.use(function(req, res) {
res.status(404).send('Not found');
});
//Print the uncaught exception into the standard error output (stderr.txt) and terminate
process.on('uncaughtException', function (err) {
console.error((new Date).toUTCString() + ' uncaughtException:', err.message);
console.error(err.stack);
process.exit(1);
});
module.exports = app; | dwin94/tagging-server | app.js | JavaScript | mit | 1,758 |
const Feedback = require('../../../model/feedback');
let createFeedback = async function (feedback) {
const newFeedback = new Feedback({
question: feedback.question,
userResponse: feedback.userResponse,
userId: feedback.userId,
userAgent: feedback.userAgent
});
const createdFeedback = await newFeedback.save();
return createdFeedback;
}
module.exports = {
createFeedback: createFeedback
}
| Codingpedia/bookmarks-api | backend/src/routes/public/feedback/feedback-service.js | JavaScript | mit | 421 |
/*
* Copyright (c) 2012-2016 André Bargull
* Alle Rechte vorbehalten / All Rights Reserved. Use is subject to license terms.
*
* <https://github.com/anba/es6draft>
*/
const {
assertSyntaxError
} = Assert;
// ClassDeclaration and ClassExpression is always strict code
// - test strictness in BindingIdentifier of ClassDeclaration/ClassExpression
// 11.6.2.2 Future Reserved Words (Strict Mode)
const FutureReservedWordsStrict =
`
implements let private public
interface package protected static
`.trim().split(/\s+/);
const RestrictedBindingIdentifierStrict =
`
arguments
eval
yield
`.trim().split(/\s+/);
// ClassDeclaration
for (let w of [...FutureReservedWordsStrict, ...RestrictedBindingIdentifierStrict]) {
assertSyntaxError(`class ${w} {}`);
}
// ClassExpression
for (let w of [...FutureReservedWordsStrict, ...RestrictedBindingIdentifierStrict]) {
assertSyntaxError(`(class ${w} {})`);
}
| jugglinmike/es6draft | src/test/scripts/suite/syntax/classes/ident_strictness.js | JavaScript | mit | 925 |
describe('flatten', function () {
it('should throw an error when the first argument is not an array', function () {
expect(function () {
flatten({ length: 100 });
}).toThrow();
});
it('should flatten an array with two levels of nesting', function () {
var arr = [1,2,[3,4], 5, [6,7]];
var expected = [1,2,3,4,5,6,7];
var actual = flatten(arr);
expect(actual).toEqual(expected);
});
it('should flatten an array with three levels of nesting', function () {
var arr = [1,[[2]],['3','4'], 5, [6,[7,8,9]]];
var expected = [1,2,'3','4',5,6,7,8,9];
var actual = flatten(arr);
expect(actual).toEqual(expected);
});
it('should flatten an array with four levels of nesting', function () {
var arr = [1,[[[2]]],[3,'4'], 5, [6,[[7],8,['9']]]];
var expected = [1,2,3,'4',5,6,7,8,'9'];
var actual = flatten(arr);
expect(actual).toEqual(expected);
});
it('should not modify the passed in array', function () {
var arr = [1,[[['2']]],[3,4], 5, [6,[['7'],8,[9]]]];
var expected = arr.slice();
flatten(arr);
expect(arr).toEqual(expected);
});
});
| slbedu/front-end-web-2015 | exercises/03-javascript/spec/flattenSpec.js | JavaScript | mit | 1,090 |
import valueParser from 'postcss-value-parser';
import { getMatch as getMatchFactory } from 'cssnano-utils';
const getValue = (node) => parseFloat(node.value);
function reduce(node) {
if (node.type !== 'function') {
return false;
}
if (!node.value) {
return;
}
const lowerCasedValue = node.value.toLowerCase();
if (lowerCasedValue === 'steps') {
// Don't bother checking the step-end case as it has the same length
// as steps(1)
if (
node.nodes[0].type === 'word' &&
getValue(node.nodes[0]) === 1 &&
node.nodes[2] &&
node.nodes[2].type === 'word' &&
(node.nodes[2].value.toLowerCase() === 'start' ||
node.nodes[2].value.toLowerCase() === 'jump-start')
) {
node.type = 'word';
node.value = 'step-start';
delete node.nodes;
return;
}
if (
node.nodes[0].type === 'word' &&
getValue(node.nodes[0]) === 1 &&
node.nodes[2] &&
node.nodes[2].type === 'word' &&
(node.nodes[2].value.toLowerCase() === 'end' ||
node.nodes[2].value.toLowerCase() === 'jump-end')
) {
node.type = 'word';
node.value = 'step-end';
delete node.nodes;
return;
}
// The end case is actually the browser default, so it isn't required.
if (
node.nodes[2] &&
node.nodes[2].type === 'word' &&
(node.nodes[2].value.toLowerCase() === 'end' ||
node.nodes[2].value.toLowerCase() === 'jump-end')
) {
node.nodes = [node.nodes[0]];
return;
}
return false;
}
if (lowerCasedValue === 'cubic-bezier') {
const values = node.nodes
.filter((list, index) => {
return index % 2 === 0;
})
.map(getValue);
if (values.length !== 4) {
return;
}
const match = getMatchFactory([
['ease', [0.25, 0.1, 0.25, 1]],
['linear', [0, 0, 1, 1]],
['ease-in', [0.42, 0, 1, 1]],
['ease-out', [0, 0, 0.58, 1]],
['ease-in-out', [0.42, 0, 0.58, 1]],
])(values);
if (match) {
node.type = 'word';
node.value = match;
delete node.nodes;
return;
}
}
}
function transform(value) {
return valueParser(value).walk(reduce).toString();
}
function pluginCreator() {
return {
postcssPlugin: 'postcss-normalize-timing-functions',
OnceExit(css) {
const cache = {};
css.walkDecls(
/^(-\w+-)?(animation|transition)(-timing-function)?$/i,
(decl) => {
const value = decl.value;
if (cache[value]) {
decl.value = cache[value];
return;
}
const result = transform(value);
decl.value = result;
cache[value] = result;
}
);
},
};
}
pluginCreator.postcss = true;
export default pluginCreator;
| ben-eb/cssnano | packages/postcss-normalize-timing-functions/src/index.js | JavaScript | mit | 2,821 |
/*globals self, postMessage */
self.on('click', function (node, data) {'use strict';
postMessage({name: data});
});
| brettz9/atyourcommand | data/dynamicContextMenu.js | JavaScript | mit | 117 |
var AWS = require("aws-sdk");
var TABLE_NAME_REGISTRY = "Computournament-Registry";
var TABLE_NAME_LEADERSHIPBOARD = "Computournament-LeadershipBoard";
var ddb = new AWS.DynamoDB();
exports.handler = function(event, context) {
var timestamp = Math.round((new Date()).getTime() / 1000);
checkPendingChallenge(context, function(item) {
item.Status.S = (event.solution == eval(item.Challenge.S)) ? "solved" : "failed";
item.Enddtime = { N: timestamp.toString() };
var params = {
Item: item,
TableName : TABLE_NAME_REGISTRY
};
ddb.putItem(params, function(err, data) {
if (err) {
context.fail(err);
}
var timeToSolve = timestamp - item.Starttime.N;
var points = (item.Status.S === "solved") ? (20 - timeToSolve).toString() : (-10).toString();
var params2 = {
TableName: TABLE_NAME_LEADERSHIPBOARD,
Key: {
CognitoId: {
S: context.identity.cognitoIdentityId
}
},
UpdateExpression: 'SET Score = Score + :p, Nickname = :n',
ExpressionAttributeValues: {
':p': { N: points },
':n': { S: event.nickname }
}
};
ddb.updateItem(params2, function(err, data) {
if (err) {
context.fail(err);
}
context.succeed( { timeToSolve: timeToSolve, result: item.Status.S, points: points } );
});
});
});
};
function checkPendingChallenge(context, cb) {
var params = {
"TableName": TABLE_NAME_REGISTRY,
"KeyConditionExpression": "CognitoId = :id",
"ExpressionAttributeValues": {
":id": {"S": context.identity.cognitoIdentityId }
},
"Limit": 1,
"ScanIndexForward": false,
"ConsistentRead": true
};
ddb.query(params, function(err, data) {
if (err) {
context.fail(err);
}
if (data.Items[0] !== undefined && data.Items[0].Status.S == "pending") {
cb(data.Items[0]);
}
else {
context.fail("No pending challenge available!");
}
});
}
| arafato/computournament | lambda/submitChallenge.js | JavaScript | mit | 1,928 |
import * as THREE from 'three';
import { world, scene, playerInstances, restartWorld, listener } from './game/main';
import { sprite } from './game/Player';
import store from './redux/store';
import { updatePlayerLocations, removePlayer } from './redux/players/action-creator';
import { setName, setScore } from './redux/ownInfo/action-creator';
import { announce, removeAnnouncement } from './redux/announcer/action-creator';
import { updateBombLocations } from './redux/bombs/action-creator';
import { receiveMessage } from './redux/chat/action-creator';
import { loadMap } from './redux/maps/action-creator';
import { setTime } from './redux/timer/action-creator';
import { setWinner } from './redux/winner/action-creator';
import { revivePlayer } from './redux/dead/action-creator';
const socket = io('/');
export let playerArr = [];
let count = 0;
/*----- MAKE CONNECTION TO THE SERVER -----*/
socket.on('connect', () => {
socket.on('initial', (initialData) => {
store.dispatch(updatePlayerLocations(initialData.players));
store.dispatch(updateBombLocations(initialData.bombs));
store.dispatch(loadMap(initialData.map));
store.dispatch(setTime(initialData.timer));
});
/*----- UPDATES WORLD 60 TIMES/SEC -----*/
socket.on('update_world', (data) => {
count += 1;
playerArr = Object.keys(data.players);
if (data.players[socket.id]) {
store.dispatch(setScore(data.players[socket.id].score));
store.dispatch(setName(data.players[socket.id].nickname));
}
delete data.players[socket.id];
delete data.bombs[socket.id];
store.dispatch(updatePlayerLocations(data.players));
store.dispatch(updateBombLocations(data.bombs));
if (count % 30 === 0) {
store.dispatch(setTime(data.timer));
count = 0;
}
});
/*----- SETS WINNER -----*/
socket.on('set_winner', (winner) => {
store.dispatch(setWinner(winner));
});
/*----- TRACKING POSITIONS OF THE BOMBS -----*/
socket.on('update_bomb_positions', (data) => {
delete data[socket.id];
store.dispatch(updateBombLocations(data));
});
/*----- KILLING PLAYER, TRACKING WHO KILLED WHO -----*/
socket.on('kill_player', (data) => {
store.dispatch(announce(data.killerNickname, data.victimNickname));
setTimeout(() => {
store.dispatch(removeAnnouncement());
}, 3000);
const playerToKill = playerInstances.filter((player) => player.socketId === data.id)[0];
if (playerToKill) {
const state = store.getState();
const currentStateAnnouncement = state.announcement;
const sound = state.sound;
if (sound) {
const positionalAudio = new THREE.PositionalAudio(listener);
const audioLoader = new THREE.AudioLoader();
if (currentStateAnnouncement.killer.nickname === currentStateAnnouncement.victim.nickname) {
audioLoader.load('sounds/witch.mp3', (buffer) => {
positionalAudio.setBuffer(buffer);
positionalAudio.setRefDistance(10);
positionalAudio.play();
});
}
audioLoader.load('sounds/die.mp3', (buffer) => {
positionalAudio.setBuffer(buffer);
positionalAudio.setRefDistance(10);
positionalAudio.play();
});
}
playerToKill.explode();
}
});
/* RESTARTS WORLD WHEN TIMER HITS 0 OR WHEN ONE PLAYER LEFT */
socket.on('reset_world', (data) => {
setTimeout(() => {
store.dispatch(loadMap(data.map));
store.dispatch(updatePlayerLocations(data.players));
store.dispatch(updateBombLocations(data.bombs));
store.dispatch(revivePlayer());
store.dispatch(setTime(data.timer));
restartWorld();
store.dispatch(setWinner(null));
}, 5000);
});
/*----- REMOVES PLAYER'S PHISICAL BODY & VISUAL BODY -----*/
socket.on('remove_player', (id) => {
store.dispatch(removePlayer(id));
const playerBody = world.bodies.filter((child) => child.name === id)[0];
const playerMesh = scene.children.filter((child) => child.name === id)[0];
if (playerBody) { world.remove(playerBody); }
if (playerMesh) {
scene.remove(playerMesh);
scene.remove(sprite);
world.remove(sprite);
}
});
socket.on('new_message', (message) => {
store.dispatch(receiveMessage(message));
});
});
export default socket;
| Bombanauts/Bombanauts | browser/socket.js | JavaScript | mit | 4,328 |
/// <autosync enabled="true" />
/// <reference path="app.js" />
/// <reference path="get-access-token.js" />
/// <reference path="get-auth-token.js" />
/// <reference path="viewer-embed.js" />
| icpmtech/WebApi | LmvAppServer/LmvAppServer/scripts/_references.js | JavaScript | mit | 196 |
var Checker = require('../lib/checker');
var assert = require('assert');
describe('rules/require-space-after-keywords', function() {
var checker;
beforeEach(function() {
checker = new Checker();
checker.registerDefaultRules();
});
it('should report missing space after keyword', function() {
checker.configure({ requireSpaceAfterKeywords: ['if'] });
assert(checker.checkString('if(x) { x++; }').getErrorCount() === 1);
});
it('should not report space after keyword', function() {
checker.configure({ requireSpaceAfterKeywords: ['if'] });
assert(checker.checkString('if (x) { x++; }').isEmpty());
});
it('should not report semicolon after keyword', function() {
checker.configure({ requireSpaceAfterKeywords: ['return'] });
assert(checker.checkString('var x = function () { return; }').isEmpty());
});
it('should ignore reserved word if it\'s an object key (#83)', function() {
checker.configure({ requireSpaceAfterKeywords: ['for'] });
assert(checker.checkString('({for: "bar"})').isEmpty());
});
it('should ignore method name if it\'s a reserved word (#180)', function() {
checker.configure({ requireSpaceAfterKeywords: ['catch'] });
assert(checker.checkString('promise.catch()').isEmpty());
});
});
| christoffee/extreme-naughts-and-crosses | node_modules/pandatool/node_modules/jscs/test/test.require-space-after-keywords.js | JavaScript | mit | 1,350 |
import {ObserverLocator} from 'aurelia-binding';
import {ValidationGroup} from './validation-group';
import {inject} from 'aurelia-dependency-injection';
import {ValidationConfig} from './validation-config';
/**
* A lightweight validation plugin
* @class Validation
* @constructor
*/
@inject(ObserverLocator)
export class Validation {
/**
* Instantiates a new {Validation}
* @param observerLocator the observerLocator used to observer properties
* @param validationConfig the configuration
*/
constructor(observerLocator, validationConfig: ValidationConfig) {
this.observerLocator = observerLocator;
this.config = validationConfig ? validationConfig : Validation.defaults;
}
/**
* Returns a new validation group on the subject
* @param subject The subject to validate
* @returns {ValidationGroup} A ValidationGroup that encapsulates the validation rules and current validation state for this subject
*/
on(subject: any, configCallback? : (conf: ValidationConfig) => void): ValidationGroup {
let conf = new ValidationConfig(this.config);
if (configCallback !== null && configCallback !== undefined && typeof(configCallback) === 'function') {
configCallback(conf);
}
return new ValidationGroup(subject, this.observerLocator, conf);
}
onBreezeEntity(breezeEntity, configCallback? : (conf: ValidationConfig) => void): ValidationGroup {
let validation = this.on(breezeEntity, configCallback);
validation.onBreezeEntity();
return validation;
}
}
Validation.defaults = new ValidationConfig();
| milunka/validation | src/validation.js | JavaScript | mit | 1,574 |
import defaults from '../defaults/index.js';
const show = el => {
if (el.classList.contains(defaults.hideClassName)) {
el.classList.remove(defaults.hideClassName);
}
el.classList.add(defaults.showClassName);
};
export default show;
| fedordead/v | src/show/show.js | JavaScript | mit | 254 |
export { Circle } from "./Circle";
export { Svg } from "./Svg";
export { TextGroup } from "./TextGroup";
export { TextComponent } from "./TextComponent";
export { TextElement } from "./TextElement";
export { Underline } from "./Underline";
export { Divider } from "./Divider";
export { default as Path } from "./Path";
| slightly-askew/portfolio-2017 | src/elements/bubble/styled-components/index.js | JavaScript | mit | 319 |
import {MapActions as actions} from 'actions/MapActions';
import BasemapGalleryItem from 'map/BasemapGalleryItem';
import {basemaps, map as mapConfig} from 'js/config';
import constants from 'constants/MapConstants';
import MapStore from 'stores/MapStore';
import React from 'react';
const imagePrefix = 'css/images/';
const getBasemap = () => MapStore.get(constants.basemap) || mapConfig.basemap;
export class BasemapGallery extends React.Component {
constructor (props) {
super(props);
this.state = {
open: false,
selectedValue: getBasemap()
};
}
componentDidMount () {
MapStore.registerCallback(this.onStoreChange.bind(this));
// Add Touch Listeners for Leaflet
if (L.Browser.touch) {
let list = this.refs.list.getDOMNode();
list.addEventListener('touchstart', this.disableDragging);
list.addEventListener('touchend', this.enableDragging);
}
}
enableDragging () {
app.map.tap.enable();
app.map.dragging.enable();
}
disableDragging() {
app.map.tap.disable();
app.map.dragging.disable();
}
render () {
return (
<div className={'basemap-gallery leaflet-bar' + (this.state.open ? ' open' : '')}>
<div className='basemap-gallery-icon pointer' onClick={this.toggleGallery.bind(this)}>
<svg className='basemap-icon-svg' viewBox='0 0 96 96'>
<polygon className='basemap-icon-themed' points="87,61.516 48,81.016 9,61.516 0,66.016 48,90.016 96,66.016 "/>
<polygon points="87,44.531 48,64.031 9,44.531 0,49.031 48,73.031 96,49.031 "/>
<path className='basemap-icon-themed' d="M48,16.943L78.111,32L48,47.057L17.889,32L48,16.943 M48,8L0,32l48,24l48-24L48,8L48,8z"/>
</svg>
</div>
<ul ref='list' className='basemap-gallery-item-list'>
{this.renderBasemapItems(basemaps)}
</ul>
</div>
);
}
renderBasemapItems (basemaps) {
return basemaps.map(basemap => {
return (
<BasemapGalleryItem
key={basemap.value}
value={basemap.value}
label={basemap.label}
icon={imagePrefix + basemap.icon}
active={this.state.selectedValue === basemap.value}
click={this.onSelect}
/>
);
});
}
toggleGallery () {
this.setState({ open: !this.state.open });
}
onSelect (selectedProps) {
actions.setBasemap(selectedProps.value);
}
onStoreChange () {
let basemap = getBasemap();
this.setState({ selectedValue: basemap });
}
}
| Robert-W/esri-leaflet-webpack | src/js/map/BasemapGallery.js | JavaScript | mit | 2,538 |
'use strict';
var defined = require('../defined');
var express = require('express');
var router = express.Router();
var statsManager = require('../statsmanager');
router.get('/top', function(req, res, net) {
statsManager.getTopUserStats(function(status, response) {
res.status(status).json(response);
});
});
router.get('/users/:id(\\d+)', function(req, res, net) {
var userId = parseInt(req.params.id);
statsManager.getOneUserStats(userId, function(status, response) {
res.status(status).json(response);
});
});
module.exports = router; | tpetillon/roofmapper | server/routes/stats.js | JavaScript | mit | 579 |
var _ = require('underscore');
describe('limit', function() {
var testName = 'limit test';
var limit = 3;
var users = [];
_.each(_.range(10), function(i) {
users.push({
name: testName + '_user' + i,
type: testName
});
});
it ('prepares tests',function(cb) {
User.createEach(users, cb);
});
it('normal usage should not break', function(cb) {
User.findAll({
where: {
type: 'limit test'
},
limit: 10
}, cb);
});
it('dynamic finder usage should not break', function(cb) {
User.findAllByType('limit test', {
limit: 10
}, cb);
});
it('secondary usage should not break', function(cb) {
User.findAll({
where: {
type: 'limit test'
}
}, {
limit: 10
}, cb);
});
it('it should effectively limit the number of things returned', function(cb) {
User.findAllByType(testName, {
limit: limit
}, function(err, users) {
if(err) throw new Error(err);
else if(!users) throw new Error('Unexpected result: ' + users);
else if(users.length !== limit) throw new Error('Improper # of users returned (' + users.length + ')');
else cb();
});
});
it('chained limit should work', function(cb) {
var limit = 3;
User.findAll({type: testName}).limit(limit).done(function(err,result) {
if(err) throw new Error(err);
else if(!result) throw new Error('Unexpected result: ' + result);
else if(result.length !== limit) throw new Error('Improper # of users returned (' + result.length + ')');
else cb();
});
});
it('chain-breaking usage of chained limit should work', function(cb) {
User.findAllByType(testName).limit(limit, function(err, users) {
if(err) throw new Error(err);
else if(!users) throw new Error('Unexpected result: ' + users);
else if(users.length !== limit) throw new Error('Improper # of users returned (' + users.length + ')');
else cb();
});
});
}); | robincafolla/sails-hbs | test/waterline/adapter/limit.test.js | JavaScript | mit | 1,869 |
"use strict";
var ObjectManager = require('../../object/manager'),
util = require('util');
/**
* This authenticator will do a basic auth check on the headers.
*
* @class DefaultAuthenticator
* @extends ObjectManager
* @constructor
*/
function DefaultAuthenticator(config) {
ObjectManager.call(this, config);
}
util.inherits(DefaultAuthenticator, ObjectManager);
/**
* This authenticator will check for a basic auth header
* and when it is available it will authenticate the user.
*
* This behavior can be overwritten with your own authenticator.
*
* @method authenticate
* @param {Object} request The NodeJS request object.
* @returns {Promise} The promise containing the username and password
*/
DefaultAuthenticator.prototype.authenticate = function(request) {
var header = request.headers.authorization || '';
var token = header.split(/\s+/).pop() || '';
var auth = new Buffer(token, 'base64').toString();
var parts = auth.split(/:/);
var username = parts[0];
var password = parts[1];
if(username && password) {
return Promise.resolve({
username: username,
password: password
});
} else {
return Promise.resolve({});
}
};
module.exports = DefaultAuthenticator; | JaspervRijbroek/raddish | lib/dispatcher/authenticator/default.js | JavaScript | mit | 1,289 |
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
return this.store.query('order', {
filter: { simple: { company: params.id } }
}, { reload: true });
}
});
| Rei-li/YummyTime_client | app/routes/company-orders.js | JavaScript | mit | 204 |
window.nine = "God forgives I dont\n" +
"In other words, retaliation is a must!\n" +
"I bow my head, I pray to God\n" +
"Survival of the fittest help me hold my chopper lord!\n" +
"If I die today, on the highway to heaven\n" +
"Can I let my top down in my 911?\n" +
"In my 911?\n" +
"In my 911?\n" +
"In my 911?\n" +
"In my 911?\n" +
"Financial fanatic, 40 bricks in my attic\n" +
"400K in my baggage, 80 round automatic\n" +
"You can't stop a bullet, this one for the money\n" +
"Secret indictments, Porsche costs me 200\n" +
"Fuck all these broke niggas cause all I do is ball\n" +
"Ain't no more off days, my crib look like a mall\n" +
"Fired the stylist, went and bought a big and tall\n" +
"Niggas still scheming, we sliding on the mall!\n" +
"I remember picking watermelons\n" +
"Now the Porsche cost me a quarter million!\n" +
"If I die tonight I know I'm coming back nigga\n" +
"Reincarnated: big black fat nigga!\n" +
"I bow my head, I pray to God\n" +
"Survival of the fittest help me hold my chopper lord!\n" +
"If I die today, on the highway to heaven\n" +
"Can I let my top down in my 911?\n" +
"In my 911?\n" +
"In my 911?\n" +
"In my 911?\n" +
"In my 911?\n" +
"Financial fanatic, 40 bricks in my attic\n" +
"400K in my baggage, 80 round automatic\n" +
"You can't stop a bullet, this one for the money\n" +
"Secret indictments, Porsche costs me 200\n" +
"Fuck your investigation, started my elevation\n" +
"Cherry red 911 straight to my destination\n" +
"Mayweather got a fight, make me some reservations\n" +
"Knew I flew private nigga, strapped with no hesitations\n" +
"Boochie Boochie money long, he got 20 cars\n" +
"Graduated from them blocks, now it's stocks and bonds\n" +
"Hoes wanna know, hoes wanna show\n" +
"They know a nigga's name, they know a nigga's strong\n" +
"Fuck wit me!\n" +
"I bow my head, I pray to God\n" +
"Survival of the fittest help me hold my chopper lord!\n" +
"If I die today, on the highway to heaven\n" +
"Can I let my top down in my 911?\n" +
"In my 911?\n" +
"In my 911?\n" +
"In my 911?\n" +
"In my 911?\n" +
"Financial fanatic, 40 bricks in my attic\n" +
"400K in my baggage, 80 round automatic\n" +
"You can't stop a bullet, this one for the money\n" +
"Secret indictments, Porsche costs me 200\n" +
"Fuck your insinuation, work come from Venezuela\n" +
"Love me some skinny bitches, fat boy just 'bout his paper\n" +
"Hustle while niggas gossip, hating, that switch the topic\n" +
"Jump in my 911, 2 bricks in my compartment!\n" +
"She let me smell her pussy!\n" +
"I know you smell the money!\n" +
"Still smell the gunpowder\n" +
"911, 100 miles and running\n" +
"I bow my head, I pray to God\n" +
"Survival of the fittest help me hold my chopper lord!\n" +
"If I die today, on the highway to heaven\n" +
"Can I let my top down in my 911?\n" +
"In my 911?\n" +
"In my 911?\n" +
"In my 911?\n" +
"In my 911?\n" +
"Financial fanatic, 40 bricks in my attic\n" +
"400K in my baggage, 80 round automatic\n" +
"You can't stop a bullet, this one for the money\n" +
"Secret indictments, Porsche costs me 200"; | bkillenit/rapper-fight-party | assets/lyrics/nine.js | JavaScript | mit | 3,058 |
const config = require('./node-common').config();
const data = require('./modules/data');
const log = require('./node-common').log();
const conduit = require('./node-common').conduit();
config.requireKeys('main.js', {
required: [ 'ENV' ],
type: 'object', properties: {
ENV: {
required: [ 'UPDATE_INTERVAL_M' ],
type: 'object', properties: {
UPDATE_INTERVAL_M: { type: 'number' }
}
}
}
});
(async () => {
log.begin();
await conduit.register();
setInterval(data.download, config.ENV.UPDATE_INTERVAL_M * 1000 * 60);
data.download();
})();
| C-D-Lewis/news-headlines | backend/src/main.js | JavaScript | mit | 590 |
//
// BEGIN LICENSE BLOCK
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Raül Pérez
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// END LICENSE BLOCK
//
/**
* @namespace bashprompt.partials.cwd
*/
var cwd = {};
/**
* Get the current working directory from $HOME
*
* {@link bashprompt.partials.currentWorkDirectory}
*
* @returns {string}
*/
cwd.currentWorkDirectory = function () {
'use strict';
var home = cwd.userHomeDirectory();
var path = cwd.absoluteWorkDirectory();
return path.replace(home, '~');
};
/**
* Get the absolute current working directory
*
* {@link bashprompt.partials.absoluteWorkDirectory}
*
* @returns {string}
*/
cwd.absoluteWorkDirectory = function () {
'use strict';
return process.cwd();
};
/**
* Get the current user's $HOME path
*
* {@link bashprompt.partials.userHomeDirectory}
*
* @returns {string}
*/
cwd.userHomeDirectory = function () {
'use strict';
return process.env.HOME;
};
/** @module bashprompt/partials/cwd */
module.exports = cwd;
| repejota/bashprompt.js | lib/partials/cwd.js | JavaScript | mit | 2,073 |
function showTab (tabID) {
jQuery('.tab-content').hide().removeClass('active')
jQuery(tabID + '-tab').addClass('active').show()
jQuery('ul.tabs li').removeClass('active')
jQuery(tabID + '-tab-link').addClass('active')
jQuery('html,body').animate({ scrollTop: jQuery('ul.tabs').offset().top - 25 }, 1000)
if (window.history.pushState) {
window.history.pushState(null, '', tabID)
} else {
window.location.hash = tabID
}
}
export default showTab
| concord-consortium/rigse | react-components/src/library/helpers/tabs.js | JavaScript | mit | 468 |
/**
* Created by prprak on 6/15/2016.
*/
const extractorConfig = {
extractors: [
{
nameKey: 'AutoDetect',
autodetect: function(input) {
return false;
}
},
{
nameKey: 'HindustanTimes',
autodetect: function(input) {
return input && input.indexOf('www.hindustantimes.com/') > 0;
},
selector: '.story_content > .sty_txt',
titleSelector: '.story_pg_head > h1',
summarySelector: '.story_content > .sty_txt > p:eq(1)',
ignorePhrases: ['Hindustan Times', 'HT Media']
},
{
nameKey: 'FinancialExpress',
autodetect: function(input) {
return input && input.indexOf('www.financialexpress.com/') > 0;
},
selector: '.main-story-content',
titleSelector: '.storybox > h1',
summarySelector: '.storybox > h2.synopsis',
ignorePhrases: []
},
{
nameKey: 'TOI',
autodetect: function(input) {
return input && input.indexOf('timesofindia.indiatimes.com/') > 0;
},
selector: '.article_content',
titleSelector: '.title_section > h1',
summarySelector: '.artsyn',
ignorePhrases: ['Times of India', 'TOI']
},
{
nameKey: 'CNN',
autodetect: function(input) {
return input && input.indexOf('www.cnn.com/') > 0;
},
selector: '.zn-body__paragraph',
titleSelector: '.pg-headline',
summarySelector: '.zn-body__paragraph:first',
ignorePhrases: ['CNN']
},
{
nameKey: 'Custom',
autodetect: function(input) {
return false;
}
}
]
};
export {
extractorConfig as
default
}; | prem9in/summarize | app/scripts/model/extractorconfig.js | JavaScript | mit | 1,953 |
// app.js
var routerApp = angular.module('routerApp', ['ui.router']);
routerApp.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/home');
$stateProvider
// home state and nested views
.state('home', {
url: '/home',
templateUrl: 'partial-home.html'
})
// nested list with custom controller
.state('home.list', {
url: '/list',
templateUrl: 'partial-home-list.html',
controller: function($scope) {
$scope.robots = ['augmentor', 'security', 'repair'];
}
})
// nested list with random string data
.state('home.paragraph', {
url: '/paragraph',
template: 'Robots... everywhere...'
})
// about page and multiple named views
//
// NOTE: UI-Router assigns every view to an absolute name. The
// structure for this is viewName@stateName. The main
// templateUrl is named with an empty string and will take on
// a relative name. columnOne@about and the other are defined
// absolutely.
.state('about', {
url: '/about',
views: {
// main template (relatively named)
'': { templateUrl: 'partial-about.html' },
// child views defined here (absolutely named)
'columnOne@about': { template: 'This is column one' },
// column two gets a separate controller
'columnTwo@about': {
templateUrl: 'table-data.html',
controller: 'colTwoController'
}
}
});
}); // closes $routerApp.config()
routerApp.controller('colTwoController', function($scope) {
$scope.message = 'test';
$scope.robots = [
{
name: 'Augmentor',
energy: 3,
attack: 1,
hp: 3
},
{
name: 'Security',
energy: 3,
attack: 3,
hp: 2
},
{
name: 'Repair',
energy: 2,
attack: 1,
hp: 4
}
];
});
| macfisher/ui-route-template | app.js | JavaScript | mit | 1,758 |
'use strict';
var upsertEnv = require('./upsert.js');
var newEnvVars = {
'MYNEWKEY':'a new value',
'ANOTHERNEWKEY':'another new value'
};
console.log(newEnvVars);
console.log(typeof newEnvVars);
upsertEnv.set(newEnvVars, null, function(error, data){
if (error) console.log('Uh oh. ' + error);
else console.log('Success!', data);
}); | kmiddlesworth/upsert-env | example.js | JavaScript | mit | 354 |
const test = require('ava');
const { BrickMaster, BrickRED, BrickletAccelerometerV2 } = require('tinkerforge');
const { name } = require('./get-name.js');
test('Brick Master', t => {
t.is(name(BrickMaster.DEVICE_IDENTIFIER), BrickMaster.DEVICE_DISPLAY_NAME);
});
test('Brick RED', t => {
t.is(name(BrickRED.DEVICE_IDENTIFIER), BrickRED.DEVICE_DISPLAY_NAME);
});
test('Bricklet Accelerometer V2', t => {
t.is(name(BrickletAccelerometerV2.DEVICE_IDENTIFIER), BrickletAccelerometerV2.DEVICE_DISPLAY_NAME);
});
test('unknown Brick/Bricklet name', t => {
t.is(name(123_321), 'unknown');
});
| fscherwi/tf-connected | src/get-name.test.js | JavaScript | mit | 595 |
// flow-typed signature: 119fc9dff8cd83a7d61ae3258ec9f578
// flow-typed version: <<STUB>>/eslint_v^7.30.0/flow_v0.154.0
/**
* This is an autogenerated libdef stub for:
*
* 'eslint'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'eslint' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'eslint/bin/eslint' {
declare module.exports: any;
}
declare module 'eslint/conf/config-schema' {
declare module.exports: any;
}
declare module 'eslint/conf/default-cli-options' {
declare module.exports: any;
}
declare module 'eslint/conf/eslint-all' {
declare module.exports: any;
}
declare module 'eslint/conf/eslint-recommended' {
declare module.exports: any;
}
declare module 'eslint/lib/api' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/cli-engine' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/file-enumerator' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/formatters/checkstyle' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/formatters/codeframe' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/formatters/compact' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/formatters/html' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/formatters/jslint-xml' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/formatters/json-with-metadata' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/formatters/json' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/formatters/junit' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/formatters/stylish' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/formatters/table' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/formatters/tap' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/formatters/unix' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/formatters/visualstudio' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/hash' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/index' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/lint-result-cache' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/load-rules' {
declare module.exports: any;
}
declare module 'eslint/lib/cli-engine/xml-escape' {
declare module.exports: any;
}
declare module 'eslint/lib/cli' {
declare module.exports: any;
}
declare module 'eslint/lib/config/default-config' {
declare module.exports: any;
}
declare module 'eslint/lib/config/flat-config-array' {
declare module.exports: any;
}
declare module 'eslint/lib/config/flat-config-schema' {
declare module.exports: any;
}
declare module 'eslint/lib/config/rule-validator' {
declare module.exports: any;
}
declare module 'eslint/lib/eslint/eslint' {
declare module.exports: any;
}
declare module 'eslint/lib/eslint/index' {
declare module.exports: any;
}
declare module 'eslint/lib/init/autoconfig' {
declare module.exports: any;
}
declare module 'eslint/lib/init/config-file' {
declare module.exports: any;
}
declare module 'eslint/lib/init/config-initializer' {
declare module.exports: any;
}
declare module 'eslint/lib/init/config-rule' {
declare module.exports: any;
}
declare module 'eslint/lib/init/npm-utils' {
declare module.exports: any;
}
declare module 'eslint/lib/init/source-code-utils' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/apply-disable-directives' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/code-path-analysis/code-path-analyzer' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/code-path-analysis/code-path-segment' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/code-path-analysis/code-path-state' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/code-path-analysis/code-path' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/code-path-analysis/debug-helpers' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/code-path-analysis/fork-context' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/code-path-analysis/id-generator' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/config-comment-parser' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/index' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/interpolate' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/linter' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/node-event-generator' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/report-translator' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/rule-fixer' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/rules' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/safe-emitter' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/source-code-fixer' {
declare module.exports: any;
}
declare module 'eslint/lib/linter/timing' {
declare module.exports: any;
}
declare module 'eslint/lib/options' {
declare module.exports: any;
}
declare module 'eslint/lib/rule-tester/index' {
declare module.exports: any;
}
declare module 'eslint/lib/rule-tester/rule-tester' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/accessor-pairs' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/array-bracket-newline' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/array-bracket-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/array-callback-return' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/array-element-newline' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/arrow-body-style' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/arrow-parens' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/arrow-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/block-scoped-var' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/block-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/brace-style' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/callback-return' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/camelcase' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/capitalized-comments' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/class-methods-use-this' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/comma-dangle' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/comma-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/comma-style' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/complexity' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/computed-property-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/consistent-return' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/consistent-this' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/constructor-super' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/curly' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/default-case-last' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/default-case' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/default-param-last' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/dot-location' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/dot-notation' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/eol-last' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/eqeqeq' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/for-direction' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/func-call-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/func-name-matching' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/func-names' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/func-style' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/function-call-argument-newline' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/function-paren-newline' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/generator-star-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/getter-return' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/global-require' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/grouped-accessor-pairs' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/guard-for-in' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/handle-callback-err' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/id-blacklist' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/id-denylist' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/id-length' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/id-match' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/implicit-arrow-linebreak' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/indent-legacy' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/indent' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/index' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/init-declarations' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/jsx-quotes' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/key-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/keyword-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/line-comment-position' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/linebreak-style' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/lines-around-comment' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/lines-around-directive' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/lines-between-class-members' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/max-classes-per-file' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/max-depth' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/max-len' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/max-lines-per-function' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/max-lines' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/max-nested-callbacks' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/max-params' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/max-statements-per-line' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/max-statements' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/multiline-comment-style' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/multiline-ternary' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/new-cap' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/new-parens' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/newline-after-var' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/newline-before-return' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/newline-per-chained-call' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-alert' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-array-constructor' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-async-promise-executor' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-await-in-loop' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-bitwise' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-buffer-constructor' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-caller' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-case-declarations' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-catch-shadow' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-class-assign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-compare-neg-zero' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-cond-assign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-confusing-arrow' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-console' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-const-assign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-constant-condition' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-constructor-return' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-continue' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-control-regex' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-debugger' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-delete-var' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-div-regex' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-dupe-args' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-dupe-class-members' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-dupe-else-if' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-dupe-keys' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-duplicate-case' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-duplicate-imports' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-else-return' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-empty-character-class' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-empty-function' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-empty-pattern' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-empty' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-eq-null' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-eval' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-ex-assign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-extend-native' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-extra-bind' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-extra-boolean-cast' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-extra-label' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-extra-parens' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-extra-semi' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-fallthrough' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-floating-decimal' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-func-assign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-global-assign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-implicit-coercion' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-implicit-globals' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-implied-eval' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-import-assign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-inline-comments' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-inner-declarations' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-invalid-regexp' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-invalid-this' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-irregular-whitespace' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-iterator' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-label-var' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-labels' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-lone-blocks' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-lonely-if' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-loop-func' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-loss-of-precision' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-magic-numbers' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-misleading-character-class' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-mixed-operators' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-mixed-requires' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-mixed-spaces-and-tabs' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-multi-assign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-multi-spaces' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-multi-str' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-multiple-empty-lines' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-native-reassign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-negated-condition' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-negated-in-lhs' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-nested-ternary' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-new-func' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-new-object' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-new-require' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-new-symbol' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-new-wrappers' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-new' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-nonoctal-decimal-escape' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-obj-calls' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-octal-escape' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-octal' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-param-reassign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-path-concat' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-plusplus' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-process-env' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-process-exit' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-promise-executor-return' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-proto' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-prototype-builtins' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-redeclare' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-regex-spaces' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-restricted-exports' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-restricted-globals' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-restricted-imports' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-restricted-modules' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-restricted-properties' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-restricted-syntax' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-return-assign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-return-await' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-script-url' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-self-assign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-self-compare' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-sequences' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-setter-return' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-shadow-restricted-names' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-shadow' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-spaced-func' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-sparse-arrays' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-sync' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-tabs' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-template-curly-in-string' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-ternary' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-this-before-super' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-throw-literal' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-trailing-spaces' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-undef-init' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-undef' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-undefined' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-underscore-dangle' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-unexpected-multiline' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-unmodified-loop-condition' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-unneeded-ternary' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-unreachable-loop' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-unreachable' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-unsafe-finally' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-unsafe-negation' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-unsafe-optional-chaining' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-unused-expressions' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-unused-labels' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-unused-vars' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-use-before-define' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-useless-backreference' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-useless-call' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-useless-catch' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-useless-computed-key' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-useless-concat' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-useless-constructor' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-useless-escape' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-useless-rename' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-useless-return' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-var' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-void' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-warning-comments' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-whitespace-before-property' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-with' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/nonblock-statement-body-position' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/object-curly-newline' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/object-curly-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/object-property-newline' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/object-shorthand' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/one-var-declaration-per-line' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/one-var' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/operator-assignment' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/operator-linebreak' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/padded-blocks' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/padding-line-between-statements' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-arrow-callback' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-const' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-destructuring' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-exponentiation-operator' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-named-capture-group' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-numeric-literals' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-object-spread' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-promise-reject-errors' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-reflect' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-regex-literals' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-rest-params' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-spread' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-template' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/quote-props' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/quotes' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/radix' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/require-atomic-updates' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/require-await' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/require-jsdoc' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/require-unicode-regexp' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/require-yield' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/rest-spread-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/semi-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/semi-style' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/semi' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/sort-imports' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/sort-keys' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/sort-vars' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/space-before-blocks' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/space-before-function-paren' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/space-in-parens' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/space-infix-ops' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/space-unary-ops' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/spaced-comment' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/strict' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/switch-colon-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/symbol-description' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/template-curly-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/template-tag-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/unicode-bom' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/use-isnan' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/utils/ast-utils' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/utils/fix-tracker' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/utils/keywords' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/utils/lazy-loading-rule-map' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/utils/patterns/letters' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/utils/unicode/index' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/utils/unicode/is-combining-character' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/utils/unicode/is-emoji-modifier' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/utils/unicode/is-regional-indicator-symbol' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/utils/unicode/is-surrogate-pair' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/valid-jsdoc' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/valid-typeof' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/vars-on-top' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/wrap-iife' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/wrap-regex' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/yield-star-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/yoda' {
declare module.exports: any;
}
declare module 'eslint/lib/shared/ajv' {
declare module.exports: any;
}
declare module 'eslint/lib/shared/ast-utils' {
declare module.exports: any;
}
declare module 'eslint/lib/shared/config-validator' {
declare module.exports: any;
}
declare module 'eslint/lib/shared/deprecation-warnings' {
declare module.exports: any;
}
declare module 'eslint/lib/shared/logging' {
declare module.exports: any;
}
declare module 'eslint/lib/shared/relative-module-resolver' {
declare module.exports: any;
}
declare module 'eslint/lib/shared/runtime-info' {
declare module.exports: any;
}
declare module 'eslint/lib/shared/string-utils' {
declare module.exports: any;
}
declare module 'eslint/lib/shared/traverser' {
declare module.exports: any;
}
declare module 'eslint/lib/shared/types' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/index' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/source-code' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/token-store/backward-token-comment-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/token-store/backward-token-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/token-store/cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/token-store/cursors' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/token-store/decorative-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/token-store/filter-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/token-store/forward-token-comment-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/token-store/forward-token-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/token-store/index' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/token-store/limit-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/token-store/padded-token-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/token-store/skip-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/source-code/token-store/utils' {
declare module.exports: any;
}
declare module 'eslint/messages/all-files-ignored' {
declare module.exports: any;
}
declare module 'eslint/messages/extend-config-missing' {
declare module.exports: any;
}
declare module 'eslint/messages/failed-to-read-json' {
declare module.exports: any;
}
declare module 'eslint/messages/file-not-found' {
declare module.exports: any;
}
declare module 'eslint/messages/no-config-found' {
declare module.exports: any;
}
declare module 'eslint/messages/plugin-conflict' {
declare module.exports: any;
}
declare module 'eslint/messages/plugin-invalid' {
declare module.exports: any;
}
declare module 'eslint/messages/plugin-missing' {
declare module.exports: any;
}
declare module 'eslint/messages/print-config-with-directory-path' {
declare module.exports: any;
}
declare module 'eslint/messages/whitespace-found' {
declare module.exports: any;
}
// Filename aliases
declare module 'eslint/bin/eslint.js' {
declare module.exports: $Exports<'eslint/bin/eslint'>;
}
declare module 'eslint/conf/config-schema.js' {
declare module.exports: $Exports<'eslint/conf/config-schema'>;
}
declare module 'eslint/conf/default-cli-options.js' {
declare module.exports: $Exports<'eslint/conf/default-cli-options'>;
}
declare module 'eslint/conf/eslint-all.js' {
declare module.exports: $Exports<'eslint/conf/eslint-all'>;
}
declare module 'eslint/conf/eslint-recommended.js' {
declare module.exports: $Exports<'eslint/conf/eslint-recommended'>;
}
declare module 'eslint/lib/api.js' {
declare module.exports: $Exports<'eslint/lib/api'>;
}
declare module 'eslint/lib/cli-engine/cli-engine.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/cli-engine'>;
}
declare module 'eslint/lib/cli-engine/file-enumerator.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/file-enumerator'>;
}
declare module 'eslint/lib/cli-engine/formatters/checkstyle.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/formatters/checkstyle'>;
}
declare module 'eslint/lib/cli-engine/formatters/codeframe.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/formatters/codeframe'>;
}
declare module 'eslint/lib/cli-engine/formatters/compact.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/formatters/compact'>;
}
declare module 'eslint/lib/cli-engine/formatters/html.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/formatters/html'>;
}
declare module 'eslint/lib/cli-engine/formatters/jslint-xml.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/formatters/jslint-xml'>;
}
declare module 'eslint/lib/cli-engine/formatters/json-with-metadata.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/formatters/json-with-metadata'>;
}
declare module 'eslint/lib/cli-engine/formatters/json.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/formatters/json'>;
}
declare module 'eslint/lib/cli-engine/formatters/junit.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/formatters/junit'>;
}
declare module 'eslint/lib/cli-engine/formatters/stylish.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/formatters/stylish'>;
}
declare module 'eslint/lib/cli-engine/formatters/table.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/formatters/table'>;
}
declare module 'eslint/lib/cli-engine/formatters/tap.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/formatters/tap'>;
}
declare module 'eslint/lib/cli-engine/formatters/unix.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/formatters/unix'>;
}
declare module 'eslint/lib/cli-engine/formatters/visualstudio.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/formatters/visualstudio'>;
}
declare module 'eslint/lib/cli-engine/hash.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/hash'>;
}
declare module 'eslint/lib/cli-engine/index.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/index'>;
}
declare module 'eslint/lib/cli-engine/lint-result-cache.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/lint-result-cache'>;
}
declare module 'eslint/lib/cli-engine/load-rules.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/load-rules'>;
}
declare module 'eslint/lib/cli-engine/xml-escape.js' {
declare module.exports: $Exports<'eslint/lib/cli-engine/xml-escape'>;
}
declare module 'eslint/lib/cli.js' {
declare module.exports: $Exports<'eslint/lib/cli'>;
}
declare module 'eslint/lib/config/default-config.js' {
declare module.exports: $Exports<'eslint/lib/config/default-config'>;
}
declare module 'eslint/lib/config/flat-config-array.js' {
declare module.exports: $Exports<'eslint/lib/config/flat-config-array'>;
}
declare module 'eslint/lib/config/flat-config-schema.js' {
declare module.exports: $Exports<'eslint/lib/config/flat-config-schema'>;
}
declare module 'eslint/lib/config/rule-validator.js' {
declare module.exports: $Exports<'eslint/lib/config/rule-validator'>;
}
declare module 'eslint/lib/eslint/eslint.js' {
declare module.exports: $Exports<'eslint/lib/eslint/eslint'>;
}
declare module 'eslint/lib/eslint/index.js' {
declare module.exports: $Exports<'eslint/lib/eslint/index'>;
}
declare module 'eslint/lib/init/autoconfig.js' {
declare module.exports: $Exports<'eslint/lib/init/autoconfig'>;
}
declare module 'eslint/lib/init/config-file.js' {
declare module.exports: $Exports<'eslint/lib/init/config-file'>;
}
declare module 'eslint/lib/init/config-initializer.js' {
declare module.exports: $Exports<'eslint/lib/init/config-initializer'>;
}
declare module 'eslint/lib/init/config-rule.js' {
declare module.exports: $Exports<'eslint/lib/init/config-rule'>;
}
declare module 'eslint/lib/init/npm-utils.js' {
declare module.exports: $Exports<'eslint/lib/init/npm-utils'>;
}
declare module 'eslint/lib/init/source-code-utils.js' {
declare module.exports: $Exports<'eslint/lib/init/source-code-utils'>;
}
declare module 'eslint/lib/linter/apply-disable-directives.js' {
declare module.exports: $Exports<'eslint/lib/linter/apply-disable-directives'>;
}
declare module 'eslint/lib/linter/code-path-analysis/code-path-analyzer.js' {
declare module.exports: $Exports<'eslint/lib/linter/code-path-analysis/code-path-analyzer'>;
}
declare module 'eslint/lib/linter/code-path-analysis/code-path-segment.js' {
declare module.exports: $Exports<'eslint/lib/linter/code-path-analysis/code-path-segment'>;
}
declare module 'eslint/lib/linter/code-path-analysis/code-path-state.js' {
declare module.exports: $Exports<'eslint/lib/linter/code-path-analysis/code-path-state'>;
}
declare module 'eslint/lib/linter/code-path-analysis/code-path.js' {
declare module.exports: $Exports<'eslint/lib/linter/code-path-analysis/code-path'>;
}
declare module 'eslint/lib/linter/code-path-analysis/debug-helpers.js' {
declare module.exports: $Exports<'eslint/lib/linter/code-path-analysis/debug-helpers'>;
}
declare module 'eslint/lib/linter/code-path-analysis/fork-context.js' {
declare module.exports: $Exports<'eslint/lib/linter/code-path-analysis/fork-context'>;
}
declare module 'eslint/lib/linter/code-path-analysis/id-generator.js' {
declare module.exports: $Exports<'eslint/lib/linter/code-path-analysis/id-generator'>;
}
declare module 'eslint/lib/linter/config-comment-parser.js' {
declare module.exports: $Exports<'eslint/lib/linter/config-comment-parser'>;
}
declare module 'eslint/lib/linter/index.js' {
declare module.exports: $Exports<'eslint/lib/linter/index'>;
}
declare module 'eslint/lib/linter/interpolate.js' {
declare module.exports: $Exports<'eslint/lib/linter/interpolate'>;
}
declare module 'eslint/lib/linter/linter.js' {
declare module.exports: $Exports<'eslint/lib/linter/linter'>;
}
declare module 'eslint/lib/linter/node-event-generator.js' {
declare module.exports: $Exports<'eslint/lib/linter/node-event-generator'>;
}
declare module 'eslint/lib/linter/report-translator.js' {
declare module.exports: $Exports<'eslint/lib/linter/report-translator'>;
}
declare module 'eslint/lib/linter/rule-fixer.js' {
declare module.exports: $Exports<'eslint/lib/linter/rule-fixer'>;
}
declare module 'eslint/lib/linter/rules.js' {
declare module.exports: $Exports<'eslint/lib/linter/rules'>;
}
declare module 'eslint/lib/linter/safe-emitter.js' {
declare module.exports: $Exports<'eslint/lib/linter/safe-emitter'>;
}
declare module 'eslint/lib/linter/source-code-fixer.js' {
declare module.exports: $Exports<'eslint/lib/linter/source-code-fixer'>;
}
declare module 'eslint/lib/linter/timing.js' {
declare module.exports: $Exports<'eslint/lib/linter/timing'>;
}
declare module 'eslint/lib/options.js' {
declare module.exports: $Exports<'eslint/lib/options'>;
}
declare module 'eslint/lib/rule-tester/index.js' {
declare module.exports: $Exports<'eslint/lib/rule-tester/index'>;
}
declare module 'eslint/lib/rule-tester/rule-tester.js' {
declare module.exports: $Exports<'eslint/lib/rule-tester/rule-tester'>;
}
declare module 'eslint/lib/rules/accessor-pairs.js' {
declare module.exports: $Exports<'eslint/lib/rules/accessor-pairs'>;
}
declare module 'eslint/lib/rules/array-bracket-newline.js' {
declare module.exports: $Exports<'eslint/lib/rules/array-bracket-newline'>;
}
declare module 'eslint/lib/rules/array-bracket-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/array-bracket-spacing'>;
}
declare module 'eslint/lib/rules/array-callback-return.js' {
declare module.exports: $Exports<'eslint/lib/rules/array-callback-return'>;
}
declare module 'eslint/lib/rules/array-element-newline.js' {
declare module.exports: $Exports<'eslint/lib/rules/array-element-newline'>;
}
declare module 'eslint/lib/rules/arrow-body-style.js' {
declare module.exports: $Exports<'eslint/lib/rules/arrow-body-style'>;
}
declare module 'eslint/lib/rules/arrow-parens.js' {
declare module.exports: $Exports<'eslint/lib/rules/arrow-parens'>;
}
declare module 'eslint/lib/rules/arrow-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/arrow-spacing'>;
}
declare module 'eslint/lib/rules/block-scoped-var.js' {
declare module.exports: $Exports<'eslint/lib/rules/block-scoped-var'>;
}
declare module 'eslint/lib/rules/block-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/block-spacing'>;
}
declare module 'eslint/lib/rules/brace-style.js' {
declare module.exports: $Exports<'eslint/lib/rules/brace-style'>;
}
declare module 'eslint/lib/rules/callback-return.js' {
declare module.exports: $Exports<'eslint/lib/rules/callback-return'>;
}
declare module 'eslint/lib/rules/camelcase.js' {
declare module.exports: $Exports<'eslint/lib/rules/camelcase'>;
}
declare module 'eslint/lib/rules/capitalized-comments.js' {
declare module.exports: $Exports<'eslint/lib/rules/capitalized-comments'>;
}
declare module 'eslint/lib/rules/class-methods-use-this.js' {
declare module.exports: $Exports<'eslint/lib/rules/class-methods-use-this'>;
}
declare module 'eslint/lib/rules/comma-dangle.js' {
declare module.exports: $Exports<'eslint/lib/rules/comma-dangle'>;
}
declare module 'eslint/lib/rules/comma-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/comma-spacing'>;
}
declare module 'eslint/lib/rules/comma-style.js' {
declare module.exports: $Exports<'eslint/lib/rules/comma-style'>;
}
declare module 'eslint/lib/rules/complexity.js' {
declare module.exports: $Exports<'eslint/lib/rules/complexity'>;
}
declare module 'eslint/lib/rules/computed-property-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/computed-property-spacing'>;
}
declare module 'eslint/lib/rules/consistent-return.js' {
declare module.exports: $Exports<'eslint/lib/rules/consistent-return'>;
}
declare module 'eslint/lib/rules/consistent-this.js' {
declare module.exports: $Exports<'eslint/lib/rules/consistent-this'>;
}
declare module 'eslint/lib/rules/constructor-super.js' {
declare module.exports: $Exports<'eslint/lib/rules/constructor-super'>;
}
declare module 'eslint/lib/rules/curly.js' {
declare module.exports: $Exports<'eslint/lib/rules/curly'>;
}
declare module 'eslint/lib/rules/default-case-last.js' {
declare module.exports: $Exports<'eslint/lib/rules/default-case-last'>;
}
declare module 'eslint/lib/rules/default-case.js' {
declare module.exports: $Exports<'eslint/lib/rules/default-case'>;
}
declare module 'eslint/lib/rules/default-param-last.js' {
declare module.exports: $Exports<'eslint/lib/rules/default-param-last'>;
}
declare module 'eslint/lib/rules/dot-location.js' {
declare module.exports: $Exports<'eslint/lib/rules/dot-location'>;
}
declare module 'eslint/lib/rules/dot-notation.js' {
declare module.exports: $Exports<'eslint/lib/rules/dot-notation'>;
}
declare module 'eslint/lib/rules/eol-last.js' {
declare module.exports: $Exports<'eslint/lib/rules/eol-last'>;
}
declare module 'eslint/lib/rules/eqeqeq.js' {
declare module.exports: $Exports<'eslint/lib/rules/eqeqeq'>;
}
declare module 'eslint/lib/rules/for-direction.js' {
declare module.exports: $Exports<'eslint/lib/rules/for-direction'>;
}
declare module 'eslint/lib/rules/func-call-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/func-call-spacing'>;
}
declare module 'eslint/lib/rules/func-name-matching.js' {
declare module.exports: $Exports<'eslint/lib/rules/func-name-matching'>;
}
declare module 'eslint/lib/rules/func-names.js' {
declare module.exports: $Exports<'eslint/lib/rules/func-names'>;
}
declare module 'eslint/lib/rules/func-style.js' {
declare module.exports: $Exports<'eslint/lib/rules/func-style'>;
}
declare module 'eslint/lib/rules/function-call-argument-newline.js' {
declare module.exports: $Exports<'eslint/lib/rules/function-call-argument-newline'>;
}
declare module 'eslint/lib/rules/function-paren-newline.js' {
declare module.exports: $Exports<'eslint/lib/rules/function-paren-newline'>;
}
declare module 'eslint/lib/rules/generator-star-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/generator-star-spacing'>;
}
declare module 'eslint/lib/rules/getter-return.js' {
declare module.exports: $Exports<'eslint/lib/rules/getter-return'>;
}
declare module 'eslint/lib/rules/global-require.js' {
declare module.exports: $Exports<'eslint/lib/rules/global-require'>;
}
declare module 'eslint/lib/rules/grouped-accessor-pairs.js' {
declare module.exports: $Exports<'eslint/lib/rules/grouped-accessor-pairs'>;
}
declare module 'eslint/lib/rules/guard-for-in.js' {
declare module.exports: $Exports<'eslint/lib/rules/guard-for-in'>;
}
declare module 'eslint/lib/rules/handle-callback-err.js' {
declare module.exports: $Exports<'eslint/lib/rules/handle-callback-err'>;
}
declare module 'eslint/lib/rules/id-blacklist.js' {
declare module.exports: $Exports<'eslint/lib/rules/id-blacklist'>;
}
declare module 'eslint/lib/rules/id-denylist.js' {
declare module.exports: $Exports<'eslint/lib/rules/id-denylist'>;
}
declare module 'eslint/lib/rules/id-length.js' {
declare module.exports: $Exports<'eslint/lib/rules/id-length'>;
}
declare module 'eslint/lib/rules/id-match.js' {
declare module.exports: $Exports<'eslint/lib/rules/id-match'>;
}
declare module 'eslint/lib/rules/implicit-arrow-linebreak.js' {
declare module.exports: $Exports<'eslint/lib/rules/implicit-arrow-linebreak'>;
}
declare module 'eslint/lib/rules/indent-legacy.js' {
declare module.exports: $Exports<'eslint/lib/rules/indent-legacy'>;
}
declare module 'eslint/lib/rules/indent.js' {
declare module.exports: $Exports<'eslint/lib/rules/indent'>;
}
declare module 'eslint/lib/rules/index.js' {
declare module.exports: $Exports<'eslint/lib/rules/index'>;
}
declare module 'eslint/lib/rules/init-declarations.js' {
declare module.exports: $Exports<'eslint/lib/rules/init-declarations'>;
}
declare module 'eslint/lib/rules/jsx-quotes.js' {
declare module.exports: $Exports<'eslint/lib/rules/jsx-quotes'>;
}
declare module 'eslint/lib/rules/key-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/key-spacing'>;
}
declare module 'eslint/lib/rules/keyword-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/keyword-spacing'>;
}
declare module 'eslint/lib/rules/line-comment-position.js' {
declare module.exports: $Exports<'eslint/lib/rules/line-comment-position'>;
}
declare module 'eslint/lib/rules/linebreak-style.js' {
declare module.exports: $Exports<'eslint/lib/rules/linebreak-style'>;
}
declare module 'eslint/lib/rules/lines-around-comment.js' {
declare module.exports: $Exports<'eslint/lib/rules/lines-around-comment'>;
}
declare module 'eslint/lib/rules/lines-around-directive.js' {
declare module.exports: $Exports<'eslint/lib/rules/lines-around-directive'>;
}
declare module 'eslint/lib/rules/lines-between-class-members.js' {
declare module.exports: $Exports<'eslint/lib/rules/lines-between-class-members'>;
}
declare module 'eslint/lib/rules/max-classes-per-file.js' {
declare module.exports: $Exports<'eslint/lib/rules/max-classes-per-file'>;
}
declare module 'eslint/lib/rules/max-depth.js' {
declare module.exports: $Exports<'eslint/lib/rules/max-depth'>;
}
declare module 'eslint/lib/rules/max-len.js' {
declare module.exports: $Exports<'eslint/lib/rules/max-len'>;
}
declare module 'eslint/lib/rules/max-lines-per-function.js' {
declare module.exports: $Exports<'eslint/lib/rules/max-lines-per-function'>;
}
declare module 'eslint/lib/rules/max-lines.js' {
declare module.exports: $Exports<'eslint/lib/rules/max-lines'>;
}
declare module 'eslint/lib/rules/max-nested-callbacks.js' {
declare module.exports: $Exports<'eslint/lib/rules/max-nested-callbacks'>;
}
declare module 'eslint/lib/rules/max-params.js' {
declare module.exports: $Exports<'eslint/lib/rules/max-params'>;
}
declare module 'eslint/lib/rules/max-statements-per-line.js' {
declare module.exports: $Exports<'eslint/lib/rules/max-statements-per-line'>;
}
declare module 'eslint/lib/rules/max-statements.js' {
declare module.exports: $Exports<'eslint/lib/rules/max-statements'>;
}
declare module 'eslint/lib/rules/multiline-comment-style.js' {
declare module.exports: $Exports<'eslint/lib/rules/multiline-comment-style'>;
}
declare module 'eslint/lib/rules/multiline-ternary.js' {
declare module.exports: $Exports<'eslint/lib/rules/multiline-ternary'>;
}
declare module 'eslint/lib/rules/new-cap.js' {
declare module.exports: $Exports<'eslint/lib/rules/new-cap'>;
}
declare module 'eslint/lib/rules/new-parens.js' {
declare module.exports: $Exports<'eslint/lib/rules/new-parens'>;
}
declare module 'eslint/lib/rules/newline-after-var.js' {
declare module.exports: $Exports<'eslint/lib/rules/newline-after-var'>;
}
declare module 'eslint/lib/rules/newline-before-return.js' {
declare module.exports: $Exports<'eslint/lib/rules/newline-before-return'>;
}
declare module 'eslint/lib/rules/newline-per-chained-call.js' {
declare module.exports: $Exports<'eslint/lib/rules/newline-per-chained-call'>;
}
declare module 'eslint/lib/rules/no-alert.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-alert'>;
}
declare module 'eslint/lib/rules/no-array-constructor.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-array-constructor'>;
}
declare module 'eslint/lib/rules/no-async-promise-executor.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-async-promise-executor'>;
}
declare module 'eslint/lib/rules/no-await-in-loop.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-await-in-loop'>;
}
declare module 'eslint/lib/rules/no-bitwise.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-bitwise'>;
}
declare module 'eslint/lib/rules/no-buffer-constructor.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-buffer-constructor'>;
}
declare module 'eslint/lib/rules/no-caller.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-caller'>;
}
declare module 'eslint/lib/rules/no-case-declarations.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-case-declarations'>;
}
declare module 'eslint/lib/rules/no-catch-shadow.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-catch-shadow'>;
}
declare module 'eslint/lib/rules/no-class-assign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-class-assign'>;
}
declare module 'eslint/lib/rules/no-compare-neg-zero.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-compare-neg-zero'>;
}
declare module 'eslint/lib/rules/no-cond-assign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-cond-assign'>;
}
declare module 'eslint/lib/rules/no-confusing-arrow.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-confusing-arrow'>;
}
declare module 'eslint/lib/rules/no-console.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-console'>;
}
declare module 'eslint/lib/rules/no-const-assign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-const-assign'>;
}
declare module 'eslint/lib/rules/no-constant-condition.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-constant-condition'>;
}
declare module 'eslint/lib/rules/no-constructor-return.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-constructor-return'>;
}
declare module 'eslint/lib/rules/no-continue.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-continue'>;
}
declare module 'eslint/lib/rules/no-control-regex.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-control-regex'>;
}
declare module 'eslint/lib/rules/no-debugger.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-debugger'>;
}
declare module 'eslint/lib/rules/no-delete-var.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-delete-var'>;
}
declare module 'eslint/lib/rules/no-div-regex.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-div-regex'>;
}
declare module 'eslint/lib/rules/no-dupe-args.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-dupe-args'>;
}
declare module 'eslint/lib/rules/no-dupe-class-members.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-dupe-class-members'>;
}
declare module 'eslint/lib/rules/no-dupe-else-if.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-dupe-else-if'>;
}
declare module 'eslint/lib/rules/no-dupe-keys.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-dupe-keys'>;
}
declare module 'eslint/lib/rules/no-duplicate-case.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-duplicate-case'>;
}
declare module 'eslint/lib/rules/no-duplicate-imports.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-duplicate-imports'>;
}
declare module 'eslint/lib/rules/no-else-return.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-else-return'>;
}
declare module 'eslint/lib/rules/no-empty-character-class.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-empty-character-class'>;
}
declare module 'eslint/lib/rules/no-empty-function.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-empty-function'>;
}
declare module 'eslint/lib/rules/no-empty-pattern.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-empty-pattern'>;
}
declare module 'eslint/lib/rules/no-empty.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-empty'>;
}
declare module 'eslint/lib/rules/no-eq-null.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-eq-null'>;
}
declare module 'eslint/lib/rules/no-eval.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-eval'>;
}
declare module 'eslint/lib/rules/no-ex-assign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-ex-assign'>;
}
declare module 'eslint/lib/rules/no-extend-native.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-extend-native'>;
}
declare module 'eslint/lib/rules/no-extra-bind.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-extra-bind'>;
}
declare module 'eslint/lib/rules/no-extra-boolean-cast.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-extra-boolean-cast'>;
}
declare module 'eslint/lib/rules/no-extra-label.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-extra-label'>;
}
declare module 'eslint/lib/rules/no-extra-parens.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-extra-parens'>;
}
declare module 'eslint/lib/rules/no-extra-semi.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-extra-semi'>;
}
declare module 'eslint/lib/rules/no-fallthrough.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-fallthrough'>;
}
declare module 'eslint/lib/rules/no-floating-decimal.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-floating-decimal'>;
}
declare module 'eslint/lib/rules/no-func-assign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-func-assign'>;
}
declare module 'eslint/lib/rules/no-global-assign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-global-assign'>;
}
declare module 'eslint/lib/rules/no-implicit-coercion.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-implicit-coercion'>;
}
declare module 'eslint/lib/rules/no-implicit-globals.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-implicit-globals'>;
}
declare module 'eslint/lib/rules/no-implied-eval.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-implied-eval'>;
}
declare module 'eslint/lib/rules/no-import-assign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-import-assign'>;
}
declare module 'eslint/lib/rules/no-inline-comments.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-inline-comments'>;
}
declare module 'eslint/lib/rules/no-inner-declarations.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-inner-declarations'>;
}
declare module 'eslint/lib/rules/no-invalid-regexp.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-invalid-regexp'>;
}
declare module 'eslint/lib/rules/no-invalid-this.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-invalid-this'>;
}
declare module 'eslint/lib/rules/no-irregular-whitespace.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-irregular-whitespace'>;
}
declare module 'eslint/lib/rules/no-iterator.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-iterator'>;
}
declare module 'eslint/lib/rules/no-label-var.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-label-var'>;
}
declare module 'eslint/lib/rules/no-labels.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-labels'>;
}
declare module 'eslint/lib/rules/no-lone-blocks.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-lone-blocks'>;
}
declare module 'eslint/lib/rules/no-lonely-if.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-lonely-if'>;
}
declare module 'eslint/lib/rules/no-loop-func.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-loop-func'>;
}
declare module 'eslint/lib/rules/no-loss-of-precision.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-loss-of-precision'>;
}
declare module 'eslint/lib/rules/no-magic-numbers.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-magic-numbers'>;
}
declare module 'eslint/lib/rules/no-misleading-character-class.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-misleading-character-class'>;
}
declare module 'eslint/lib/rules/no-mixed-operators.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-mixed-operators'>;
}
declare module 'eslint/lib/rules/no-mixed-requires.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-mixed-requires'>;
}
declare module 'eslint/lib/rules/no-mixed-spaces-and-tabs.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-mixed-spaces-and-tabs'>;
}
declare module 'eslint/lib/rules/no-multi-assign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-multi-assign'>;
}
declare module 'eslint/lib/rules/no-multi-spaces.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-multi-spaces'>;
}
declare module 'eslint/lib/rules/no-multi-str.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-multi-str'>;
}
declare module 'eslint/lib/rules/no-multiple-empty-lines.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-multiple-empty-lines'>;
}
declare module 'eslint/lib/rules/no-native-reassign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-native-reassign'>;
}
declare module 'eslint/lib/rules/no-negated-condition.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-negated-condition'>;
}
declare module 'eslint/lib/rules/no-negated-in-lhs.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-negated-in-lhs'>;
}
declare module 'eslint/lib/rules/no-nested-ternary.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-nested-ternary'>;
}
declare module 'eslint/lib/rules/no-new-func.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-new-func'>;
}
declare module 'eslint/lib/rules/no-new-object.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-new-object'>;
}
declare module 'eslint/lib/rules/no-new-require.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-new-require'>;
}
declare module 'eslint/lib/rules/no-new-symbol.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-new-symbol'>;
}
declare module 'eslint/lib/rules/no-new-wrappers.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-new-wrappers'>;
}
declare module 'eslint/lib/rules/no-new.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-new'>;
}
declare module 'eslint/lib/rules/no-nonoctal-decimal-escape.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-nonoctal-decimal-escape'>;
}
declare module 'eslint/lib/rules/no-obj-calls.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-obj-calls'>;
}
declare module 'eslint/lib/rules/no-octal-escape.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-octal-escape'>;
}
declare module 'eslint/lib/rules/no-octal.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-octal'>;
}
declare module 'eslint/lib/rules/no-param-reassign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-param-reassign'>;
}
declare module 'eslint/lib/rules/no-path-concat.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-path-concat'>;
}
declare module 'eslint/lib/rules/no-plusplus.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-plusplus'>;
}
declare module 'eslint/lib/rules/no-process-env.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-process-env'>;
}
declare module 'eslint/lib/rules/no-process-exit.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-process-exit'>;
}
declare module 'eslint/lib/rules/no-promise-executor-return.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-promise-executor-return'>;
}
declare module 'eslint/lib/rules/no-proto.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-proto'>;
}
declare module 'eslint/lib/rules/no-prototype-builtins.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-prototype-builtins'>;
}
declare module 'eslint/lib/rules/no-redeclare.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-redeclare'>;
}
declare module 'eslint/lib/rules/no-regex-spaces.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-regex-spaces'>;
}
declare module 'eslint/lib/rules/no-restricted-exports.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-restricted-exports'>;
}
declare module 'eslint/lib/rules/no-restricted-globals.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-restricted-globals'>;
}
declare module 'eslint/lib/rules/no-restricted-imports.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-restricted-imports'>;
}
declare module 'eslint/lib/rules/no-restricted-modules.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-restricted-modules'>;
}
declare module 'eslint/lib/rules/no-restricted-properties.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-restricted-properties'>;
}
declare module 'eslint/lib/rules/no-restricted-syntax.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-restricted-syntax'>;
}
declare module 'eslint/lib/rules/no-return-assign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-return-assign'>;
}
declare module 'eslint/lib/rules/no-return-await.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-return-await'>;
}
declare module 'eslint/lib/rules/no-script-url.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-script-url'>;
}
declare module 'eslint/lib/rules/no-self-assign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-self-assign'>;
}
declare module 'eslint/lib/rules/no-self-compare.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-self-compare'>;
}
declare module 'eslint/lib/rules/no-sequences.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-sequences'>;
}
declare module 'eslint/lib/rules/no-setter-return.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-setter-return'>;
}
declare module 'eslint/lib/rules/no-shadow-restricted-names.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-shadow-restricted-names'>;
}
declare module 'eslint/lib/rules/no-shadow.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-shadow'>;
}
declare module 'eslint/lib/rules/no-spaced-func.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-spaced-func'>;
}
declare module 'eslint/lib/rules/no-sparse-arrays.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-sparse-arrays'>;
}
declare module 'eslint/lib/rules/no-sync.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-sync'>;
}
declare module 'eslint/lib/rules/no-tabs.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-tabs'>;
}
declare module 'eslint/lib/rules/no-template-curly-in-string.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-template-curly-in-string'>;
}
declare module 'eslint/lib/rules/no-ternary.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-ternary'>;
}
declare module 'eslint/lib/rules/no-this-before-super.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-this-before-super'>;
}
declare module 'eslint/lib/rules/no-throw-literal.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-throw-literal'>;
}
declare module 'eslint/lib/rules/no-trailing-spaces.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-trailing-spaces'>;
}
declare module 'eslint/lib/rules/no-undef-init.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-undef-init'>;
}
declare module 'eslint/lib/rules/no-undef.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-undef'>;
}
declare module 'eslint/lib/rules/no-undefined.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-undefined'>;
}
declare module 'eslint/lib/rules/no-underscore-dangle.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-underscore-dangle'>;
}
declare module 'eslint/lib/rules/no-unexpected-multiline.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-unexpected-multiline'>;
}
declare module 'eslint/lib/rules/no-unmodified-loop-condition.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-unmodified-loop-condition'>;
}
declare module 'eslint/lib/rules/no-unneeded-ternary.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-unneeded-ternary'>;
}
declare module 'eslint/lib/rules/no-unreachable-loop.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-unreachable-loop'>;
}
declare module 'eslint/lib/rules/no-unreachable.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-unreachable'>;
}
declare module 'eslint/lib/rules/no-unsafe-finally.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-unsafe-finally'>;
}
declare module 'eslint/lib/rules/no-unsafe-negation.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-unsafe-negation'>;
}
declare module 'eslint/lib/rules/no-unsafe-optional-chaining.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-unsafe-optional-chaining'>;
}
declare module 'eslint/lib/rules/no-unused-expressions.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-unused-expressions'>;
}
declare module 'eslint/lib/rules/no-unused-labels.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-unused-labels'>;
}
declare module 'eslint/lib/rules/no-unused-vars.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-unused-vars'>;
}
declare module 'eslint/lib/rules/no-use-before-define.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-use-before-define'>;
}
declare module 'eslint/lib/rules/no-useless-backreference.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-useless-backreference'>;
}
declare module 'eslint/lib/rules/no-useless-call.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-useless-call'>;
}
declare module 'eslint/lib/rules/no-useless-catch.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-useless-catch'>;
}
declare module 'eslint/lib/rules/no-useless-computed-key.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-useless-computed-key'>;
}
declare module 'eslint/lib/rules/no-useless-concat.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-useless-concat'>;
}
declare module 'eslint/lib/rules/no-useless-constructor.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-useless-constructor'>;
}
declare module 'eslint/lib/rules/no-useless-escape.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-useless-escape'>;
}
declare module 'eslint/lib/rules/no-useless-rename.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-useless-rename'>;
}
declare module 'eslint/lib/rules/no-useless-return.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-useless-return'>;
}
declare module 'eslint/lib/rules/no-var.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-var'>;
}
declare module 'eslint/lib/rules/no-void.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-void'>;
}
declare module 'eslint/lib/rules/no-warning-comments.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-warning-comments'>;
}
declare module 'eslint/lib/rules/no-whitespace-before-property.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-whitespace-before-property'>;
}
declare module 'eslint/lib/rules/no-with.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-with'>;
}
declare module 'eslint/lib/rules/nonblock-statement-body-position.js' {
declare module.exports: $Exports<'eslint/lib/rules/nonblock-statement-body-position'>;
}
declare module 'eslint/lib/rules/object-curly-newline.js' {
declare module.exports: $Exports<'eslint/lib/rules/object-curly-newline'>;
}
declare module 'eslint/lib/rules/object-curly-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/object-curly-spacing'>;
}
declare module 'eslint/lib/rules/object-property-newline.js' {
declare module.exports: $Exports<'eslint/lib/rules/object-property-newline'>;
}
declare module 'eslint/lib/rules/object-shorthand.js' {
declare module.exports: $Exports<'eslint/lib/rules/object-shorthand'>;
}
declare module 'eslint/lib/rules/one-var-declaration-per-line.js' {
declare module.exports: $Exports<'eslint/lib/rules/one-var-declaration-per-line'>;
}
declare module 'eslint/lib/rules/one-var.js' {
declare module.exports: $Exports<'eslint/lib/rules/one-var'>;
}
declare module 'eslint/lib/rules/operator-assignment.js' {
declare module.exports: $Exports<'eslint/lib/rules/operator-assignment'>;
}
declare module 'eslint/lib/rules/operator-linebreak.js' {
declare module.exports: $Exports<'eslint/lib/rules/operator-linebreak'>;
}
declare module 'eslint/lib/rules/padded-blocks.js' {
declare module.exports: $Exports<'eslint/lib/rules/padded-blocks'>;
}
declare module 'eslint/lib/rules/padding-line-between-statements.js' {
declare module.exports: $Exports<'eslint/lib/rules/padding-line-between-statements'>;
}
declare module 'eslint/lib/rules/prefer-arrow-callback.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-arrow-callback'>;
}
declare module 'eslint/lib/rules/prefer-const.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-const'>;
}
declare module 'eslint/lib/rules/prefer-destructuring.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-destructuring'>;
}
declare module 'eslint/lib/rules/prefer-exponentiation-operator.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-exponentiation-operator'>;
}
declare module 'eslint/lib/rules/prefer-named-capture-group.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-named-capture-group'>;
}
declare module 'eslint/lib/rules/prefer-numeric-literals.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-numeric-literals'>;
}
declare module 'eslint/lib/rules/prefer-object-spread.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-object-spread'>;
}
declare module 'eslint/lib/rules/prefer-promise-reject-errors.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-promise-reject-errors'>;
}
declare module 'eslint/lib/rules/prefer-reflect.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-reflect'>;
}
declare module 'eslint/lib/rules/prefer-regex-literals.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-regex-literals'>;
}
declare module 'eslint/lib/rules/prefer-rest-params.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-rest-params'>;
}
declare module 'eslint/lib/rules/prefer-spread.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-spread'>;
}
declare module 'eslint/lib/rules/prefer-template.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-template'>;
}
declare module 'eslint/lib/rules/quote-props.js' {
declare module.exports: $Exports<'eslint/lib/rules/quote-props'>;
}
declare module 'eslint/lib/rules/quotes.js' {
declare module.exports: $Exports<'eslint/lib/rules/quotes'>;
}
declare module 'eslint/lib/rules/radix.js' {
declare module.exports: $Exports<'eslint/lib/rules/radix'>;
}
declare module 'eslint/lib/rules/require-atomic-updates.js' {
declare module.exports: $Exports<'eslint/lib/rules/require-atomic-updates'>;
}
declare module 'eslint/lib/rules/require-await.js' {
declare module.exports: $Exports<'eslint/lib/rules/require-await'>;
}
declare module 'eslint/lib/rules/require-jsdoc.js' {
declare module.exports: $Exports<'eslint/lib/rules/require-jsdoc'>;
}
declare module 'eslint/lib/rules/require-unicode-regexp.js' {
declare module.exports: $Exports<'eslint/lib/rules/require-unicode-regexp'>;
}
declare module 'eslint/lib/rules/require-yield.js' {
declare module.exports: $Exports<'eslint/lib/rules/require-yield'>;
}
declare module 'eslint/lib/rules/rest-spread-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/rest-spread-spacing'>;
}
declare module 'eslint/lib/rules/semi-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/semi-spacing'>;
}
declare module 'eslint/lib/rules/semi-style.js' {
declare module.exports: $Exports<'eslint/lib/rules/semi-style'>;
}
declare module 'eslint/lib/rules/semi.js' {
declare module.exports: $Exports<'eslint/lib/rules/semi'>;
}
declare module 'eslint/lib/rules/sort-imports.js' {
declare module.exports: $Exports<'eslint/lib/rules/sort-imports'>;
}
declare module 'eslint/lib/rules/sort-keys.js' {
declare module.exports: $Exports<'eslint/lib/rules/sort-keys'>;
}
declare module 'eslint/lib/rules/sort-vars.js' {
declare module.exports: $Exports<'eslint/lib/rules/sort-vars'>;
}
declare module 'eslint/lib/rules/space-before-blocks.js' {
declare module.exports: $Exports<'eslint/lib/rules/space-before-blocks'>;
}
declare module 'eslint/lib/rules/space-before-function-paren.js' {
declare module.exports: $Exports<'eslint/lib/rules/space-before-function-paren'>;
}
declare module 'eslint/lib/rules/space-in-parens.js' {
declare module.exports: $Exports<'eslint/lib/rules/space-in-parens'>;
}
declare module 'eslint/lib/rules/space-infix-ops.js' {
declare module.exports: $Exports<'eslint/lib/rules/space-infix-ops'>;
}
declare module 'eslint/lib/rules/space-unary-ops.js' {
declare module.exports: $Exports<'eslint/lib/rules/space-unary-ops'>;
}
declare module 'eslint/lib/rules/spaced-comment.js' {
declare module.exports: $Exports<'eslint/lib/rules/spaced-comment'>;
}
declare module 'eslint/lib/rules/strict.js' {
declare module.exports: $Exports<'eslint/lib/rules/strict'>;
}
declare module 'eslint/lib/rules/switch-colon-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/switch-colon-spacing'>;
}
declare module 'eslint/lib/rules/symbol-description.js' {
declare module.exports: $Exports<'eslint/lib/rules/symbol-description'>;
}
declare module 'eslint/lib/rules/template-curly-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/template-curly-spacing'>;
}
declare module 'eslint/lib/rules/template-tag-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/template-tag-spacing'>;
}
declare module 'eslint/lib/rules/unicode-bom.js' {
declare module.exports: $Exports<'eslint/lib/rules/unicode-bom'>;
}
declare module 'eslint/lib/rules/use-isnan.js' {
declare module.exports: $Exports<'eslint/lib/rules/use-isnan'>;
}
declare module 'eslint/lib/rules/utils/ast-utils.js' {
declare module.exports: $Exports<'eslint/lib/rules/utils/ast-utils'>;
}
declare module 'eslint/lib/rules/utils/fix-tracker.js' {
declare module.exports: $Exports<'eslint/lib/rules/utils/fix-tracker'>;
}
declare module 'eslint/lib/rules/utils/keywords.js' {
declare module.exports: $Exports<'eslint/lib/rules/utils/keywords'>;
}
declare module 'eslint/lib/rules/utils/lazy-loading-rule-map.js' {
declare module.exports: $Exports<'eslint/lib/rules/utils/lazy-loading-rule-map'>;
}
declare module 'eslint/lib/rules/utils/patterns/letters.js' {
declare module.exports: $Exports<'eslint/lib/rules/utils/patterns/letters'>;
}
declare module 'eslint/lib/rules/utils/unicode/index.js' {
declare module.exports: $Exports<'eslint/lib/rules/utils/unicode/index'>;
}
declare module 'eslint/lib/rules/utils/unicode/is-combining-character.js' {
declare module.exports: $Exports<'eslint/lib/rules/utils/unicode/is-combining-character'>;
}
declare module 'eslint/lib/rules/utils/unicode/is-emoji-modifier.js' {
declare module.exports: $Exports<'eslint/lib/rules/utils/unicode/is-emoji-modifier'>;
}
declare module 'eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js' {
declare module.exports: $Exports<'eslint/lib/rules/utils/unicode/is-regional-indicator-symbol'>;
}
declare module 'eslint/lib/rules/utils/unicode/is-surrogate-pair.js' {
declare module.exports: $Exports<'eslint/lib/rules/utils/unicode/is-surrogate-pair'>;
}
declare module 'eslint/lib/rules/valid-jsdoc.js' {
declare module.exports: $Exports<'eslint/lib/rules/valid-jsdoc'>;
}
declare module 'eslint/lib/rules/valid-typeof.js' {
declare module.exports: $Exports<'eslint/lib/rules/valid-typeof'>;
}
declare module 'eslint/lib/rules/vars-on-top.js' {
declare module.exports: $Exports<'eslint/lib/rules/vars-on-top'>;
}
declare module 'eslint/lib/rules/wrap-iife.js' {
declare module.exports: $Exports<'eslint/lib/rules/wrap-iife'>;
}
declare module 'eslint/lib/rules/wrap-regex.js' {
declare module.exports: $Exports<'eslint/lib/rules/wrap-regex'>;
}
declare module 'eslint/lib/rules/yield-star-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/yield-star-spacing'>;
}
declare module 'eslint/lib/rules/yoda.js' {
declare module.exports: $Exports<'eslint/lib/rules/yoda'>;
}
declare module 'eslint/lib/shared/ajv.js' {
declare module.exports: $Exports<'eslint/lib/shared/ajv'>;
}
declare module 'eslint/lib/shared/ast-utils.js' {
declare module.exports: $Exports<'eslint/lib/shared/ast-utils'>;
}
declare module 'eslint/lib/shared/config-validator.js' {
declare module.exports: $Exports<'eslint/lib/shared/config-validator'>;
}
declare module 'eslint/lib/shared/deprecation-warnings.js' {
declare module.exports: $Exports<'eslint/lib/shared/deprecation-warnings'>;
}
declare module 'eslint/lib/shared/logging.js' {
declare module.exports: $Exports<'eslint/lib/shared/logging'>;
}
declare module 'eslint/lib/shared/relative-module-resolver.js' {
declare module.exports: $Exports<'eslint/lib/shared/relative-module-resolver'>;
}
declare module 'eslint/lib/shared/runtime-info.js' {
declare module.exports: $Exports<'eslint/lib/shared/runtime-info'>;
}
declare module 'eslint/lib/shared/string-utils.js' {
declare module.exports: $Exports<'eslint/lib/shared/string-utils'>;
}
declare module 'eslint/lib/shared/traverser.js' {
declare module.exports: $Exports<'eslint/lib/shared/traverser'>;
}
declare module 'eslint/lib/shared/types.js' {
declare module.exports: $Exports<'eslint/lib/shared/types'>;
}
declare module 'eslint/lib/source-code/index.js' {
declare module.exports: $Exports<'eslint/lib/source-code/index'>;
}
declare module 'eslint/lib/source-code/source-code.js' {
declare module.exports: $Exports<'eslint/lib/source-code/source-code'>;
}
declare module 'eslint/lib/source-code/token-store/backward-token-comment-cursor.js' {
declare module.exports: $Exports<'eslint/lib/source-code/token-store/backward-token-comment-cursor'>;
}
declare module 'eslint/lib/source-code/token-store/backward-token-cursor.js' {
declare module.exports: $Exports<'eslint/lib/source-code/token-store/backward-token-cursor'>;
}
declare module 'eslint/lib/source-code/token-store/cursor.js' {
declare module.exports: $Exports<'eslint/lib/source-code/token-store/cursor'>;
}
declare module 'eslint/lib/source-code/token-store/cursors.js' {
declare module.exports: $Exports<'eslint/lib/source-code/token-store/cursors'>;
}
declare module 'eslint/lib/source-code/token-store/decorative-cursor.js' {
declare module.exports: $Exports<'eslint/lib/source-code/token-store/decorative-cursor'>;
}
declare module 'eslint/lib/source-code/token-store/filter-cursor.js' {
declare module.exports: $Exports<'eslint/lib/source-code/token-store/filter-cursor'>;
}
declare module 'eslint/lib/source-code/token-store/forward-token-comment-cursor.js' {
declare module.exports: $Exports<'eslint/lib/source-code/token-store/forward-token-comment-cursor'>;
}
declare module 'eslint/lib/source-code/token-store/forward-token-cursor.js' {
declare module.exports: $Exports<'eslint/lib/source-code/token-store/forward-token-cursor'>;
}
declare module 'eslint/lib/source-code/token-store/index.js' {
declare module.exports: $Exports<'eslint/lib/source-code/token-store/index'>;
}
declare module 'eslint/lib/source-code/token-store/limit-cursor.js' {
declare module.exports: $Exports<'eslint/lib/source-code/token-store/limit-cursor'>;
}
declare module 'eslint/lib/source-code/token-store/padded-token-cursor.js' {
declare module.exports: $Exports<'eslint/lib/source-code/token-store/padded-token-cursor'>;
}
declare module 'eslint/lib/source-code/token-store/skip-cursor.js' {
declare module.exports: $Exports<'eslint/lib/source-code/token-store/skip-cursor'>;
}
declare module 'eslint/lib/source-code/token-store/utils.js' {
declare module.exports: $Exports<'eslint/lib/source-code/token-store/utils'>;
}
declare module 'eslint/messages/all-files-ignored.js' {
declare module.exports: $Exports<'eslint/messages/all-files-ignored'>;
}
declare module 'eslint/messages/extend-config-missing.js' {
declare module.exports: $Exports<'eslint/messages/extend-config-missing'>;
}
declare module 'eslint/messages/failed-to-read-json.js' {
declare module.exports: $Exports<'eslint/messages/failed-to-read-json'>;
}
declare module 'eslint/messages/file-not-found.js' {
declare module.exports: $Exports<'eslint/messages/file-not-found'>;
}
declare module 'eslint/messages/no-config-found.js' {
declare module.exports: $Exports<'eslint/messages/no-config-found'>;
}
declare module 'eslint/messages/plugin-conflict.js' {
declare module.exports: $Exports<'eslint/messages/plugin-conflict'>;
}
declare module 'eslint/messages/plugin-invalid.js' {
declare module.exports: $Exports<'eslint/messages/plugin-invalid'>;
}
declare module 'eslint/messages/plugin-missing.js' {
declare module.exports: $Exports<'eslint/messages/plugin-missing'>;
}
declare module 'eslint/messages/print-config-with-directory-path.js' {
declare module.exports: $Exports<'eslint/messages/print-config-with-directory-path'>;
}
declare module 'eslint/messages/whitespace-found.js' {
declare module.exports: $Exports<'eslint/messages/whitespace-found'>;
}
| vlki/refresh-fetch | flow-typed/npm/eslint_vx.x.x.js | JavaScript | mit | 86,821 |
'use strict';
var request = require('request');
var fs = require('fs');
var wallpaper = require('wallpaper');
var DailyWallpaper = function () {};
DailyWallpaper.prototype = {
constructor: DailyWallpaper,
directory: '',
showNotification: false,
/**
* Set the directory if it exists
* @param {String} directoryPath
* @param {function} onDirectorySet Called when the directory is set
* with an optionnal error in parameter
*/
setDirectory: function (directoryPath) {
this.directory = directoryPath;
},
/**
* Set the wallpaper of the day
* @param {function} done Called when done (with optional error)
*/
setDailyWallpaper: function (done) {
done = done || function () {};
this._getWallpaperPath(function (err, wallpaperPath) {
if (err) {
return done(err);
}
wallpaper.set(wallpaperPath, function (err) {
if (err) {
return done(new Error('Error while setting the wallpaper from ' + wallpaperPath));
}
return done();
});
});
},
/**
* Get the daily wallpaper path from this.getWallpaperSource
*/
_getWallpaperPath: function (done) {
if (!this.getWallpaperSource) {
return done(new Error('DailyWallpaper.getWallpaperSource must be implemented'));
}
this.getWallpaperSource(function (err, wallpaperSource) {
if (err) {
return done(new Error('Error while getting the wallpaper of the day'));
}
if (!wallpaperSource || (!wallpaperSource.url && !wallpaperSource.path)) {
return done(new Error('Wallpaper source is not set'));
}
// If the source is a remote one, we download the file
if (wallpaperSource.url) {
if (!this.directory) {
return done(new Error('Directory is not set'));
}
if (!fs.existsSync(this.directory)) {
return done(new Error('Directory "' + this.directory + '" doesn\'t exist'));
}
this._downloadWallpaper(wallpaperSource, function (err, filePath) {
if (err) {
return done(new Error('Error while downloading the wallpaper at ' + wallpaperSource.url));
}
return done(null, filePath);
});
}
else {
if (!fs.existsSync(wallpaperSource.path)) {
return done(new Error('The wallpaper file doesn\'t exist at ' + wallpaperSource.path));
}
return done(null, wallpaperSource.path);
}
}.bind(this));
},
/**
* Download the daily wallpaper in the wallpaper directory
* @param {function} done Called when the download is done (with an optionnal error)
* and filePath as second parameter
*/
_downloadWallpaper: function (wallpaperSource, done) {
var fileName = new Date().toISOString().substr(0, 10) + '.' + (wallpaperSource.extension || '.jpg');
var filePath = this.directory + '/' + fileName;
request.head(wallpaperSource.url, function(err) {
if (err) {
return done(err);
}
request(wallpaperSource.url)
.pipe(fs.createWriteStream(filePath))
.on('close', function () {
return done(null, filePath);
})
.on('error', function (err) {
return done(err);
})
;
});
},
};
module.exports = DailyWallpaper;
| dorian-marchal/daily-wallpaper | lib/daily-wallpaper.js | JavaScript | mit | 3,854 |
import _ from 'lodash'
import assert from 'power-assert'
import Router from '..'
import './node'
function createFunc(name) {
var a = `(function ${name||''}(){})`
return eval(a)
}
const api = [
["GET", "/"],
["GET", "/c"],
["GET", "/cm"],
["GET", "/cmd"],
["GET", "/cmd.html"],
["GET", "/code.html"],
["GET", "/contrib.html"],
["GET", "/contribute.html"],
["GET", "/debugging_with_gdb.html"],
["GET", "/docs.html"],
["GET", "/effective_go.html"],
["GET", "/files.log"],
["GET", "/gccgo_contribute.html"],
["GET", "/gccgo_install.html"],
["GET", "/go-logo-black.png"],
["GET", "/go-logo-blue.png"],
["GET", "/go-logo-white.png"],
["GET", "/go1.1.html"],
["GET", "/go1.2.html"],
["GET", "/go1.html"],
["GET", "/go1compat.html"],
["GET", "/go_faq.html"],
["GET", "/go_mem.html"],
["GET", "/go_spec.html"],
["GET", "/help.html"],
["GET", "/ie.css"],
["GET", "/install-source.html"],
["GET", "/install.html"],
["GET", "/logo-153x55.png"],
["GET", "/Makefile"],
["GET", "/root.html"],
["GET", "/share.png"],
["GET", "/sieve.gif"],
["GET", "/tos.html"],
["GET", "/articles/"],
["GET", "/articles/go_command.html"],
["GET", "/articles/index.html"],
["GET", "/articles/wiki/"],
["GET", "/articles/wiki/edit.html"],
["GET", "/articles/wiki/final-noclosure.go"],
["GET", "/articles/wiki/final-noerror.go"],
["GET", "/articles/wiki/final-parsetemplate.go"],
["GET", "/articles/wiki/final-template.go"],
["GET", "/articles/wiki/final.go"],
["GET", "/articles/wiki/get.go"],
["GET", "/articles/wiki/http-sample.go"],
["GET", "/articles/wiki/index.html"],
["GET", "/articles/wiki/Makefile"],
["GET", "/articles/wiki/notemplate.go"],
["GET", "/articles/wiki/part1-noerror.go"],
["GET", "/articles/wiki/part1.go"],
["GET", "/articles/wiki/part2.go"],
["GET", "/articles/wiki/part3-errorhandling.go"],
["GET", "/articles/wiki/part3.go"],
["GET", "/articles/wiki/test.bash"],
["GET", "/articles/wiki/test_edit.good"],
["GET", "/articles/wiki/test_Test.txt.good"],
["GET", "/articles/wiki/test_view.good"],
["GET", "/articles/wiki/view.html"],
["GET", "/codewalk/"],
["GET", "/codewalk/codewalk.css"],
["GET", "/codewalk/codewalk.js"],
["GET", "/codewalk/codewalk.xml"],
["GET", "/codewalk/functions.xml"],
["GET", "/codewalk/markov.go"],
["GET", "/codewalk/markov.xml"],
["GET", "/codewalk/pig.go"],
["GET", "/codewalk/popout.png"],
["GET", "/codewalk/run"],
["GET", "/codewalk/sharemem.xml"],
["GET", "/codewalk/urlpoll.go"],
["GET", "/devel/"],
["GET", "/devel/release.html"],
["GET", "/devel/weekly.html"],
["GET", "/gopher/"],
["GET", "/gopher/appenginegopher.jpg"],
["GET", "/gopher/appenginegophercolor.jpg"],
["GET", "/gopher/appenginelogo.gif"],
["GET", "/gopher/bumper.png"],
["GET", "/gopher/bumper192x108.png"],
["GET", "/gopher/bumper320x180.png"],
["GET", "/gopher/bumper480x270.png"],
["GET", "/gopher/bumper640x360.png"],
["GET", "/gopher/doc.png"],
["GET", "/gopher/frontpage.png"],
["GET", "/gopher/gopherbw.png"],
["GET", "/gopher/gophercolor.png"],
["GET", "/gopher/gophercolor16x16.png"],
["GET", "/gopher/help.png"],
["GET", "/gopher/pkg.png"],
["GET", "/gopher/project.png"],
["GET", "/gopher/ref.png"],
["GET", "/gopher/run.png"],
["GET", "/gopher/talks.png"],
["GET", "/gopher/pencil/"],
["GET", "/gopher/pencil/gopherhat.jpg"],
["GET", "/gopher/pencil/gopherhelmet.jpg"],
["GET", "/gopher/pencil/gophermega.jpg"],
["GET", "/gopher/pencil/gopherrunning.jpg"],
["GET", "/gopher/pencil/gopherswim.jpg"],
["GET", "/gopher/pencil/gopherswrench.jpg"],
["GET", "/play/"],
["GET", "/play/fib.go"],
["GET", "/play/hello.go"],
["GET", "/play/life.go"],
["GET", "/play/peano.go"],
["GET", "/play/pi.go"],
["GET", "/play/sieve.go"],
["GET", "/play/solitaire.go"],
["GET", "/play/tree.go"],
["GET", "/progs/"],
["GET", "/progs/cgo1.go"],
["GET", "/progs/cgo2.go"],
["GET", "/progs/cgo3.go"],
["GET", "/progs/cgo4.go"],
["GET", "/progs/defer.go"],
["GET", "/progs/defer.out"],
["GET", "/progs/defer2.go"],
["GET", "/progs/defer2.out"],
["GET", "/progs/eff_bytesize.go"],
["GET", "/progs/eff_bytesize.out"],
["GET", "/progs/eff_qr.go"],
["GET", "/progs/eff_sequence.go"],
["GET", "/progs/eff_sequence.out"],
["GET", "/progs/eff_unused1.go"],
["GET", "/progs/eff_unused2.go"],
["GET", "/progs/error.go"],
["GET", "/progs/error2.go"],
["GET", "/progs/error3.go"],
["GET", "/progs/error4.go"],
["GET", "/progs/go1.go"],
["GET", "/progs/gobs1.go"],
["GET", "/progs/gobs2.go"],
["GET", "/progs/image_draw.go"],
["GET", "/progs/image_package1.go"],
["GET", "/progs/image_package1.out"],
["GET", "/progs/image_package2.go"],
["GET", "/progs/image_package2.out"],
["GET", "/progs/image_package3.go"],
["GET", "/progs/image_package3.out"],
["GET", "/progs/image_package4.go"],
["GET", "/progs/image_package4.out"],
["GET", "/progs/image_package5.go"],
["GET", "/progs/image_package5.out"],
["GET", "/progs/image_package6.go"],
["GET", "/progs/image_package6.out"],
["GET", "/progs/interface.go"],
["GET", "/progs/interface2.go"],
["GET", "/progs/interface2.out"],
["GET", "/progs/json1.go"],
["GET", "/progs/json2.go"],
["GET", "/progs/json2.out"],
["GET", "/progs/json3.go"],
["GET", "/progs/json4.go"],
["GET", "/progs/json5.go"],
["GET", "/progs/run"],
["GET", "/progs/slices.go"],
["GET", "/progs/timeout1.go"],
["GET", "/progs/timeout2.go"],
["GET", "/progs/update.bash"],
]
let funcPrefx = 'static-api'
describe('Router', () => {
let r, result
beforeEach(() => {
r = new Router()
_.shuffle(api).forEach((i) => {
let [method, path] = i
r.add(method, path, createFunc(_.camelCase(funcPrefx + path)))
})
})
_.shuffle(api).forEach((i) => {
let [method, path] = i
it(path, () => {
let [handler, params] = r.find(method, path)
// console.log(path, handler, params)
assert.notEqual(null, handler)
assert.equal(_.camelCase(funcPrefx + path), handler.name)
assert.equal((path.match(/\:/g) || []).length, params.length)
})
})
})
| trekjs/router | test/static.test.js | JavaScript | mit | 6,212 |
/**
* Created by ForeverW on 2017/5/15.
*/
var app = angular.module("dailyCommunicationApp", [], function(){
});
app.controller("dailyCommunicationController", [ '$scope', function($scope){
}]); | KuangPF/mySport | public/controllers/dailyCommunicationCtrl.js | JavaScript | mit | 199 |
import React from 'react'
import { connect } from 'react-redux'
import { Link } from 'react-router-dom'
import moment from 'moment'
import { isEmpty, map, find } from 'lodash'
import { addNewComment, getCommentByPost, getDeleteComment } from '../../actions/comment'
import { addNewVote, getVoteByPost, getDeleteVote } from '../../actions/vote'
import CommentForm from '../../components/comment/CommentForm'
class PostList extends React.Component {
constructor(props) {
super(props)
this.state = {
vote: false
}
this.addVote = this.addVote.bind(this)
this.deleteVote = this.deleteVote.bind(this)
}
componentWillMount() {
this.props.getCommentByPost()
this.props.getVoteByPost()
}
deleteComment(e) {
this.props.getDeleteComment(this.props.currentUser.user._id, e)
}
addVote(e) {
e.preventDefault()
this.props.addNewVote(this.props.currentUser.user._id, this.props.post._id).then(() => {
this.setState({ vote: true })
})
}
deleteVote(e) {
e.preventDefault()
this.props.getDeleteVote(this.props.currentUser.user._id, this.props.post._id).then(() => {
this.setState({ vote: false })
})
}
checkVote(data) {
let voted = find(data, vote => {
return vote.user_id[0]._id === this.props.currentUser.user._id && vote.post_id[0] === this.props.post._id
})
return {
voted: !isEmpty(voted)
}
}
render() {
const { post, currentUser, comments, addNewComment } = this.props
const postUser = post.user_id[0]
let { voted } = this.checkVote(this.props.votes)
let votes = []
map(this.props.votes, vote => {
if (vote.post_id[0] === post._id) {
if (!isEmpty(vote)) {
votes.push(vote)
}
}
})
const commentList = (
// eslint-disable-next-line
comments.map(comment => {
if (comment.post_id[0] === post._id) {
return (
<li key={comment._id} className="_ezgzd">
<a className="_2g7d5 _95hvo" href={comment.user_id[0].username}>{comment.user_id[0].username}</a>
<span>{comment.comment}</span>
{currentUser.user._id === comment.user_id[0]._id
? <a
className="ml-2 text-danger"
title="Delete"
onClick={this.deleteComment.bind(this, comment._id)}
>
<i className="fa fa-times"></i>
</a>
: ''}
</li>
)
}
})
)
const existAvatar = (
<Link className="_pg23k _i2o1o" to={postUser.username}>
<img className="_rewi8" src={post.user_id[0].avatar} alt="" />
</Link>
)
const noAvatar = (
<Link className="_pg23k _i2o1o" to={postUser.username}>
<img className="_rewi8" src="https://res.cloudinary.com/timothybom/image/upload/v1505211426/avatar_mf1yiz.jpg" alt="" />
</Link>
)
const time = moment(post.created_at).fromNow()
return (
<article className="_s5vjd">
<header className="_7b8e">
{post.user_id[0].avatar ? existAvatar : noAvatar}
<div className="_j56ec">
<Link className="_2g7d5" to={postUser.username}>{postUser.username}</Link>
</div>
</header>
<div className="_e3il2">
<img className="_2di5" src={post.image_url} alt="" />
</div>
<div className="_ebcx">
<section className="_8oo9">
{voted === this.state.vote
? <a className="_eszk _l9yih" onClick={this.addVote}>
<i className="fa fa-heart-o fa-lg"></i>
</a>
: <a className="_eszk _l9yih" onClick={this.deleteVote}>
<i className="fa fa-heart fa-lg text-danger"></i>
</a>}
<span className="_nzn1h">{votes.length} {votes.length > 1 ? 'likes' : 'like'}</span>
</section>
<div className="_4a48i">
<ul className="_b0tqa">
<li className="_ezgzd">
<Link className="_2g7d5 _95hvo" to={postUser.username}>{postUser.username}</Link>
<span>{post.caption}</span>
</li>
{commentList}
</ul>
</div>
<div className="_ha6c6">
<time className="_p29ma">{time}</time>
</div>
<section className="_km7ip _ti7l3">
<CommentForm post={post} currentUser={currentUser} addNewComment={addNewComment} />
</section>
</div>
</article>
)
}
}
const mapStateToProps = state => {
let comments = Object.assign([], state.comments)
let votes = Object.assign([], state.votes)
return {
comments: comments,
votes: votes
}
}
export default connect(mapStateToProps, {
addNewComment,
getCommentByPost,
getDeleteComment,
addNewVote,
getVoteByPost,
getDeleteVote })(PostList) | TimothyBom/react-redux-instagram | src/pages/main/PostList.js | JavaScript | mit | 5,916 |
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @emails oncall+relay
*/
'use strict';
require('configureForRelayOSS');
const RelayConnectionHandler = require('../RelayConnectionHandler');
const RelayInMemoryRecordSource = require('../../../store/RelayInMemoryRecordSource');
const RelayModernStore = require('../../../store/RelayModernStore');
const RelayRecordSourceMutator = require('../../../mutations/RelayRecordSourceMutator');
const RelayRecordSourceProxy = require('../../../mutations/RelayRecordSourceProxy');
const RelayResponseNormalizer = require('../../../store/RelayResponseNormalizer');
const RelayStoreUtils = require('../../../store/RelayStoreUtils');
const RelayModernTestUtils = require('RelayModernTestUtils');
const RelayConnectionInterface = require('../RelayConnectionInterface');
const getRelayHandleKey = require('../../../util/getRelayHandleKey');
const simpleClone = require('../../../util/simpleClone');
const {
ID_KEY,
REF_KEY,
REFS_KEY,
ROOT_ID,
ROOT_TYPE,
TYPENAME_KEY,
getStableStorageKey,
} = RelayStoreUtils;
const {
END_CURSOR,
HAS_NEXT_PAGE,
HAS_PREV_PAGE,
PAGE_INFO,
START_CURSOR,
} = RelayConnectionInterface.get();
describe('RelayConnectionHandler', () => {
const {generateWithTransforms} = RelayModernTestUtils;
let ConnectionQuery;
let baseData;
let baseSource;
let mutator;
let proxy;
let sinkData;
let sinkSource;
function normalize(payload, variables) {
RelayResponseNormalizer.normalize(
baseSource,
{
dataID: ROOT_ID,
node: ConnectionQuery.operation,
variables,
},
payload,
);
}
beforeEach(() => {
jest.resetModules();
expect.extend(RelayModernTestUtils.matchers);
baseData = {
[ROOT_ID]: {
[ID_KEY]: ROOT_ID,
[TYPENAME_KEY]: ROOT_TYPE,
},
};
baseSource = new RelayInMemoryRecordSource(baseData);
sinkData = {};
sinkSource = new RelayInMemoryRecordSource(sinkData);
mutator = new RelayRecordSourceMutator(baseSource, sinkSource);
proxy = new RelayRecordSourceProxy(mutator);
({ConnectionQuery} = generateWithTransforms(
`
query ConnectionQuery($id: ID!, $before: ID $count: Int, $after: ID, $orderby: [String]) {
node(id: $id) {
... on User {
friends(before: $before, after: $after, first: $count, orderby: $orderby)
@__clientField(handle: "connection", filters: ["orderby"], key: "ConnectionQuery_friends") {
count
edges {
cursor
node {
id
}
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
}
}
}
}
`,
));
});
describe('insertEdgeAfter()', () => {
let connection;
let connectionID;
let newEdge;
beforeEach(() => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:1',
node: {
id: '1',
},
},
{
cursor: 'cursor:2',
node: {
id: '2',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:1',
[HAS_NEXT_PAGE]: true,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: 'cursor:1',
},
},
},
},
{
after: null,
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey('connection', 'ConnectionQuery_friends', 'friends') +
'(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
const store = new RelayModernStore(baseSource);
store.publish(sinkSource);
baseData = simpleClone(baseData);
baseSource = new RelayInMemoryRecordSource(baseData);
sinkData = {};
sinkSource = new RelayInMemoryRecordSource(sinkData);
mutator = new RelayRecordSourceMutator(baseSource, sinkSource);
proxy = new RelayRecordSourceProxy(mutator);
connection = RelayConnectionHandler.getConnection(
proxy.get('4'),
'ConnectionQuery_friends',
{orderby: ['first name']},
);
connectionID = connection.getDataID();
newEdge = proxy.create('newedge', 'FriendsEdge');
newEdge.setValue('cursor:newedge', 'edge');
});
it('creates the edges array if it does not exist', () => {
connection = proxy.create('connection', 'FriendsConnection');
RelayConnectionHandler.insertEdgeAfter(connection, newEdge);
expect(sinkData.connection).toEqual({
[ID_KEY]: 'connection',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: ['newedge'],
},
});
});
it('appends the edge if no cursor is supplied', () => {
RelayConnectionHandler.insertEdgeAfter(connection, newEdge);
expect(sinkData[connectionID]).toEqual({
[ID_KEY]: connectionID,
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
'newedge',
],
},
});
});
it('appends the edge if the cursor is not found', () => {
RelayConnectionHandler.insertEdgeAfter(connection, newEdge, 'bad-cursor');
expect(sinkData[connectionID]).toEqual({
[ID_KEY]: connectionID,
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
'newedge',
],
},
});
});
it('inserts the edge after the edge with the given cursor', () => {
RelayConnectionHandler.insertEdgeAfter(connection, newEdge, 'cursor:1');
expect(sinkData[connectionID]).toEqual({
[ID_KEY]: connectionID,
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
'newedge',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
],
},
});
});
});
describe('insertEdgeBefore()', () => {
let connection;
let connectionID;
let newEdge;
beforeEach(() => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:1',
node: {
id: '1',
},
},
{
cursor: 'cursor:2',
node: {
id: '2',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:1',
[HAS_NEXT_PAGE]: true,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: 'cursor:1',
},
},
},
},
{
after: null,
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey('connection', 'ConnectionQuery_friends', 'friends') +
'(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
const store = new RelayModernStore(baseSource);
store.publish(sinkSource);
baseData = simpleClone(baseData);
baseSource = new RelayInMemoryRecordSource(baseData);
sinkData = {};
sinkSource = new RelayInMemoryRecordSource(sinkData);
mutator = new RelayRecordSourceMutator(baseSource, sinkSource);
proxy = new RelayRecordSourceProxy(mutator);
connection = RelayConnectionHandler.getConnection(
proxy.get('4'),
'ConnectionQuery_friends',
{orderby: ['first name']},
);
connectionID = connection.getDataID();
newEdge = proxy.create('newedge', 'FriendsEdge');
newEdge.setValue('cursor:newedge', 'edge');
});
it('creates the edges array if it does not exist', () => {
connection = proxy.create('connection', 'FriendsConnection');
RelayConnectionHandler.insertEdgeBefore(connection, newEdge);
expect(sinkData.connection).toEqual({
[ID_KEY]: 'connection',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: ['newedge'],
},
});
});
it('prepends the edge if no cursor is supplied', () => {
RelayConnectionHandler.insertEdgeBefore(connection, newEdge);
expect(sinkData[connectionID]).toEqual({
[ID_KEY]: connectionID,
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'newedge',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
],
},
});
});
it('prepends the edge if the cursor is not found', () => {
RelayConnectionHandler.insertEdgeBefore(
connection,
newEdge,
'bad-cursor',
);
expect(sinkData[connectionID]).toEqual({
[ID_KEY]: connectionID,
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'newedge',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
],
},
});
});
it('inserts the edge before the edge with the given cursor', () => {
RelayConnectionHandler.insertEdgeBefore(connection, newEdge, 'cursor:2');
expect(sinkData[connectionID]).toEqual({
[ID_KEY]: connectionID,
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
'newedge',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
],
},
});
});
});
describe('deleteNode()', () => {
let connection;
let connectionID;
beforeEach(() => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:1',
node: {
id: '1',
},
},
{
cursor: 'cursor:2',
node: {
id: '2',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:1',
[HAS_NEXT_PAGE]: true,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: 'cursor:1',
},
},
},
},
{
after: null,
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey('connection', 'ConnectionQuery_friends', 'friends') +
'(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
const store = new RelayModernStore(baseSource);
store.publish(sinkSource);
baseData = simpleClone(baseData);
baseSource = new RelayInMemoryRecordSource(baseData);
sinkData = {};
sinkSource = new RelayInMemoryRecordSource(sinkData);
mutator = new RelayRecordSourceMutator(baseSource, sinkSource);
proxy = new RelayRecordSourceProxy(mutator);
connection = RelayConnectionHandler.getConnection(
proxy.get('4'),
'ConnectionQuery_friends',
{orderby: ['first name']},
);
connectionID = connection.getDataID();
});
it('does nothing if the node is not found', () => {
RelayConnectionHandler.deleteNode(connection, '<not-in-connection>');
expect(sinkData).toEqual({});
});
it('deletes the matching edge from the connection', () => {
RelayConnectionHandler.deleteNode(connection, '1');
expect(baseData[connectionID].edges[REFS_KEY]).toEqual([
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
]);
expect(sinkData).toEqual({
[connectionID]: {
[ID_KEY]: connectionID,
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
],
},
},
});
});
});
describe('update()', () => {
it('does nothing if the payload record does not exist', () => {
const payload = {
dataID: 'unfetched',
fieldKey: 'friends',
handleKey: getRelayHandleKey('connection', null, 'friends'),
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({});
});
it('sets the handle as deleted if the server record is null', () => {
// link to a deleted record
baseData[ROOT_ID].friends = {[REF_KEY]: 'friends'};
baseData.friends = null;
const payload = {
dataID: ROOT_ID,
fieldKey: 'friends',
handleKey: getRelayHandleKey('connection', null, 'friend'),
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
[ROOT_ID]: {
[ID_KEY]: ROOT_ID,
[TYPENAME_KEY]: ROOT_TYPE,
[payload.handleKey]: null,
},
});
});
it('sets the handle as deleted if the server record is undefined', () => {
// link to an unfetched record
baseData[ROOT_ID].friends = {[REF_KEY]: 'friends'};
baseData.friends = null;
const payload = {
dataID: ROOT_ID,
fieldKey: 'friends',
handleKey: getRelayHandleKey('connection', null, 'friend'),
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
[ROOT_ID]: {
[ID_KEY]: ROOT_ID,
[TYPENAME_KEY]: ROOT_TYPE,
[payload.handleKey]: null,
},
});
});
it('creates a client connection with initial server data', () => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:1',
node: {
id: '1',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:1',
[HAS_NEXT_PAGE]: true,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: 'cursor:1',
},
},
},
},
{
after: null,
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey('connection', 'ConnectionQuery_friends', 'friends') +
'(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
4: {
__id: '4',
[ID_KEY]: '4',
[TYPENAME_KEY]: 'User',
[payload.handleKey]: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
],
},
[PAGE_INFO]: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
},
__connection_next_edge_index: 1,
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: 'cursor:1',
node: {[REF_KEY]: '1'},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
[TYPENAME_KEY]: 'PageInfo',
[END_CURSOR]: 'cursor:1',
[HAS_NEXT_PAGE]: true,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: 'cursor:1',
},
});
});
it('populates default values for page info', () => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:1',
node: {
id: '1',
},
},
],
// no pageInfo
},
},
},
{
after: null,
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey('connection', 'ConnectionQuery_friends', 'friends') +
'(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
4: {
__id: '4',
[ID_KEY]: '4',
[TYPENAME_KEY]: 'User',
[payload.handleKey]: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
],
},
[PAGE_INFO]: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
},
__connection_next_edge_index: 1,
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: 'cursor:1',
node: {[REF_KEY]: '1'},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
[TYPENAME_KEY]: 'PageInfo',
[END_CURSOR]: null,
[HAS_NEXT_PAGE]: false,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: null,
},
});
});
describe('subsequent fetches', () => {
beforeEach(() => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:1',
node: {
id: '1',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:1',
[HAS_NEXT_PAGE]: true,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: 'cursor:1',
},
},
},
},
{
after: null,
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey(
'connection',
'ConnectionQuery_friends',
'friends',
) + '(orderby:["first name"])';
const payload = {
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
const store = new RelayModernStore(baseSource);
store.publish(sinkSource);
baseData = simpleClone(baseData);
baseSource = new RelayInMemoryRecordSource(baseData);
sinkData = {};
sinkSource = new RelayInMemoryRecordSource(sinkData);
mutator = new RelayRecordSourceMutator(baseSource, sinkSource);
proxy = new RelayRecordSourceProxy(mutator);
});
it('appends new edges', () => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:2',
node: {
id: '2',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:2',
[HAS_NEXT_PAGE]: false,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: 'cursor:2',
},
},
},
},
{
after: 'cursor:1',
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {after: 'cursor:1', first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey(
'connection',
'ConnectionQuery_friends',
'friends',
) + '(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
],
},
pageInfo: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
},
__connection_next_edge_index: 2,
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: 'cursor:2',
node: {[REF_KEY]: '2'},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
[TYPENAME_KEY]: 'PageInfo',
[END_CURSOR]: 'cursor:2',
[HAS_NEXT_PAGE]: false,
},
});
});
it('prepends new edges', () => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:0',
node: {
id: '0',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:0',
[HAS_PREV_PAGE]: false,
[HAS_NEXT_PAGE]: false,
[START_CURSOR]: 'cursor:0',
},
},
},
},
{
after: null,
before: 'cursor:1',
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {before: 'cursor:1', first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey(
'connection',
'ConnectionQuery_friends',
'friends',
) + '(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
],
},
pageInfo: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
},
__connection_next_edge_index: 2,
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: 'cursor:0',
node: {[REF_KEY]: '0'},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
[TYPENAME_KEY]: 'PageInfo',
[HAS_PREV_PAGE]: false,
[START_CURSOR]: 'cursor:0',
},
});
});
it('resets the connection for head loads (no after/before args)', () => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:0',
node: {
id: '0',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:0',
[HAS_PREV_PAGE]: false,
[HAS_NEXT_PAGE]: true,
[START_CURSOR]: 'cursor:0',
},
},
},
},
{
after: null,
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey(
'connection',
'ConnectionQuery_friends',
'friends',
) + '(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
],
},
pageInfo: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
},
__connection_next_edge_index: 2,
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: 'cursor:0',
node: {[REF_KEY]: '0'},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
[TYPENAME_KEY]: 'PageInfo',
[END_CURSOR]: 'cursor:0',
[HAS_PREV_PAGE]: false,
[HAS_NEXT_PAGE]: true,
[START_CURSOR]: 'cursor:0',
},
});
});
it('appends new edges with null cursors', () => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: null,
node: {
id: '2',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:2',
[HAS_NEXT_PAGE]: false,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: 'cursor:2',
},
},
},
},
{
after: 'cursor:1',
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {after: 'cursor:1', first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey(
'connection',
'ConnectionQuery_friends',
'friends',
) + '(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
],
},
pageInfo: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
},
__connection_next_edge_index: 2,
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: null,
node: {[REF_KEY]: '2'},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
[TYPENAME_KEY]: 'PageInfo',
[END_CURSOR]: 'cursor:2',
[HAS_NEXT_PAGE]: false,
},
});
});
it('updates the end cursor using server page info', () => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:2',
node: {
id: '2',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:updated',
[HAS_NEXT_PAGE]: false,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: null,
},
},
},
},
{
after: 'cursor:1',
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {after: 'cursor:1', first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey(
'connection',
'ConnectionQuery_friends',
'friends',
) + '(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
],
},
pageInfo: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
},
__connection_next_edge_index: 2,
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: 'cursor:2',
node: {[REF_KEY]: '2'},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
[TYPENAME_KEY]: 'PageInfo',
[END_CURSOR]: 'cursor:updated',
[HAS_NEXT_PAGE]: false,
},
});
});
it('ignores null end cursors', () => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [],
[PAGE_INFO]: {
[END_CURSOR]: null,
[HAS_NEXT_PAGE]: false,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: null,
},
},
},
},
{
after: 'cursor:1',
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {after: 'cursor:1', first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey(
'connection',
'ConnectionQuery_friends',
'friends',
) + '(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
],
},
pageInfo: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
[TYPENAME_KEY]: 'PageInfo',
[HAS_NEXT_PAGE]: false,
// end_cursor is skipped
},
});
});
it('skips edges with duplicate node ids', () => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:2', // new cursor
node: {
id: '1', // same as existing edge
},
},
{
cursor: 'cursor:3',
node: {
id: '3',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:3',
[HAS_NEXT_PAGE]: true,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: 'cursor:3',
},
},
},
},
{
after: 'cursor:1',
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {after: 'cursor:1', first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey(
'connection',
'ConnectionQuery_friends',
'friends',
) + '(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
// '...edges:0' skipped bc of duplicate node id
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:2',
],
},
pageInfo: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
},
__connection_next_edge_index: 3,
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: 'cursor:2',
node: {[REF_KEY]: '1'},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:2': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:2',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: 'cursor:3',
node: {[REF_KEY]: '3'},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
[TYPENAME_KEY]: 'PageInfo',
[END_CURSOR]: 'cursor:3',
[HAS_NEXT_PAGE]: true,
},
});
});
it('adds edges with duplicate cursors', () => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:1', // same cursor as existing edge
node: {
id: '2', // different node id
},
},
{
cursor: 'cursor:3',
node: {
id: '3',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:3',
[HAS_NEXT_PAGE]: true,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: 'cursor:3',
},
},
},
},
{
after: 'cursor:1',
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {after: 'cursor:1', first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey(
'connection',
'ConnectionQuery_friends',
'friends',
) + '(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:2',
],
},
pageInfo: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
},
__connection_next_edge_index: 3,
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: 'cursor:1',
node: {[REF_KEY]: '2'},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:2': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:2',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: 'cursor:3',
node: {[REF_KEY]: '3'},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
[TYPENAME_KEY]: 'PageInfo',
[END_CURSOR]: 'cursor:3',
[HAS_NEXT_PAGE]: true,
},
});
});
it('skips backward pagination payloads with unknown cursors', () => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:2',
node: {
id: '2',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:2',
[HAS_NEXT_PAGE]: false,
[HAS_PREV_PAGE]: true,
[START_CURSOR]: 'cursor:2',
},
},
},
},
{
after: null,
before: '<unknown-cursor>',
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {
before: '<unknown-cursor>',
first: 10,
orderby: ['first name'],
};
const handleKey =
getRelayHandleKey(
'connection',
'ConnectionQuery_friends',
'friends',
) + '(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
],
},
pageInfo: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
},
__connection_next_edge_index: 2,
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: 'cursor:2',
node: {[REF_KEY]: '2'},
},
// page info unchanged
});
});
it('skips forward pagination payloads with unknown cursors', () => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
edges: [
{
cursor: 'cursor:2',
node: {
id: '2',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:2',
[HAS_NEXT_PAGE]: false,
[HAS_PREV_PAGE]: true,
[START_CURSOR]: 'cursor:2',
},
},
},
},
{
after: '<unknown-cursor>',
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {
after: '<unknown-cursor>',
first: 10,
orderby: ['first name'],
};
const handleKey =
getRelayHandleKey(
'connection',
'ConnectionQuery_friends',
'friends',
) + '(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
[TYPENAME_KEY]: 'FriendsConnection',
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
],
},
pageInfo: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
},
__connection_next_edge_index: 2,
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: 'cursor:2',
node: {[REF_KEY]: '2'},
},
// page info unchanged
});
});
it('updates fields on connection', () => {
normalize(
{
node: {
id: '4',
__typename: 'User',
friends: {
count: 2,
edges: [
{
cursor: 'cursor:2',
node: {
id: '2',
},
},
],
[PAGE_INFO]: {
[END_CURSOR]: 'cursor:2',
[HAS_NEXT_PAGE]: false,
[HAS_PREV_PAGE]: false,
[START_CURSOR]: 'cursor:2',
},
},
},
},
{
after: 'cursor:1',
before: null,
count: 10,
orderby: ['first name'],
id: '4',
},
);
const args = {after: 'cursor:1', first: 10, orderby: ['first name']};
const handleKey =
getRelayHandleKey(
'connection',
'ConnectionQuery_friends',
'friends',
) + '(orderby:["first name"])';
const payload = {
args,
dataID: '4',
fieldKey: getStableStorageKey('friends', args),
handleKey,
};
RelayConnectionHandler.update(proxy, payload);
expect(sinkData).toEqual({
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"])',
[TYPENAME_KEY]: 'FriendsConnection',
count: 2,
edges: {
[REFS_KEY]: [
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0',
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
],
},
pageInfo: {
[REF_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
},
__connection_next_edge_index: 2,
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:1',
[TYPENAME_KEY]: 'FriendsEdge',
cursor: 'cursor:2',
node: {[REF_KEY]: '2'},
},
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo': {
[ID_KEY]:
'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):pageInfo',
[TYPENAME_KEY]: 'PageInfo',
[END_CURSOR]: 'cursor:2',
[HAS_NEXT_PAGE]: false,
},
});
});
});
});
});
| dbslone/relay | packages/relay-runtime/handlers/connection/__tests__/RelayConnectionHandler-test.js | JavaScript | mit | 53,432 |
import Ember from 'ember';
export default Ember.Route.extend({
activate: function() {
Ember.run.scheduleOnce('afterRender', this, () => {
$('.materialboxed').materialbox();
});
}
});
| shadryn/jackalope | app/routes/portfolio.js | JavaScript | mit | 202 |
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.combinationsWithRepDependencies = void 0;
var _dependenciesTyped = require("./dependenciesTyped.generated");
var _factoriesAny = require("../../factoriesAny.js");
/**
* THIS FILE IS AUTO-GENERATED
* DON'T MAKE CHANGES HERE
*/
var combinationsWithRepDependencies = {
typedDependencies: _dependenciesTyped.typedDependencies,
createCombinationsWithRep: _factoriesAny.createCombinationsWithRep
};
exports.combinationsWithRepDependencies = combinationsWithRepDependencies; | Michayal/michayal.github.io | node_modules/mathjs/lib/entry/dependenciesAny/dependenciesCombinationsWithRep.generated.js | JavaScript | mit | 565 |
// GL program wrapper to cache uniform locations/values, do compile-time pre-processing
// (injecting #defines and #pragma blocks into shaders), etc.
import GLSL from './glsl';
import Texture from './texture';
import getExtension from './extensions';
import log from 'loglevel';
import strip from 'strip-comments';
import { default as parseShaderErrors } from 'gl-shader-errors';
export default class ShaderProgram {
constructor(gl, vertex_source, fragment_source, options) {
options = options || {};
this.gl = gl;
this.program = null;
this.compiled = false;
this.compiling = false;
this.error = null;
// key/values inserted as #defines into shaders at compile-time
this.defines = Object.assign({}, options.defines||{});
// key/values for blocks that can be injected into shaders at compile-time
this.blocks = Object.assign({}, options.blocks||{});
this.block_scopes = Object.assign({}, options.block_scopes||{});
// list of extensions to activate
this.extensions = options.extensions || [];
// JS-object uniforms that are expected by this program
// If they are not found in the existing shader source, their types will be inferred and definitions
// for each will be injected.
this.dependent_uniforms = options.uniforms;
this.uniforms = {}; // program locations of uniforms, lazily added as each uniform is set
this.attribs = {}; // program locations of vertex attributes, lazily added as each attribute is accessed
this.vertex_source = vertex_source;
this.fragment_source = fragment_source;
this.id = ShaderProgram.id++;
ShaderProgram.programs[this.id] = this;
this.name = options.name; // can provide a program name (useful for debugging)
}
destroy() {
this.gl.useProgram(null);
this.gl.deleteProgram(this.program);
this.program = null;
this.uniforms = {};
this.attribs = {};
delete ShaderProgram.programs[this.id];
this.compiled = false;
}
// Use program wrapper with simple state cache
use() {
if (!this.compiled) {
return;
}
if (ShaderProgram.current !== this) {
this.gl.useProgram(this.program);
}
ShaderProgram.current = this;
}
compile() {
if (this.compiling) {
throw(new Error(`ShaderProgram.compile(): skipping for ${this.id} (${this.name}) because already compiling`));
}
this.compiling = true;
this.compiled = false;
this.error = null;
// Copy sources from pre-modified template
this.computed_vertex_source = this.vertex_source;
this.computed_fragment_source = this.fragment_source;
// Check for extension availability
let extensions = this.checkExtensions();
// Make list of defines to be injected later
var defines = this.buildDefineList();
// Inject user-defined blocks (arbitrary code points matching named #pragmas)
// Replace according to this pattern:
// #pragma tangram: [key]
// e.g. #pragma tangram: global
// Gather all block code snippets
var blocks = this.buildShaderBlockList();
var regexp;
for (var key in blocks) {
var block = blocks[key];
if (!block || (Array.isArray(block) && block.length === 0)) {
continue;
}
// First find code replace points in shaders
regexp = new RegExp('^\\s*#pragma\\s+tangram:\\s+' + key + '\\s*$', 'm');
var inject_vertex = this.computed_vertex_source.match(regexp);
var inject_fragment = this.computed_fragment_source.match(regexp);
// Avoid network request if nothing to replace
if (inject_vertex == null && inject_fragment == null) {
continue;
}
// Combine all blocks into one string
var source = '';
block.forEach(val => {
// Mark start and end of each block with metadata (which can be extracted from
// final source for error handling, debugging, etc.)
let mark = `${val.scope}, ${val.key}, ${val.num}`;
source += `\n// tangram-block-start: ${mark}\n`;
source += val.source;
source += `\n// tangram-block-end: ${mark}\n`;
});
// Inject
if (inject_vertex != null) {
this.computed_vertex_source = this.computed_vertex_source.replace(regexp, source);
}
if (inject_fragment != null) {
this.computed_fragment_source = this.computed_fragment_source.replace(regexp, source);
}
// Add a #define for this injection point
defines['TANGRAM_BLOCK_' + key.replace(/[\s-]+/g, '_').toUpperCase()] = true;
}
// Clean-up any #pragmas that weren't replaced (to prevent compiler warnings)
regexp = new RegExp('^\\s*#pragma.*$', 'gm');
this.computed_vertex_source = this.computed_vertex_source.replace(regexp, '');
this.computed_fragment_source = this.computed_fragment_source.replace(regexp, '');
// Detect uniform definitions, inject any missing ones
this.ensureUniforms(this.dependent_uniforms);
// Build & inject extensions & defines
// This is done *after* code injection so that we can add defines for which code points were injected
let info = (this.name ? (this.name + ' / id ' + this.id) : ('id ' + this.id));
let header = `// Program: ${info}\n`;
let precision = '';
let high = this.gl.getShaderPrecisionFormat(this.gl.FRAGMENT_SHADER, this.gl.HIGH_FLOAT);
if (high && high.precision > 0) {
precision = 'precision highp float;\n';
}
else {
precision = 'precision mediump float;\n';
}
defines['TANGRAM_VERTEX_SHADER'] = true;
defines['TANGRAM_FRAGMENT_SHADER'] = false;
this.computed_vertex_source =
header +
precision +
ShaderProgram.buildDefineString(defines) +
this.computed_vertex_source;
// Precision qualifier only valid in fragment shader
// NB: '#extension' statements added to fragment shader only, as IE11 throws error when they appear in
// vertex shader (even when guarded by #ifdef), and no WebGL extensions require '#extension' in vertex shaders
defines['TANGRAM_VERTEX_SHADER'] = false;
defines['TANGRAM_FRAGMENT_SHADER'] = true;
this.computed_fragment_source =
ShaderProgram.buildExtensionString(extensions) +
header +
precision +
ShaderProgram.buildDefineString(defines) +
this.computed_fragment_source;
// Compile & set uniforms to cached values
try {
this.program = ShaderProgram.updateProgram(this.gl, this.program, this.computed_vertex_source, this.computed_fragment_source);
this.compiled = true;
this.compiling = false;
}
catch(error) {
this.program = null;
this.compiled = false;
this.compiling = false;
this.error = error;
// shader error info
if (error.type === 'vertex' || error.type === 'fragment') {
this.shader_errors = error.errors;
for (let e of this.shader_errors) {
e.type = error.type;
e.block = this.block(error.type, e.line);
}
}
throw(new Error(`ShaderProgram.compile(): program ${this.id} (${this.name}) error:`, error));
}
this.use();
this.refreshUniforms();
this.refreshAttributes();
}
// Make list of defines (global, then program-specific)
buildDefineList() {
var d, defines = {};
for (d in ShaderProgram.defines) {
defines[d] = ShaderProgram.defines[d];
}
for (d in this.defines) {
defines[d] = this.defines[d];
}
return defines;
}
// Make list of shader blocks (global, then program-specific)
buildShaderBlockList() {
let key, blocks = {};
// Global blocks
for (key in ShaderProgram.blocks) {
blocks[key] = [];
if (Array.isArray(ShaderProgram.blocks[key])) {
blocks[key].push(
...ShaderProgram.blocks[key].map((source, num) => {
return { key, source, num, scope: 'ShaderProgram' };
})
);
}
else {
blocks[key] = [{ key, source: ShaderProgram.blocks[key], num: 0, scope: 'ShaderProgram' }];
}
}
// Program-specific blocks
for (key in this.blocks) {
blocks[key] = blocks[key] || [];
if (Array.isArray(this.blocks[key])) {
let scopes = (this.block_scopes && this.block_scopes[key]) || [];
let cur_scope = null, num = 0;
for (let b=0; b < this.blocks[key].length; b++) {
// Count blocks relative to current scope
if (scopes[b] !== cur_scope) {
cur_scope = scopes[b];
num = 0;
}
blocks[key].push({
key,
source: this.blocks[key][b],
num,
scope: cur_scope || this.name
});
num++;
}
}
else {
// TODO: address discrepancy in array vs. single-value blocks
// styles assume array when tracking block scopes
blocks[key].push({ key, source: this.blocks[key], num: 0, scope: this.name });
}
}
return blocks;
}
// Detect uniform definitions, inject any missing ones
ensureUniforms(uniforms) {
if (!uniforms) {
return;
}
var vs = strip(this.computed_vertex_source);
var fs = strip(this.computed_fragment_source);
var inject, vs_injections = [], fs_injections = [];
// Check for missing uniform definitions
for (var name in uniforms) {
inject = null;
// Check vertex shader
if (!GLSL.isUniformDefined(name, vs) && GLSL.isSymbolReferenced(name, vs)) {
if (!inject) {
inject = GLSL.defineUniform(name, uniforms[name]);
}
log.trace(`Program ${this.name}: ${name} not defined in vertex shader, injecting: '${inject}'`);
vs_injections.push(inject);
}
// Check fragment shader
if (!GLSL.isUniformDefined(name, fs) && GLSL.isSymbolReferenced(name, fs)) {
if (!inject) {
inject = GLSL.defineUniform(name, uniforms[name]);
}
log.trace(`Program ${this.name}: ${name} not defined in fragment shader, injecting: '${inject}'`);
fs_injections.push(inject);
}
}
// Inject missing uniforms
// NOTE: these are injected at the very top of the shaders, even before any #defines or #pragmas are added
// this could cause some issues with certain #pragmas, or other functions that might expect #defines
if (vs_injections.length > 0) {
this.computed_vertex_source = vs_injections.join('\n') + this.computed_vertex_source;
}
if (fs_injections.length > 0) {
this.computed_fragment_source = fs_injections.join('\n') + this.computed_fragment_source;
}
}
// Set uniforms from a JS object, with inferred types
setUniforms(uniforms, reset_texture_unit = true) {
if (!this.compiled) {
return;
}
// TODO: only update uniforms when changed
// Texture units must be tracked and incremented each time a texture sampler uniform is set.
// By default, the texture unit is reset to 0 each time setUniforms is called, but they can
// also be preserved, for example in cases where multiple calls to setUniforms are expected
// (e.g. program-specific uniforms followed by mesh-specific ones).
if (reset_texture_unit) {
this.texture_unit = 0;
}
// Parse uniform types and values from the JS object
var parsed = GLSL.parseUniforms(uniforms);
// Set each uniform
for (var uniform of parsed) {
if (uniform.type === 'sampler2D') {
// For textures, we need to track texture units, so we have a special setter
this.setTextureUniform(uniform.name, uniform.value);
}
else {
this.uniform(uniform.method, uniform.name, uniform.value);
}
}
}
// Cache some or all uniform values so they can be restored
saveUniforms(subset) {
let uniforms = subset || this.uniforms;
for (let u in uniforms) {
let uniform = this.uniforms[u];
if (uniform) {
uniform.saved_value = uniform.value;
}
}
this.saved_texture_unit = this.texture_unit || 0;
}
// Restore some or all uniforms to saved values
restoreUniforms(subset) {
let uniforms = subset || this.uniforms;
for (let u in uniforms) {
let uniform = this.uniforms[u];
if (uniform && uniform.saved_value) {
uniform.value = uniform.saved_value;
this.updateUniform(u);
}
}
this.texture_unit = this.saved_texture_unit || 0;
}
// Set a texture uniform, finds texture by name or creates a new one
setTextureUniform(uniform_name, texture_name) {
var texture = Texture.textures[texture_name];
if (texture == null) {
texture = Texture.create(this.gl, texture_name, { url: texture_name });
}
texture.bind(this.texture_unit);
this.uniform('1i', uniform_name, this.texture_unit);
this.texture_unit++; // TODO: track max texture units and log/throw errors
}
// ex: program.uniform('3f', 'position', x, y, z);
// TODO: only update uniforms when changed
uniform(method, name, ...value) { // 'value' is a method-appropriate arguments list
if (!this.compiled) {
return;
}
this.uniforms[name] = this.uniforms[name] || {};
let uniform = this.uniforms[name];
uniform.name = name;
if (uniform.location === undefined) {
uniform.location = this.gl.getUniformLocation(this.program, name);
}
uniform.method = 'uniform' + method;
uniform.value = value;
this.updateUniform(name);
}
// Set a single uniform
updateUniform(name) {
if (!this.compiled) {
return;
}
var uniform = this.uniforms[name];
if (!uniform || uniform.location == null) {
return;
}
this.use();
this.gl[uniform.method].apply(this.gl, [uniform.location].concat(uniform.value)); // call appropriate GL uniform method and pass through arguments
}
// Refresh uniform locations and set to last cached values
refreshUniforms() {
if (!this.compiled) {
return;
}
for (var u in this.uniforms) {
this.uniforms[u].location = this.gl.getUniformLocation(this.program, u);
this.updateUniform(u);
}
}
refreshAttributes() {
// var len = this.gl.getProgramParameter(this.program, this.gl.ACTIVE_ATTRIBUTES);
// for (var i=0; i < len; i++) {
// var a = this.gl.getActiveAttrib(this.program, i);
// }
this.attribs = {};
}
// Get the location of a vertex attribute
attribute(name) {
if (!this.compiled) {
return;
}
var attrib = (this.attribs[name] = this.attribs[name] || {});
if (attrib.location != null) {
return attrib;
}
attrib.name = name;
attrib.location = this.gl.getAttribLocation(this.program, name);
// var info = this.gl.getActiveAttrib(this.program, attrib.location);
// attrib.type = info.type;
// attrib.size = info.size;
return attrib;
}
// Get shader source as string
source(type) {
if (type === 'vertex') {
return this.computed_vertex_source;
}
else if (type === 'fragment') {
return this.computed_fragment_source;
}
}
// Get shader source as array of line strings
lines(type) {
let source = this.source(type);
if (source) {
return source.split('\n');
}
return [];
}
// Get a specific line from shader source
line(type, num) {
let source = this.lines(type);
if (source) {
return source[num];
}
}
// Get info on which shader block (if any) a particular line number in a shader is in
// Returns an object with the following info if a block is found: { name, line, source }
// scope: where the shader block originated, either a style name, or global such as ShaderProgram
// name: shader block name (e.g. 'color', 'position', 'global')
// num: the block number *within* local scope (e.g. if a style has multiple 'color' blocks)
// line: line number *within* the shader block (not the whole shader program), useful for error highlighting
// source: the code for the line
// NOTE: this does a bruteforce loop over the shader source and looks for shader block start/end markers
// We could track line ranges for shader blocks as they are inserted, but as this code is only used for
// error handling on compilation failure, it was simpler to keep it separate than to burden the core
// compilation path.
block(type, num) {
let lines = this.lines(type);
let block;
for (let i=0; i < num && i < lines.length; i++) {
let line = lines[i];
let match = line.match(/\/\/ tangram-block-start: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/);
if (match && match.length > 1) {
// mark current block
block = {
scope: match[1],
name: match[2],
num: match[3]
};
}
else {
match = line.match(/\/\/ tangram-block-end: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/);
if (match && match.length > 1) {
block = null; // clear current block
}
}
// update line # and content
if (block) {
// init to -1 so that line 0 is first actual line of block code, after comment marker
block.line = (block.line == null) ? -1 : block.line + 1;
block.source = line;
}
}
return block;
}
// Returns list of available extensions from those requested
// Sets internal #defines indicating availability of each requested extension
checkExtensions() {
let exts = [];
for (let name of this.extensions) {
let ext = getExtension(this.gl, name);
let def = `TANGRAM_EXTENSION_${name}`;
this.defines[def] = (ext != null);
if (ext) {
exts.push(name);
}
else {
log.debug(`Could not enable extension '${name}'`);
}
}
return exts;
}
}
// Static methods and state
ShaderProgram.id = 0; // assign each program a unique id
ShaderProgram.programs = {}; // programs, by id
ShaderProgram.current = null; // currently bound program
// Global config applied to all programs (duplicate properties for a specific program will take precedence)
ShaderProgram.defines = {};
ShaderProgram.blocks = {};
// Turn an object of key/value pairs into single string of #define statements
ShaderProgram.buildDefineString = function (defines) {
var define_str = "";
for (var d in defines) {
if (defines[d] === false) {
continue;
}
else if (typeof defines[d] === 'boolean' && defines[d] === true) { // booleans are simple defines with no value
define_str += "#define " + d + "\n";
}
else if (typeof defines[d] === 'number' && Math.floor(defines[d]) === defines[d]) { // int to float conversion to satisfy GLSL floats
define_str += "#define " + d + " " + defines[d].toFixed(1) + "\n";
}
else { // any other float or string value
define_str += "#define " + d + " " + defines[d] + "\n";
}
}
return define_str;
};
// Turn a list of extension names into single string of #extension statements
ShaderProgram.buildExtensionString = function (extensions) {
extensions = extensions || [];
let str = "";
for (let ext of extensions) {
str += `#ifdef GL_${ext}\n#extension GL_${ext} : enable\n#endif\n`;
}
return str;
};
ShaderProgram.addBlock = function (key, ...blocks) {
ShaderProgram.blocks[key] = ShaderProgram.blocks[key] || [];
ShaderProgram.blocks[key].push(...blocks);
};
// Remove all global shader blocks for a given key
ShaderProgram.removeBlock = function (key) {
ShaderProgram.blocks[key] = [];
};
ShaderProgram.replaceBlock = function (key, ...blocks) {
ShaderProgram.removeBlock(key);
ShaderProgram.addBlock(key, ...blocks);
};
// Compile & link a WebGL program from provided vertex and fragment shader sources
// update a program if one is passed in. Create one if not. Alert and don't update anything if the shaders don't compile.
ShaderProgram.updateProgram = function (gl, program, vertex_shader_source, fragment_shader_source) {
try {
var vertex_shader = ShaderProgram.createShader(gl, vertex_shader_source, gl.VERTEX_SHADER);
var fragment_shader = ShaderProgram.createShader(gl, fragment_shader_source, gl.FRAGMENT_SHADER);
}
catch(err) {
log.error(err.message);
throw err;
}
gl.useProgram(null);
if (program != null) {
var old_shaders = gl.getAttachedShaders(program);
for(var i = 0; i < old_shaders.length; i++) {
gl.detachShader(program, old_shaders[i]);
}
} else {
program = gl.createProgram();
}
if (vertex_shader == null || fragment_shader == null) {
return program;
}
gl.attachShader(program, vertex_shader);
gl.attachShader(program, fragment_shader);
gl.deleteShader(vertex_shader);
gl.deleteShader(fragment_shader);
gl.linkProgram(program);
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
let message = new Error(
`WebGL program error:
VALIDATE_STATUS: ${gl.getProgramParameter(program, gl.VALIDATE_STATUS)}
ERROR: ${gl.getError()}
--- Vertex Shader ---
${vertex_shader_source}
--- Fragment Shader ---
${fragment_shader_source}`);
let error = { type: 'program', message };
log.error(error.message);
throw error;
}
return program;
};
// Compile a vertex or fragment shader from provided source
ShaderProgram.createShader = function (gl, source, stype) {
let shader = gl.createShader(stype);
gl.shaderSource(shader, source);
gl.compileShader(shader);
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
let type = (stype === gl.VERTEX_SHADER ? 'vertex' : 'fragment');
let message = gl.getShaderInfoLog(shader);
let errors = parseShaderErrors(message);
throw { type, message, errors };
}
return shader;
};
| DataAnalyticsinStudentHands/tangram-meteor | src/gl/shader_program.js | JavaScript | mit | 24,269 |
import constant from './constant';
import freeze from './freeze';
import is from './is';
import _if from './if';
import ifElse from './ifElse';
import map from './map';
import omit from './omit';
import reject from './reject';
import update from './update';
import updateIn from './updateIn';
import withDefault from './withDefault';
import { _ } from './util/curry';
const u = update;
u._ = _;
u.constant = constant;
u.if = _if;
u.ifElse = ifElse;
u.is = is;
u.freeze = freeze;
u.map = map;
u.omit = omit;
u.reject = reject;
u.update = update;
u.updateIn = updateIn;
u.withDefault = withDefault;
export default u;
| frederickfogerty/updeep | lib/index.js | JavaScript | mit | 618 |
/*!
* jQuery UI Effects Puff @VERSION
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/puff-effect/
*/
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
"jquery",
"./effect",
"./effect-scale"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
return $.effects.effect.puff = function( o, done ) {
var elem = $( this ),
mode = $.effects.setMode( elem, o.mode || "hide" ),
hide = mode === "hide",
percent = parseInt( o.percent, 10 ) || 150,
factor = percent / 100,
original = {
height: elem.height(),
width: elem.width(),
outerHeight: elem.outerHeight(),
outerWidth: elem.outerWidth()
};
$.extend( o, {
effect: "scale",
queue: false,
fade: true,
mode: mode,
complete: done,
percent: hide ? percent : 100,
from: hide ?
original :
{
height: original.height * factor,
width: original.width * factor,
outerHeight: original.outerHeight * factor,
outerWidth: original.outerWidth * factor
}
});
elem.effect( o );
};
}));
| marielb/towerofbabble | node_modules/download.jqueryui.com/jquery-ui.prev/1.11.0/ui/effect-puff.js | JavaScript | mit | 1,241 |
const DrawCard = require('../../../drawcard.js');
class TowerOfTheHand extends DrawCard {
setupCardAbilities() {
this.reaction({
when: {
afterChallenge: (event, challenge) => challenge.challengeType === 'intrigue' && challenge.winner === this.controller
},
handler: () => {
this.game.promptForSelect(this.controller, {
cardCondition: card => card.location === 'play area' && card.getType() === 'character' &&
this.controller === card.controller && this.game.currentChallenge.isParticipating(card),
activePromptTitle: 'Select a character',
waitingPromptTitle: 'Waiting for opponent to use ' + this.name,
onSelect: (player, card) => this.onCardSelected(player, card)
});
}
});
}
onCardSelected(player, card) {
this.game.promptForSelect(this.controller, {
cardCondition: c => c.location === 'play area' && c.getType() === 'character' && c.getCost() < card.getCost(),
activePromptTitle: 'Select an opponent\'s character',
waitingPromptTitle: 'Waiting for opponent to use ' + this.name,
onSelect: (player, card) => this.onOpponentCardSelected(player, card)
});
this.selectedCard = card;
return true;
}
onOpponentCardSelected(player, card) {
card.controller.returnCardToHand(card);
this.game.addMessage('{0} uses {1} to return {2} to their hand and return {3} to {4}\'s hand', this.controller, this, this.selectedCard, card, card.controller);
return true;
}
}
TowerOfTheHand.code = '03030';
module.exports = TowerOfTheHand;
| cavnak/throneteki | server/game/cards/locations/03/towerofthehand.js | JavaScript | mit | 1,796 |
'use strict';
var assume = require('assume'),
defaultify = require('../../lib/defaultify');
describe('defaultify (unit)', function () {
it('should have expected defaults', function () {
var oldArgv = process.argv;
process.argv = [];
var defaults = defaultify();
process.argv = oldArgv;
assume(defaults.commands).deep.equals(['jscs', 'eslint']);
assume(defaults.targets).deep.equals(['lib']);
assume(defaults.rc).equals(undefined);
assume(defaults.fix).equals(undefined);
assume(defaults.reporter).equals(undefined);
assume(defaults.global).equals(undefined);
assume(defaults.exts).deep.equals(['.js']);
});
it('--rc');
it('--fix');
it('--reporter');
it('--global');
it('--command (one)');
it('--command (multiple)');
it('--ext (one)');
it('--ext (multiple)');
it('argv._ (one)');
it('argv._ (multiple)');
it('{ commands }');
it('{ targets }');
it('{ rc }');
it('{ fix }');
it('{ reporter }');
it('{ global }');
it('{ exts }');
});
| jansel/fashion-show | test/unit/defaultify.test.js | JavaScript | mit | 1,023 |
const config = require('./nightwatch.config');
config.globals_path = 'e2e/globals/dev';
module.exports = config;
| bitmoremedia/mygi | e2e/nightwatch.config.dev.js | JavaScript | mit | 114 |
$( document ).ready(function() {
$('.todo-list').on('click', 'a.update-todo', function (e) {
e.preventDefault();
var column = $(this).parent('li');
var status_info = $(this).siblings('span');
var ajax = $.post($(this).attr('href'));
ajax.done(function() {
var val = parseInt(status_info.data('status'));
console.log((val == 0) ? 'Done' : 'To Do');
status_info.html('<span class="todo-status">['+((val == 0) ? 'Done' : 'To Do')+']</span>');
status_info.data('status', (1 - val));
});
});
$('#todo-form').on('submit',function(e){
e.preventDefault();
$.ajax({
type : "POST",
cache : false,
url : $(this).attr('action'),
data : $(this).serialize(),
success : function(data) {
//console.log(data);
var $li = '<li><a class="update-todo" href="/todo/'+data.id+'/update">'+data.title+'</a><span class="todo-status todo" data-status="0">[To Do]</span><a class="delete-todo" href="/todo/'+data.id+'/delete">[X]</a></li>';
$('.todo-list').append($li);
$('#todo-form')[0].reset();
}
});
});
$('.todo-list').on('click', 'a.delete-todo', function (e) {
e.preventDefault();
var column = $(this).parent('li');
var status_info = $(this).siblings('span');
var ajax = $.post($(this).attr('href'));
ajax.done(function() {
column.remove();
});
});
/*$('.delete-link').click(function () {
var row = $(this).parent('td[class="center"]').parent('tr');
var ajax = $.post($(this).attr('href'));
ajax.done(function() { row.remove(); });
return false;
});*/
}); | nemone81/checklist | web/static/js/app.js | JavaScript | mit | 1,712 |
var Log = function() {
this.name = 'Log';
this.messages = [];
};
Log.prototype.log = function(location, message) {
this.messages.push({
type: 'log',
text: text,
location: location
});
};
Log.prototype.info = function(location, message) {
this.messages.push({
type: 'info',
text: text,
location: location
});
};
Log.prototype.debug = function(location, message) {
this.messages.push({
type: 'debug',
text: text,
location: location
});
};
Log.prototype.warn = function(location, message) {
this.messages.push({
type: 'warn',
text: text,
location: location
});
};
Log.prototype.error = function(location, message) {
this.messages.push({
type: 'error',
text: text,
location: location
});
};
Log.prototype.hasError = function() {
for (var i in this.messages) {
if (this.messages[i]['type'] == 'error') {
return true;
}
}
return false;
}; | after12am/toyscript | src/log.js | JavaScript | mit | 1,046 |
'use strict';
const url = require('url');
const express = require('express');
const bodyParser = require('body-parser');
const assert = require('assert');
class MockServer {
constructor (urlOrPort, done) {
this.handlerProcessed = 0;
if (typeof urlOrPort === 'number') {
this._port = urlOrPort;
} else {
const parsed = url.parse(urlOrPort);
this._port = parsed.port;
}
if (!this._app) {
this._app = express();
this._app.use(bodyParser.json());
this._server = this._app.listen(this._port, () => {
done();
});
this._handlers = [];
this._app.use((req, res) => {
const currentHandler = this._handlers.shift();
if (currentHandler) {
assert.equal(req.path, currentHandler.path, 'The path does not match');
this.handlerProcessed++;
currentHandler.handler(req, res);
} else {
throw new Error('No handler registered.');
}
});
}
}
handleNext (path, handler) {
this._handlers.push({ path, handler });
return this;
}
reset (done) {
this._handlers.splice(0, this._handlers.length);
this.handlerProcessed = 0;
done();
}
close (done) {
this._server.close();
done();
}
}
module.exports = MockServer;
| Storyous/features-js | test/utils/mockServer.js | JavaScript | mit | 1,515 |
import {Importer} from "./Importer";
import {URLLoader} from "./URLLoader";
import {DataStream} from "../core/DataStream";
import {Scene} from "../scene/Scene";
import {Mesh} from "../mesh/Mesh";
import {BlendFactor, BlendOperation, CullMode, DataType, ElementType, TextureFilter, TextureWrapMode} from "../Helix";
import {BasicMaterial} from "../material/BasicMaterial";
import {Material} from "../material/Material";
import {Entity} from "../entity/Entity";
import {Component} from "../entity/Component";
import {MeshInstance} from "../mesh/MeshInstance";
import {DirectionalLight} from "../light/DirectionalLight";
import {PointLight} from "../light/PointLight";
import {SpotLight} from "../light/SpotLight";
import {SceneNode} from "../scene/SceneNode";
import {SkeletonJoint} from "../animation/skeleton/SkeletonJoint";
import {PerspectiveCamera} from "../camera/PerspectiveCamera";
import {Color} from "../core/Color";
import {Float4} from "../math/Float4";
import {LightingModel} from "../render/LightingModel";
import {AmbientLight} from "../light/AmbientLight";
import {LightProbe} from "../light/LightProbe";
import {Texture2D} from "../texture/Texture2D";
import {AssetLibrary} from "./AssetLibrary";
import {JPG} from "./JPG_PNG";
import {BlendState} from "../render/BlendState";
import {Quaternion} from "../math/Quaternion";
import {Matrix4x4} from "../math/Matrix4x4";
import {Skeleton} from "../animation/skeleton/Skeleton";
import {AnimationClip} from "../animation/AnimationClip";
import {SkeletonAnimation} from "../animation/skeleton/SkeletonAnimation";
import {SkeletonXFadeNode} from "../animation/skeleton/SkeletonXFadeNode";
import {SkeletonPose} from "../animation/skeleton/SkeletonPose";
import {KeyFrame} from "../animation/KeyFrame";
import {SkeletonJointPose} from "../animation/skeleton/SkeletonJointPose";
import {AsyncTaskQueue} from "../utils/AsyncTaskQueue";
import {NormalTangentGenerator} from "../utils/NormalTangentGenerator";
import {TextureCube} from "../texture/TextureCube";
import {EquirectangularTexture} from "../utils/EquirectangularTexture";
import {Skybox} from "../scene/Skybox";
import {OrthographicCamera} from "../camera/OrthographicCamera";
import {Camera} from "../camera/Camera";
import {Float2} from "../math/Float2";
import {MorphTarget} from "../animation/morph/MorphTarget";
import {MorphAnimation} from "../animation/morph/MorphAnimation";
import {FileUtils} from "./FileUtils";
import {DDS} from "./DDS";
import {HDR} from "./HDR";
import {SphericalHarmonicsRGB} from "../math/SphericalHarmonicsRGB";
/**
* The data provided by the HX loader
*
* @property defaultScene The default scene (if provided)
* @property defaultCamera The default camera (if provided)
* @property scenes A map containing all scenes by name
* @property meshes A map containing all meshes by name
* @property materials A map containing all materials by name
* @property entities A map containing all entities by name
*
* @constructor
*
* @author derschmale <http://www.derschmale.com>
*/
function HXData()
{
this.defaultScene = null;
this.defaultCamera = null;
this.scenes = {};
this.meshes = {};
this.materials = {};
this.entities = {};
this.cameras = {};
}
var elementTypeLookUp = [
ElementType.POINTS,
ElementType.LINES,
ElementType.LINE_STRIP,
ElementType.LINE_LOOP,
ElementType.TRIANGLES,
ElementType.TRIANGLE_STRIP,
ElementType.TRIANGLE_FAN
];
var dataTypeLookUp = {
20: DataType.UNSIGNED_BYTE,
21: DataType.UNSIGNED_SHORT,
22: DataType.UNSIGNED_INT,
30: DataType.FLOAT
};
var cullModes = [CullMode.NONE, CullMode.FRONT, CullMode.BACK, CullMode.ALL];
var blendFactors = [
BlendFactor.ZERO, BlendFactor.ONE,
BlendFactor.SOURCE_COLOR, BlendFactor.ONE_MINUS_SOURCE_COLOR,
BlendFactor.SOURCE_ALPHA, BlendFactor.ONE_MINUS_SOURCE_ALPHA,
BlendFactor.DESTINATION_COLOR, BlendFactor.ONE_MINUS_DESTINATION_COLOR,
BlendFactor.DESTINATION_ALPHA, BlendFactor.ONE_MINUS_DESTINATION_ALPHA,
BlendFactor.SOURCE_ALPHA_SATURATE, BlendFactor.CONSTANT_ALPHA, BlendFactor.ONE_MINUS_CONSTANT_ALPHA
];
var blendOps = [
BlendOperation.ADD, BlendOperation.SUBTRACT, BlendOperation.REVERSE_SUBTRACT
];
var ObjectTypes = {
NULL: 0, // used as an end-of-list marker
SCENE: 1,
SCENE_NODE: 2,
ENTITY: 3,
MESH: 4,
BASIC_MATERIAL: 5,
MESH_INSTANCE: 6,
SKELETON: 7,
SKELETON_JOINT: 8, // must be linked to SKELETON in order of their index!
DIR_LIGHT: 9,
SPOT_LIGHT: 10,
POINT_LIGHT: 11,
AMBIENT_LIGHT: 12,
LIGHT_PROBE: 13,
PERSPECTIVE_CAMERA: 14,
ORTHOGRAPHIC_CAMERA: 15, // not currently supported
TEXTURE_2D: 16,
TEXTURE_CUBE: 17,
BLEND_STATE: 18,
ANIMATION_CLIP: 19,
SKELETON_ANIMATION: 20,
SKELETON_POSE: 21, // properties contain position, rotation, scale per joint
KEY_FRAME: 22,
SKYBOX: 23,
// 25 IS AVAILABLE AFTER DELETING ENTITY PROXY
MORPH_TARGET: 25,
MORPH_ANIMATION: 26,
SPERICAL_HARMONICS: 27
};
var ObjectTypeMap = {
2: SceneNode,
3: Entity,
6: MeshInstance,
7: Skeleton,
8: SkeletonJoint,
9: DirectionalLight,
10: SpotLight,
11: PointLight,
12: AmbientLight,
13: LightProbe,
14: PerspectiveCamera,
15: OrthographicCamera,
16: Texture2D,
17: TextureCube,
18: BlendState,
19: AnimationClip,
20: SkeletonAnimation,
23: Skybox,
// 24: IS AVAILABLE AFTER REMOVING ENTITYPROXY!
25: MorphTarget,
26: MorphAnimation,
27: SphericalHarmonicsRGB
};
// most ommitted properties take on their default value in Helix.
var PropertyTypes = {
// Common props // value types (all string end with \0, bool are 0 or 1 uint8s)
NULL: 0, // used as an end-of-list marker
NAME: 1, // string
URL: 2, // string, used to link to external assets (fe: textures)
CAST_SHADOWS: 3, // bool
COLOR: 4, // 3 floats: rgb
COLOR_ALPHA: 5, // 4 floats: rgba
DATA_TYPE: 6, // 1 uint8: see dataTypeLookUp
VALUE_TYPE: 7, // 1 uint8: 0: scalar, 1: Float3, 2: Float4, 3: Quaternion
VALUE: 8, // type depends on DATA_TYPE
NUM_ELEMENTS: 9, // generally indicated to know the size of arrays
// header (meta) props
VERSION: 10, // string formatted as "#.#.#"
GENERATOR: 11, // string
PAD_ARRAYS: 12, // bool, indicates whether or not typed array data is aligned in memory to its own element size (pre-padded with 0s)
DEFAULT_SCENE_INDEX: 13, // uint8
LIGHTING_MODE: 14, // uint8: 0: OFF, 1: FIXED, 2: DYNAMIC
// Mesh data
NUM_VERTICES: 20, // uint32
NUM_INDICES: 21, // uint32
ELEMENT_TYPE: 22, // uint8: index of elementTypeLookUp: if omitted, set to TRIANGLES
INDEX_TYPE: 23, // uint8, either 21 (uint16) or 22 (uint32) as defined by dataTypeLookUp
INDEX_DATA: 24, // list of length = numIndices and type defined by INDEX_TYPE. Must come after NUM_INDICES and INDEX_TYPES
VERTEX_ATTRIBUTE: 25, // value is tuplet <string name, uint8 numComponents, uint8 componentType [see DataTypes], uint8 streamIndex>
VERTEX_STREAM_DATA: 26, // raw data list, length depends on all the attributes for the current stream. Must come after NUM_VERTICES and all VERTEX_ATTRIBUTE fields and appear in order of their stream index.
// Scene Node / Entity data
POSITION: 30, // 3 float32 (xyz)
ROTATION: 31, // 4 float32 (xyzw quaternion)
SCALE: 32, // 3 float32 (xyz)
VISIBLE: 33, // bool
// Light data
INTENSITY: 40, // float32
RADIUS: 41, // float32
SPOT_ANGLES: 42, // 2 float32: inner and outer angle
SH_WEIGHTS: 43, // 1 uint8 (level), followed by (2 * level + 1) float32 triplets containing the weights for rgb
// texture data
WRAP_MODE: 50, // uint8: 0 = clamp, 1 = wrap
FILTER: 51, // uint8: 0 = nearest, 2 = bilinear, 3 = trilinear, 4, anisotropic, 5 = nearest no mip, 6 = bilinear no mip
// material properties
// COLOR: 4
USE_VERTEX_COLORS: 60, // bool
ALPHA: 61, // float32
EMISSIVE_COLOR: 62, // 3 float32 (rgb)
SPECULAR_MAP_MODE: 63, // uint8: 1 = roughness, 2 = roughness/normal reflectance/metallicness, 3 = share normal map, 4 = metallic/roughness
METALLICNESS: 64, // float32
SPECULAR_REFLECTANCE: 65, // float32
ROUGHNESS: 66, // float32
ROUGHNESS_RANGE: 67, // float32
ALPHA_THRESHOLD: 68, // float32
LIGHTING_MODEL: 69, // uint8: 0 = UNLIT, 1 = GGX, 2 = GGX_FULL, 3 = BLINN_PHONG, 4 = LAMBERT. If omitted, uses InitOptions default
CULL_MODE: 70, // uint8: 0 = None, 1 = front, 2 = back, 3 = all
BLEND_STATE: 71, // uint8: 0 = None, 2 = Add, 3 = Multiply, 4 = Alpha. If omitted, blend state can still be linked from an object definition
WRITE_DEPTH: 72, // bool
WRITE_COLOR: 73, // bool
// blend state properties
BLEND_STATE_SRC_FACTOR: 80, // uint8, see blendFactors index below
BLEND_STATE_DST_FACTOR: 81, // uint8, see blendFactors index below
BLEND_STATE_OPERATOR: 82, // uint8, see blendOperators index below
BLEND_STATE_SRC_FACTOR_ALPHA: 83, // uint8
BLEND_STATE_DST_FACTOR_ALPHA: 84, // uint8
BLEND_STATE_OPERATOR_ALPHA: 85, // uint8
// COLOR_ALPHA: 5
// camera properties:
CLIP_DISTANCES: 90, // 2 float32: near, far
FOV: 91, // float32: vertical fov
HEIGHT: 92, // float32: vertical height of orthographic projection
// skeleton / bone properties:
INVERSE_BIND_POSE: 100, // 12 float32s: a matrix in column-major order ignoring the last row (affine matrix always contains 0, 0, 0, 1)
// animation properties:
TIME: 110, // float32
LOOPING: 111, // uint8
PLAYBACK_RATE: 112, // float32
// material/texture mapping props
COLOR_MAP_SCALE: 120, // 2 float32 (u, v)
COLOR_MAP_OFFSET: 121, // 2 float32 (u, v)
NORMAL_MAP_SCALE: 122, // 2 float32 (u, v)
NORMAL_MAP_OFFSET: 123, // 2 float32 (u, v)
SPECULAR_MAP_SCALE: 124, // 2 float32 (u, v)
SPECULAR_MAP_OFFSET: 125, // 2 float32 (u, v)
MASK_MAP_SCALE: 126, // 2 float32 (u, v)
MASK_MAP_OFFSET: 127, // 2 float32 (u, v)
EMISSION_MAP_SCALE: 128, // 2 float32 (u, v)
EMISSION_MAP_OFFSET: 129, // 2 float32 (u, v)
POSITION_DATA: 140, // a flat list of float32 triplets (x, y, z), length must match number of vertices of target mesh
NORMAL_DATA: 141, // a flat list of float32 triplets (x, y, z), length must match number of vertices of target mesh
MORPH_WEIGHT: 142 // a 0-ended string (name of the target) followed by a float32 weight
};
/**
* @classdesc
* HX is an Importer for Helix' (binary) format. Yields a {@linkcode HXData} object.
*
* @constructor
*
* @extends Importer
*
* @author derschmale <http://www.derschmale.com>
*/
function HX()
{
Importer.call(this, URLLoader.DATA_BINARY);
this._objects = null;
this._scenes = null;
this._padArrays = true;
this._defaultSceneIndex = 0;
this._version = null;
this._generator = null;
this._lights = null;
this._dependencyLib = null;
}
HX.prototype = Object.create(Importer.prototype);
HX.VERSION = "0.1.0";
HX.prototype.parse = function(data, target)
{
this._target = target || new HXData();
this._stream = new DataStream(data);
var hash = this._stream.getString(2);
if (hash !== "HX") {
this._notifyFailure("Invalid file hash!");
return;
}
this._defaultSceneIndex = 0;
this._lightingMode = 0;
this._objects = [];
this._scenes = [];
this._meshes = [];
this._lights = null;
this._dependencyLib = new AssetLibrary(null, this.options.crossOrigin);
this._parseHeader();
this._parseObjectList();
this._target.defaultScene = this._scenes[this._defaultSceneIndex];
this._calcMissingMeshData();
};
HX.prototype._calcMissingMeshData = function()
{
var queue = new AsyncTaskQueue();
var generator = new NormalTangentGenerator();
for (var i = 0, len = this._meshes.length; i < len; ++i) {
var mode = 0;
var mesh = this._meshes[i];
if (!mesh.hasVertexAttribute("hx_normal"))
mode |= NormalTangentGenerator.MODE_NORMALS;
if (!mesh.hasVertexAttribute("hx_tangent"))
mode |= NormalTangentGenerator.MODE_TANGENTS;
queue.queue(generator.generate.bind(generator, mesh, mode));
}
queue.onComplete.bind(this._loadDependencies, this);
queue.execute();
};
HX.prototype._loadDependencies = function()
{
this._dependencyLib.onComplete.bind(this._onDependenciesLoaded, this);
this._dependencyLib.onProgress.bind(this._notifyProgress, this);
this._dependencyLib.load();
}
HX.prototype._onDependenciesLoaded = function()
{
this._parseLinkList();
this._notifyComplete(this._target);
};
HX.prototype._parseHeader = function()
{
var type;
var data = this._stream;
do {
type = data.getUint32();
switch (type) {
case PropertyTypes.PAD_ARRAYS:
this._padArrays = !!data.getUint8();
break;
case PropertyTypes.DEFAULT_SCENE_INDEX:
this._defaultSceneIndex = data.getUint8();
break;
case PropertyTypes.LIGHTING_MODE:
this._lightingMode = data.getUint8();
if (this._lightingMode === 1)
this._lights = [];
break;
case PropertyTypes.VERSION:
this._version = data.getString();
break;
case PropertyTypes.GENERATOR:
this._generator = data.getString();
break;
}
} while (type !== PropertyTypes.NULL);
if (this._version !== HX.VERSION) {
this._notifyFailure("Incompatible file version!");
return;
}
};
HX.prototype._parseObjectList = function()
{
var type, object;
var data = this._stream;
do {
type = data.getUint32();
switch (type) {
case ObjectTypes.SCENE:
object = this._parseObject(Scene, data);
this._scenes.push(object);
this._target.scenes[object.name] = object;
break;
case ObjectTypes.MESH:
object = this._parseObject(Mesh, data);
this._meshes.push(object);
this._target.meshes[object.name] = object;
break;
case ObjectTypes.BASIC_MATERIAL:
object = this._parseBasicMaterial(data);
this._target.materials[object.name] = object;
break;
case ObjectTypes.SKELETON_POSE:
object = this._parseSkeletonPose(data);
break;
case ObjectTypes.KEY_FRAME:
object = this._parseKeyFrame(data);
break;
case ObjectTypes.PERSPECTIVE_CAMERA:
case ObjectTypes.ORTHOGRAPHIC_CAMERA:
object = this._parseObject(ObjectTypeMap[type], data);
this._target.cameras[object.name] = object;
break;
case ObjectTypes.ENTITY:
object = this._parseObject(ObjectTypeMap[type], data);
while (this._target.entities[object.name])
object.name = object.name + "_";
this._target.entities[object.name] = object;
break;
case ObjectTypes.NULL:
return;
case ObjectTypes.DIR_LIGHT:
case ObjectTypes.POINT_LIGHT:
case ObjectTypes.SPOT_LIGHT:
case ObjectTypes.AMBIENT_LIGHT:
case ObjectTypes.LIGHT_PROBE:
object = this._parseObject(ObjectTypeMap[type], data);
if (this._lights && object)
this._lights.push(object);
break;
default:
var classType = ObjectTypeMap[type];
if (classType)
object = this._parseObject(classType, data);
else {
this._notifyFailure("Unknown object type " + type + " at 0x" + (data.offset - 4).toString(16));
}
}
if (object)
this._objects.push(object);
} while (type !== ObjectTypes.NULL);
};
HX.prototype._parseObject = function(type, data)
{
var object = new type();
this._readProperties(data, object);
return object;
};
HX.prototype._parseKeyFrame = function(data)
{
var frame = new KeyFrame();
var dataType = DataType.FLOAT;
var valueType = 0;
var type;
do {
type = data.getUint32();
// it's legal to only provide fe: position data, but fields can't be "sparsely" omitted
// if one joint pose contains it, all joint poses should contain it
switch (type) {
case PropertyTypes.TIME:
frame.time = data.getFloat32();
break;
case PropertyTypes.DATA_TYPE:
dataType = dataTypeLookUp[data.getUint8()];
break;
case PropertyTypes.VALUE_TYPE:
valueType = data.getUint8();
break;
case PropertyTypes.VALUE:
frame.value = parseValue(dataType, valueType, data);
break;
}
} while (type !== PropertyTypes.NULL);
return frame;
};
HX.prototype._parseSkeletonPose = function(data)
{
var pose = new SkeletonPose();
var posIndex = 0;
var rotIndex = 0;
var scaleIndex = 0;
function getJointPose(index) {
if (!pose.getJointPose(index))
pose.setJointPose(index, new SkeletonJointPose());
return pose.getJointPose(index);
}
var type;
do {
type = data.getUint32();
// it's legal to only provide fe: position data, but fields can't be "sparsely" omitted
// if one joint pose contains it, all joint poses should contain it
switch (type) {
case PropertyTypes.POSITION:
parseVector3(data, getJointPose(posIndex++).position);
break;
case PropertyTypes.ROTATION:
parseQuaternion(data, getJointPose(rotIndex++).rotation);
break;
case PropertyTypes.SCALE:
parseVector3(data, getJointPose(scaleIndex++).scale);
break;
}
} while (type !== PropertyTypes.NULL);
return pose;
};
HX.prototype._parseBasicMaterial = function(data)
{
// TODO: May have to add to this in case it's a custom material
var material = new BasicMaterial();
material.roughness = .5;
if (this._lightingMode === 1)
material.fixedLights = this._lights;
this._readProperties(data, material);
return material;
};
HX.prototype._readProperties = function(data, target)
{
var type;
var numElements;
do {
type = data.getUint32();
switch (type) {
case PropertyTypes.NAME:
target.name = data.getString();
break;
case PropertyTypes.URL:
this._handleURL(data.getString(), target);
break;
case PropertyTypes.CAST_SHADOWS:
target.castShadows = !!data.getUint8();
break;
case PropertyTypes.NUM_VERTICES:
target._numVertices = data.getUint32();
break;
case PropertyTypes.NUM_INDICES:
target._numIndices = data.getUint32();
break;
case PropertyTypes.INDEX_TYPE:
target._indexType = dataTypeLookUp[data.getUint8()];
break;
case PropertyTypes.INDEX_DATA:
parseIndexData(data, target, this);
break;
case PropertyTypes.ELEMENT_TYPE:
target.elementType = elementTypeLookUp[data.getUint8()];
break;
case PropertyTypes.VERTEX_ATTRIBUTE:
parseVertexAttribute(data, target);
break;
case PropertyTypes.VERTEX_STREAM_DATA:
parseVertexStreamData(data, target, this);
break;
case PropertyTypes.NUM_ELEMENTS:
// store this locally, just used for an upcoming array
numElements = data.getUint32();
break;
case PropertyTypes.POSITION_DATA:
target.setPositionData(parseMorphTargetData(data, numElements, this));
break;
case PropertyTypes.NORMAL_DATA:
target.setNormalData(parseMorphTargetData(data, numElements, this));
break;
case PropertyTypes.MORPH_WEIGHT:
target.setWeight(data.getString(), data.getFloat32());
break;
case PropertyTypes.POSITION:
parseVector3(data, target.position);
break;
case PropertyTypes.ROTATION:
parseQuaternion(data, target.rotation);
break;
case PropertyTypes.SCALE:
parseVector3(data, target.scale);
break;
case PropertyTypes.VISIBLE:
target.visible = !!data.getUint8();
break;
case PropertyTypes.COLOR:
target.color = parseColor(data);
break;
case PropertyTypes.COLOR_ALPHA:
target.color = parseColorRGBA(data);
break;
case PropertyTypes.INTENSITY:
target.intensity = data.getFloat32();
break;
case PropertyTypes.RADIUS:
target.radius = data.getFloat32();
break;
case PropertyTypes.SPOT_ANGLES:
target.innerAngle = data.getFloat32();
target.outerAngle = data.getFloat32();
break;
case PropertyTypes.SH_WEIGHTS:
var l = data.getInt8();
for (var m = -l; m <= l; ++m) {
var w = new Float4(data.getFloat32(), data.getFloat32(), data.getFloat32());
target.setWeight(l, m, w);
}
break;
case PropertyTypes.WRAP_MODE:
target.wrapMode = data.getUint8()? TextureWrapMode.REPEAT : TextureWrapMode.CLAMP;
break;
case PropertyTypes.FILTER:
target.filter = [
TextureFilter.NEAREST, TextureFilter.BILINEAR, TextureFilter.TRILINEAR,
TextureFilter.TRILINEAR_ANISOTROPIC || TextureFilter.TRILINEAR,
TextureFilter.NEAREST_NOMIP, TextureFilter.BILINEAR_NOMIP
][data.getUint8()];
break;
case PropertyTypes.USE_VERTEX_COLORS:
target.useVertexColors = !!data.getUint8();
break;
case PropertyTypes.ALPHA:
target.alpha = data.getFloat32();
break;
case PropertyTypes.EMISSIVE_COLOR:
target.emissiveColor = parseColor(data);
break;
case PropertyTypes.SPECULAR_MAP_MODE:
target.specularMapMode = data.getUint8();
break;
case PropertyTypes.METALLICNESS:
target.metallicness = data.getFloat32();
break;
case PropertyTypes.SPECULAR_REFLECTANCE:
target.normalSpecularReflectance = data.getFloat32();
break;
case PropertyTypes.ROUGHNESS:
target.roughness = data.getFloat32();
break;
case PropertyTypes.ROUGHNESS_RANGE:
target.roughnessRange = data.getFloat32();
break;
case PropertyTypes.ALPHA_THRESHOLD:
target.alphaThreshold = data.getFloat32();
break;
case PropertyTypes.LIGHTING_MODEL:
target.lightingModel = parseLightingModel(data);
break;
case PropertyTypes.CULL_MODE:
target.cullMode = cullModes[data.getUint8()];
break;
case PropertyTypes.BLEND_STATE:
target.blendState = [null, BlendState.ADD, BlendState.MULTIPLY, BlendState.ALPHA][data.getUint8()];
break;
case PropertyTypes.WRITE_DEPTH:
target.writeDepth = !!data.getUint8();
break;
case PropertyTypes.WRITE_COLOR:
target.writeColor = !!data.getUint8();
break;
case PropertyTypes.COLOR_MAP_SCALE:
target.colorMapScale = new Float2(data.getFloat32(), data.getFloat32());
break;
case PropertyTypes.COLOR_MAP_OFFSET:
target.colorMapOffset = new Float2(data.getFloat32(), data.getFloat32());
break;
case PropertyTypes.NORMAL_MAP_SCALE:
target.normalMapScale = new Float2(data.getFloat32(), data.getFloat32());
break;
case PropertyTypes.NORMAL_MAP_OFFSET:
target.normalMapOffset = new Float2(data.getFloat32(), data.getFloat32());
break;
case PropertyTypes.SPECULAR_MAP_SCALE:
target.specularMapScale = new Float2(data.getFloat32(), data.getFloat32());
break;
case PropertyTypes.SPECULAR_MAP_OFFSET:
target.specularMapOffset = new Float2(data.getFloat32(), data.getFloat32());
break;
case PropertyTypes.EMISSION_MAP_SCALE:
target.emissionMapScale = new Float2(data.getFloat32(), data.getFloat32());
break;
case PropertyTypes.EMISSION_MAP_OFFSET:
target.emissionMapOffset = new Float2(data.getFloat32(), data.getFloat32());
break;
case PropertyTypes.MASK_MAP_SCALE:
target.maskMapScale = new Float2(data.getFloat32(), data.getFloat32());
break;
case PropertyTypes.MASK_MAP_OFFSET:
target.maskMapOffset = new Float2(data.getFloat32(), data.getFloat32());
break;
case PropertyTypes.BLEND_STATE_SRC_FACTOR:
target.srcFactor = blendFactors[data.getUint8()];
break;
case PropertyTypes.BLEND_STATE_DST_FACTOR:
target.dstFactor = blendFactors[data.getUint8()];
break;
case PropertyTypes.BLEND_STATE_OPERATOR:
target.operator = blendOps[data.getUint8()];
break;
case PropertyTypes.BLEND_STATE_SRC_FACTOR_ALPHA:
target.alphaSrcFactor = blendFactors[data.getUint8()];
break;
case PropertyTypes.BLEND_STATE_DST_FACTOR_ALPHA:
target.alphaDstFactor = blendFactors[data.getUint8()];
break;
case PropertyTypes.BLEND_STATE_OPERATOR_ALPHA:
target.alphaOperator = blendOps[data.getUint8()];
break;
case PropertyTypes.CLIP_DISTANCES:
target.nearDistance = data.getFloat32();
target.farDistance = data.getFloat32();
break;
case PropertyTypes.FOV:
target.verticalFOV = data.getFloat32();
break;
case PropertyTypes.HEIGHT:
target.height = data.getFloat32();
break;
case PropertyTypes.INVERSE_BIND_POSE:
parseAffineMatrix(data, target.inverseBindPose);
break;
case PropertyTypes.LOOPING:
target.looping = !!data.getUint8();
break;
case PropertyTypes.PLAYBACK_RATE:
target.playbackRate = data.getFloat32();
break;
}
} while (type !== PropertyTypes.NULL)
};
HX.prototype._handleURL = function(url, target)
{
var ext = FileUtils.extractExtension(url);
var dependencyType;
switch (ext) {
case "jpg":
case "jpeg":
case "png":
dependencyType = JPG;
break;
case "dds":
dependencyType = DDS;
break;
case "hdr":
case "rgbe":
dependencyType = HDR;
break;
default:
// fallbacks for missing extensions
if (target instanceof Texture2D)
dependencyType = JPG;
}
this._dependencyLib.queueAsset(name, this._correctURL(url), AssetLibrary.Type.ASSET, dependencyType, null, target);
};
function parseValue(dataType, valueType, data)
{
var func;
switch (dataType) {
case DataType.UNSIGNED_BYTE:
func = "getUint8";
break;
case DataType.UNSIGNED_SHORT:
func = "getUint16";
break;
case DataType.UNSIGNED_INT:
func = "getUint32";
break;
case DataType.FLOAT:
func = "getFloat32";
break;
}
if (valueType === 1)
return new Float4(data[func](), data[func](), data[func]());
if (valueType === 2)
return new Float4(data[func](), data[func](), data[func](), data[func]());
if (valueType === 3)
return new Quaternion(data[func](), data[func](), data[func](), data[func]());
return data[func]();
}
function parseLightingModel(data)
{
var id = data.getUint8();
if (id === 0) return LightingModel.Unlit;
if (id === 1) return LightingModel.GGX;
if (id === 2) return LightingModel.GGX_FULL;
if (id === 3) return LightingModel.BlinnPhong;
if (id === 4) return LightingModel.Lambert;
}
function parseColor(data, target)
{
target = target || new Color();
target.set(data.getFloat32(), data.getFloat32(), data.getFloat32());
return target;
}
function parseColorRGBA(data, target)
{
target = parseColor(data, target);
target.a = data.getFloat32();
return target;
}
function parseAffineMatrix(data, target)
{
if (target)
target.copyFrom(Matrix4x4.IDENTITY);
else
target = new Matrix4x4();
for (var c = 0; c < 4; ++c) {
for (var r = 0; r < 3; ++r) {
target.setElement(r, c, data.getFloat32())
}
}
return target;
}
function parseVector3(data, target)
{
target = target || new Float4();
target.set(data.getFloat32(), data.getFloat32(), data.getFloat32());
return target;
}
function parseQuaternion(data, target)
{
target = target || new Quaternion();
target.set(data.getFloat32(), data.getFloat32(), data.getFloat32(), data.getFloat32());
return target;
}
function parseIndexData(data, target, parser)
{
var indexData;
if (target._indexType === DataType.UNSIGNED_SHORT) {
if (parser._padArrays) data.skipAlign(2);
indexData = data.getUint16Array(target._numIndices);
}
else {
if (parser._padArrays) data.skipAlign(4);
indexData = data.getUint32Array(target._numIndices);
}
target.setIndexData(indexData);
}
function parseVertexAttribute(data, target)
{
var name = data.getString();
var numComponents = data.getUint8();
var dataType = dataTypeLookUp[data.getUint8()];
var streamIndex = data.getUint8();
console.assert(dataType === DataType.FLOAT, "HX only supports float32 vertex attribute data");
target.addVertexAttribute(name, numComponents, streamIndex, name === "hx_normal" || name === "hx_tangent");
}
function parseMorphTargetData(data, numElements, parser)
{
if (parser._padArrays)
data.skipAlign(4);
return data.getFloat32Array(numElements);
}
function parseVertexStreamData(data, target, parser)
{
var dataLen = target._numVertices * target.getVertexStride(0);
if (parser._padArrays)
data.skipAlign(4);
var streamData = data.getFloat32Array(dataLen);
// get the first stream that doesn't have data yet
var streamIndex = 0;
while (target._vertexData[streamIndex])
++streamIndex;
target.setVertexData(streamData, streamIndex);
}
HX.prototype._parseLinkList = function()
{
var data = this._stream;
var skeletons = {}; // keeps track of which skeletons the bones belong to
var skeletonLinks = [];
var skeletonAnimationLinks = [];
var deferredCommands = [];
while (data.bytesAvailable) {
var parentId = data.getUint32();
var childId = data.getUint32();
var meta = data.getUint8();
var parent = this._objects[parentId];
var child = this._objects[childId];
// these have to be handled later because their assignment requires their own links to be complete first
if (child instanceof Skeleton) {
skeletonLinks.push({child: child, parent: parent, meta: meta});
continue;
}
else if (child instanceof SkeletonAnimation) {
skeletonAnimationLinks.push({child: child, parent: parent, meta: meta});
continue;
}
if (parent instanceof Scene)
linkToScene(parent, child, meta, this._target);
else if (parent instanceof Entity)
linkToEntity(parent, child, meta, this._target);
else if (parent instanceof SceneNode)
linkToSceneNode(parent, child, meta, this._target);
else if (parent instanceof MeshInstance)
linkToMeshInstance(parent, child);
else if (parent instanceof Mesh)
linkToMesh(parent, child);
else if (parent instanceof Material)
linkToMaterial(parent, child, meta);
else if (parent instanceof LightProbe)
linkToLightProbe(parent, child, meta);
else if (parent instanceof Skybox)
linkToSkyBox(parent, child, meta);
else if (parent instanceof Skeleton) {
linkToSkeleton(parent, child, -1);
skeletons[childId] = parent;
}
else if (parent instanceof SkeletonJoint) {
var skeleton = skeletons[parentId];
linkToSkeleton(skeleton, child, skeleton.joints.indexOf(parent));
skeletons[childId] = skeleton;
}
else if (parent instanceof SkeletonAnimation) {
linkToSkeletonAnimation(parent, child, meta, deferredCommands);
}
else if (parent instanceof KeyFrame) {
parent.value = child;
}
else if (parent instanceof AnimationClip) {
parent.addKeyFrame(child);
}
}
// all joints are assigned now:
for (var i = 0, len = skeletonLinks.length; i < len; ++i) {
var link = skeletonLinks[i];
parent = link.parent;
child = link.child;
parent.skeleton = child;
}
for (i = 0, len = skeletonAnimationLinks.length; i < len; ++i) {
var link = skeletonAnimationLinks[i];
parent = link.parent;
child = link.child;
parent.addComponent(child);
}
for (i = 0, len = deferredCommands.length; i < len; ++i)
deferredCommands[i]();
};
function linkToSceneNode(node, child, meta, hx)
{
if (child instanceof SceneNode) {
node.attach(child);
if (child instanceof Camera && meta === 1)
hx.defaultCamera = child;
}
}
function linkToEntity(entity, child, meta, hx)
{
if (child instanceof Component) {
entity.addComponent(child);
return;
}
linkToSceneNode(entity, child, meta, hx);
}
function linkToScene(scene, child, meta, hx)
{
if (child instanceof Skybox) {
scene.skybox = child;
return;
}
linkToEntity(scene, child, meta, hx);
}
var MaterialLinkMetaProp = {
0: "colorMap",
1: "normalMap",
2: "specularMap",
3: "occlusionMap",
4: "emissionMap",
5: "maskMap"
};
function linkToMaterial(material, child, meta)
{
if (child instanceof BlendState)
material.blendState = child;
else if (child instanceof Texture2D)
material[MaterialLinkMetaProp[meta]] = child;
}
function linkToMeshInstance(meshInstance, child)
{
if (child instanceof Material)
meshInstance.material = child;
else if (child instanceof Mesh)
meshInstance.mesh = child;
}
function linkToMesh(mesh, child)
{
if (child instanceof MorphTarget)
mesh.addMorphTarget(child);
}
function linkToSkyBox(probe, child)
{
if (child instanceof Texture2D)
child = EquirectangularTexture.toCube(child, child.height, true);
skybox.setTexture(child);
}
function linkToLightProbe(probe, child)
{
if (child instanceof Texture2D)
child = EquirectangularTexture.toCube(child, child.height, true);
if (child instanceof SphericalHarmonicsRGB)
parent.diffuseSH = child;
else
parent.specularTexture = child;
}
function linkToSkeleton(skeleton, child, parentIndex)
{
child.parentIndex = parentIndex;
skeleton.joints.push(child);
}
function linkToSkeletonAnimation(animation, child, meta, deferredCommands)
{
if (child instanceof AnimationClip) {
if (!animation.animationNode)
animation.animationNode = new SkeletonXFadeNode();
console.assert(animation.animationNode instanceof SkeletonXFadeNode, "Can't assign clip directly to skeleton when also assigning blend trees");
animation.animationNode.addClip(child);
if (meta === 1)
deferredCommands.push(animation.animationNode.fadeTo.bind(animation.animationNode, child.name, 0, false));
}
}
export {HX, HXData}; | DerSchmale/helixjs | src/helix-core/loaders/HX.js | JavaScript | mit | 33,152 |
var Stats = require('fast-stats').Stats;
var utils = require('./utils');
function TestRunner(test, options, cb) {
this.cb = cb || typeof options === 'function' && options || utils.noop;
this.done = this.done.bind(this);
this.execute = this.execute.bind(this);
this.options = options;
this.start = null;
this.startDate = new Date();
this.stats = new Stats();
this.test = test;
this.emit('test-start', test.name);
}
TestRunner.prototype = {
done: function () {
var t = process.hrtime(this.start);
this.stats.push(t[0] * 1000 + t[1] / 1000000); // nano to ms
setImmediate(this.execute);
},
emit: function (name, value) {
this.options && this.options.reporter && this.options.reporter.emit(name, value);
},
execute: function () {
var avg = this.stats.amean();
var err = Math.round((this.stats.moe() / avg) * 10000) / 100;
var hasTimeout = new Date() - this.startDate >= (this.test.maxDuration || 1000);
var hasReachedErrMargin = this.stats.length > 2 && err < (this.test.targetError || 5);
if (hasTimeout || hasReachedErrMargin) {
var r = this.stats.range();
var result = {
avg: avg,
err: err,
max: r[1],
min: r[0],
name: this.test.name,
samples: this.stats.length,
sd: this.stats.σ(),
type: 'test-result'
};
this.emit('test-end', result);
this.cb(null, result);
} else {
this.start = process.hrtime();
this.test.func(this.done);
}
}
};
module.exports = function (test, options, cb) {
new TestRunner(test, options, cb).execute();
}; | danylaporte/arewefaster | src/testRunner.js | JavaScript | mit | 1,801 |
//the grid singleton. Contains all properties about the grid as well as methods to create and resize the grid
var Grid = {
canvas: null,
grid_size: 30,
min_grid_size:14,
px_per_cm: 1, //number of pixels per cm
lines: [], //to keep track of the lines created so they can be removed
//Removes the current Grid
removeGrid: function() {
for (var i = 0; i < Grid.lines.length; i++) {
Grid.canvas.remove(Grid.lines[i]);
}
},
//Removes the current grid and recreates it based on the grid size
createGrid: function() {
Grid.removeGrid();
var line;
//create the harizontal lines of the grid
for (i = 0; i < this.canvas.width; i += this.grid_size) {
line = new fabric.Line([i, 0, i, this.canvas.height * 2], {
stroke: '#ccc',
selectable: false
});
Grid.lines.push(line);
Grid.canvas.add(line);
Grid.canvas.sendToBack(line);
}
//create the vertical lines of the grid
for (i = 0; i < Grid.canvas.height; i += Grid.grid_size) {
line = new fabric.Line([0, i, Grid.canvas.width * 2, i], {
stroke: '#ccc',
selectable: false
});
Grid.lines.push(line);
Grid.canvas.add(line);
Grid.canvas.sendToBack(line);
}
},
calcPxPerCm: function(EntityController){
if(EntityController.supportA && EntityController.loadedPin){
this.px_per_cm=(EntityController.loadedPin.left-EntityController.supportA.left)/(EntityController.crane_length);
}
}
};
module.exports = Grid; | sergei1152/CraneBoom.js | scripts/Grid.js | JavaScript | mit | 1,703 |
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-typescript');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
cssmin: {
with_banner: {
options: {
banner: '/* Minified CSS of <%= pkg.name %> */\n'
},
files: {
'../public/css/all.min.css': ['../styles/*.css']
}
},
},
uglify: {
options: {
banner: '/* Minified JavaScript of <%= pkg.name %> */\n'
},
my_target: {
files: {
'../public/js/all.min.js': [
'../app/**/*.js',
'../app/*.js'
]
}
}
},
typescript: {
base: {
src: ['lib/**/*.ts'],
dest: 'js/server.js',
options: {
module: 'amd',
target: 'es5'
}
}
},
watch: {
options: {
livereload: true,
spawn: false
},
css: {
files: '../styles/*.css',
tasks: ['cssmin']
},
js: {
files: [
'../app/*.js',
'../app/**/*.js'
],
tasks: ['uglify']
},
ts: {
files: '**/*.ts',
tasks: ['typescript']
}
},
connect: {
server: {
options: {
port: 8082,
base: '../'
}
}
},
open: {
dev: {
path: 'http://localhost:8082/index.html'
}
}
});
grunt.registerTask('default', ['connect', 'open', 'watch', 'cssmin', 'uglify']);
} | rpresb/AngularWithTypeScript | server/Gruntfile.js | JavaScript | mit | 2,271 |
"use strict";
var Mensagem = (function () {
function Mensagem() {
}
return Mensagem;
}());
exports.Mensagem = Mensagem;
//# sourceMappingURL=Mensagem.js.map | fabioresende/BrasilConf-Front | app/dashboard/Mensagem.js | JavaScript | mit | 168 |
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('/Plugin/masonry', ['exports', 'jquery', 'Plugin'], factory);
} else if (typeof exports !== "undefined") {
factory(exports, require('jquery'), require('Plugin'));
} else {
var mod = {
exports: {}
};
factory(mod.exports, global.jQuery, global.Plugin);
global.PluginMasonry = mod.exports;
}
})(this, function (exports, _jquery, _Plugin2) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = babelHelpers.interopRequireDefault(_jquery);
var _Plugin3 = babelHelpers.interopRequireDefault(_Plugin2);
var NAME = 'masonry';
var Masonry = function (_Plugin) {
babelHelpers.inherits(Masonry, _Plugin);
function Masonry() {
babelHelpers.classCallCheck(this, Masonry);
return babelHelpers.possibleConstructorReturn(this, (Masonry.__proto__ || Object.getPrototypeOf(Masonry)).apply(this, arguments));
}
babelHelpers.createClass(Masonry, [{
key: 'getName',
value: function getName() {
return NAME;
}
}, {
key: 'render',
value: function render() {
if (typeof _jquery2.default.fn.masonry === 'undefined') {
return;
}
var $el = this.$el;
if (_jquery2.default.fn.imagesLoaded) {
$el.imagesLoaded(function () {
$el.masonry(this.options);
});
} else {
$el.masonry(this.options);
}
}
}], [{
key: 'getDefaults',
value: function getDefaults() {
return {
itemSelector: '.masonry-item'
};
}
}]);
return Masonry;
}(_Plugin3.default);
_Plugin3.default.register(NAME, Masonry);
exports.default = Masonry;
});
| harinathebc/sample_codeigniter | assets/js/Plugin/masonry.js | JavaScript | mit | 1,814 |
var express = require('express');
var bodyParser = require('body-parser');
var request = require('request');
var hnbot = require('./sources/hnbot');
var phbot = require('./sources/phbot');
var config = require('./config');
var app = express();
var port = process.env.PORT || 3000;
// body parser middleware
app.use(bodyParser.urlencoded({ extended: true }));
// test route
app.get('/', function (req, res) { res.status(200).send('Hello world!') });
app.get('/news', function(req, res, next) {
if (!config.SLACK_WEBHOOK_URL)
{
res.status(500);
res.send("Please configure your Slack webhook Url first");
return;
}
var query = req.query.text ? req.query.text.toLowerCase() : null;
var bot = hnbot;
if (phbot.aliases.indexOf(query) > -1) {
bot = phbot;
}
bot.pingAndSend(function(err, payload) {
if (err || !payload) {
console.warn('Error fetching data : ');
console.log(err);
return res.status(500).end();
}
payload.channel = req.query.channel_id;
payload.icon_url = 'http://i.imgur.com/YaC3BuK.jpg';
request.post({
url: config.SLACK_WEBHOOK_URL,
body: JSON.stringify(payload)
}, function(err, resp, data) {
if (err) {
return res.status(500).end();
}
res.send('♡');
});
});
});
// error handler
app.use(function (err, req, res, next) {
console.error(err.stack);
res.status(400).send(err.message);
});
app.listen(port, function () {
console.log('Slack News bot listening on port ' + port);
});
| nicolsc/slack-news | app.js | JavaScript | mit | 1,546 |
/**
* gulp タスクから参照される設定です。
* @type {Object}
*/
var path = {
src: './src',
dest: './public'
};
module.exports = {
/**
* 開発用ビルド。
* @type {Object}
*/
build: {
depends: [ 'js', 'css' ]
},
/**
* リリース用ビルド。
* @type {Object}
*/
release: {
depends: [ 'copy', 'useref' ]
},
/**
* リリース用ディレクトリの削除。
* @type {Object}
*/
clean: {
src: [path.src + '/bundle.*'],
dest: path.dest
},
copy: {
src: path.src,
dest: path.dest,
html: path.src + '/*.html',
css: path.src + '/css/*.css',
vendor: path.src + '/vendor/*',
img: path.src + '/img/*'
},
/**
* JavaScript ビルド。
* この設定は js、js-release、watchify で共有されます。
* @type {Object}
*/
js: {
src: path.src,
dest: path.dest,
bundle: 'bundle.js',
browserify: {
debug: true
}
},
/**
* 既定タスク。
* @type {Object}
*/
default: {
depends: [ 'watchify', 'watch' ]
}
}; | ASO-SQLGenerator/ASO-SQLGenerator | gulp/config.js | JavaScript | mit | 1,083 |
/*************************************************
* Wowchemy
* https://github.com/wowchemy/wowchemy-hugo-modules
*
* Algolia based search algorithm.
**************************************************/
if ((typeof instantsearch === 'function') && $('#search-box').length) {
function getTemplate(templateName) {
return document.querySelector(`#${templateName}-template`).innerHTML;
}
const options = {
appId: algoliaConfig.appId,
apiKey: algoliaConfig.apiKey,
indexName: algoliaConfig.indexName,
routing: true,
searchParameters: {
hitsPerPage: 10
},
searchFunction: function (helper) {
let searchResults = document.querySelector('#search-hits')
if (helper.state.query === '') {
searchResults.style.display = 'none';
return;
}
helper.search();
searchResults.style.display = 'block';
}
};
const search = instantsearch(options);
// Initialize search box.
search.addWidget(
instantsearch.widgets.searchBox({
container: '#search-box',
autofocus: false,
reset: true,
poweredBy: algoliaConfig.poweredBy,
placeholder: i18n.placeholder
})
);
// Initialize search results.
search.addWidget(
instantsearch.widgets.infiniteHits({
container: '#search-hits',
escapeHits: true,
templates: {
empty: '<div class="search-no-results">' + i18n.no_results + '</div>',
item: getTemplate('search-hit-algolia')
},
cssClasses: {
showmoreButton: 'btn btn-outline-primary'
}
})
);
// On render search results, localize the content type metadata.
search.on('render', function () {
$('.search-hit-type').each(function (index) {
let content_key = $(this).text();
if (content_key in content_type) {
$(this).text(content_type[content_key]);
}
});
});
// Start search.
search.start();
}
| ShKlinkenberg/site | themes/github.com/wowchemy/wowchemy-hugo-modules/wowchemy/assets/js/algolia-search.js | JavaScript | mit | 1,928 |
import {page} from 'sitegen/routing';
export let route = page('./site/Site');
| prometheusresearch/react-ui | sitegen.config.js | JavaScript | mit | 79 |
var _ = require('lodash');
var elo = require('elo-rank')(100);
var addMatch2Scoreboard = (board, match) => {
var winners = match.winner.players;
var losers = match.loser.players;
var calcPreRating = (sum, ply) => {
var player = board[ply.name] = board[ply.name] || playerModel(ply.name);
return player.rating + sum;
};
var preRatingWinner = _.reduce(winners, calcPreRating, 0);
var preRatingLoser = _.reduce(losers, calcPreRating, 0);
var expectedWinner = elo.getExpected(preRatingWinner, preRatingLoser);
var expectedLoser = elo.getExpected(preRatingLoser, preRatingWinner);
_.each(match.winner.players, (player) => {
var score = board[player.name];
score.rating = elo.updateRating(expectedWinner, 1, score.rating);
score.points += 3;
score.games += 1;
score.wins += 1;
});
_.each(match.loser.players, (player) => {
var score = board[player.name];
score.rating = elo.updateRating(expectedLoser, 0, score.rating);
score.games += 1;
score.loss += 1;
});
}
function playerModel(name) {
return {playername: name, games: 0, wins: 0, loss: 0, points: 0, rating: 800};
}
function Scoreboard(matches) {
return _(matches).chain()
.filter((match) => {
return !match.invalid;
})
.reduce((scores, match) => {
addMatch2Scoreboard(scores, match);
return scores;
}, {})
.toArray()
.sortBy('rating')
.reverse()
.value();
}
module.exports = Scoreboard;
| Krafthack/ladders | api/model/scoreboard.js | JavaScript | mit | 1,445 |
import babel from 'rollup-plugin-babel';
import license from 'rollup-plugin-license';
import fs from 'fs';
var banner = '' +
'<%= pkg.name %>@<%= pkg.version %> \n' +
'<%= pkg.homepage %> \n\n' +
'@license \n\n';
// Load license and add to banner
banner += fs.readFileSync(__dirname + '/LICENSE', 'utf-8');
banner = banner + '\n@license\n';
export default {
input: 'src/index.js',
output: {
file: 'dist/attriboots.js',
format: 'umd',
name: 'attriboots',
sourceMap: true
},
plugins: [
license({
sourceMap: true,
banner: banner
}),
babel()
]
}; | okitu/attriboots | rollup.config.js | JavaScript | mit | 658 |
require("@babel/polyfill");
const gulp = require('gulp');
const sass = require('gulp-sass');
const eslint = require('gulp-eslint');
const concat = require('gulp-concat');
const del = require('del');
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');
const rename = require('gulp-rename');
const server = require('gulp-server-livereload');
const sourcemaps = require('gulp-sourcemaps');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const browserify = require('browserify');
const watchify = require('watchify');
const babelify = require('babelify');
const gulpJest = require('gulp-jest').default;
const paths = {
html: 'index.html',
scripts: './src/**/*.js',
sass: './styles/**/*.scss',
tests: './front-end-tests/__tests__',
backOfficeScripts: './src/back-office/**/*.js',
discovererScripts: './src/back-office/*.js',
backOfficeSass: './styles/sass/back-office/**/*.scss',
buildSass: './build/styles',
buildScripts: './build/js',
backOfficeTests: './back-office-tests/__tests__'
};
const clean = () => del(['build', 'coverage']);
const lint = (done) => {
gulp.src(paths.scripts)
.pipe(eslint())
.pipe(eslint.format());
done();
};
const scripts = (done) => {
const bundler = watchify(browserify('./src/app.js', { debug: true }).transform(babelify));
bundler.bundle()
.on('[gulpfile] Error in scripts task: ', (err) => {
console.error(err);
this.emit('end');
})
.pipe(source('app.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.buildScripts));
done();
};
const scriptsBackOffice = (done) => {
const bundler = watchify(browserify('./src/back-office/back-office-app.js', { debug: true })
.transform('babelify', { presets: ["@babel/preset-env", "@babel/preset-react"] }));
bundler.bundle()
.on('[gulpfile] Error in scriptsBackOffice task', (err) => {
console.error(err);
this.emit('end');
})
.pipe(source('back-office.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.buildScripts));
done();
};
const scriptsDiscoverer = () => {
const bundler = watchify(browserify('./src/back-office/discoverer.js', { debug: true })
.transform('babelify', { presets: ["@babel/preset-env", "@babel/preset-react"] }));
bundler.bundle()
.on('[gulpfile] Error in scriptsDiscoverer task', (err) => {
console.error(err);
this.emit('end');
})
.pipe(source('back-office-discoverer.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.buildScripts));
};
const styles = (done) => {
gulp.src([paths.sass, '!./styles/sass/back-office/**/*.scss'])
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(sass().on('error', sass.logError))
.pipe(concat('all.css'))
.pipe(postcss([autoprefixer({
browsers: [
'last 2 versions',
'Android 4.4',
'ie 10-11',
'ios_saf 8'
]
})]))
.pipe(rename({ suffix: '.min' }))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.buildSass));
done();
};
const stylesBackOffice = (done) => {
gulp.src(paths.backOfficeSass)
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(sass().on('error', sass.logError))
.pipe(concat('back-office.css'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.buildSass));
done();
};
const jestConfig = {
rootDir: paths.backOfficeTests
};
const testsBackOffice = (done) => {
gulp.src(paths.backOfficeTests).pipe(gulpJest({
"preprocessorIgnorePatterns": [
"<rootDir>/build/", "<rootDir>/node_modules/"
],
"roots": ["back-office-tests"],
"automock": false
}));
done();
};
const test = (done) => {
gulp.src(paths.tests).pipe(gulpJest({
"preprocessorIgnorePatterns": [
"<rootDir>/build/", "<rootDir>/node_modules/"
],
"roots": ["front-end-tests"],
"automock": false
}))
done();
};
const watchBackOfficeScripts = () => gulp.watch(paths.backOfficeScripts, ['scriptsBackOffice']);
const watchDiscovererScripts = () => gulp.watch(paths.discovererScripts, ['scriptsDiscoverer']);
const watchBackOfficeStyles = () => gulp.watch(paths.backOfficeSass, ['stylesBackOffice']);
const watchScripts = () => gulp.watch(paths.scripts, ['scripts']);
const watchStyles = () => gulp.watch(paths.sass, ['styles']);
const watchTests = () => gulp.watch(paths.tests, ['test']);
const watchJestTests = () => gulp.watch([jestConfig.rootDir + "/!**!/!*.js"], ['jest']);
const watch = (done) => {
gulp.parallel(
watchBackOfficeScripts,
watchDiscovererScripts,
watchBackOfficeStyles,
watchScripts,
watchStyles,
watchTests,
watchJestTests
);
done();
};
const webserver = (done) => {
gulp.src('./')
.pipe(server({
livereload: false,
open: true
}));
done();
};
const build = gulp.series(clean, gulp.parallel(
lint,
scripts,
scriptsBackOffice,
scriptsDiscoverer,
styles,
stylesBackOffice,
testsBackOffice,
test,
watch,
webserver
));
const buildFrontEnd = gulp.series(clean, gulp.parallel(
lint,
scripts,
styles,
test,
watch,
webserver
));
const buildBackOffice = gulp.series(clean, gulp.parallel(
scriptsBackOffice,
scriptsDiscoverer,
stylesBackOffice,
testsBackOffice,
watch,
webserver
));
exports.default = build;
exports.fe = buildFrontEnd;
exports.bo = buildBackOffice;
| mihailgaberov/es6-bingo-game | gulpfile.js | JavaScript | mit | 5,595 |
/**
* [HouseModel description]
* @constructor
*/
var db = require('../lib/mysql_query');
var moment = require('moment');
function HouseModel() {
this.getHouseList = function() {
};
//update or insert house data
this.upInsertHouse = function(urls) {
if (urls.length > 0) {
var curr = this;
var currdb = db;
urls.forEach(function(url) {
var house_id = url.match(/\/([^/]*?)\.html/i);
if (house_id.length > 0) {
sql = 'SELECT * FROM HouseDetail WHERE HouseID = \''+house_id[1]+'\'';
db.query(sql, function(err, result, fields) {
if (err) throw err;
if (result.length === 0) {
curr._insertHouseDetail(currdb.escape(house_id[1]), currdb.escape(url));
} else if (result.length === 1) {
console.log('need update')
}
});
}
// process.exit();
});
}
};
/**
* [exports description]
* @type {HouseModel}
*/
this._insertHouseDetail = function(house_id, house_url) {
sql = "INSERT INTO `HouseDetail` (`HouseID`,`HouseURL`) "
+ " VALUES ("+house_id+", "+house_url+")";
db.query(sql, function(err, result, fields) {
if (err) throw err;
console.log('add' + house_id);
});
};
this._updateHouseDetail = function() {
};
/**
* [description]
* @param {[type]} prices [description]
* @return {[type]} [description]
*/
this.upInsertHousePrice = function(prices) {
if (prices.length > 0) {
var curr = this;
var today = moment().format('YYYY-MM-DD');
prices.forEach(function(price) {
sql = "SELECT * FROM HousePrice WHERE HouseID = " + db.escape(price.house_id)
+" AND Date = '"+today+"'";
db.query(sql, function(err, result, fields) {
if (err) throw err;
if (result.length === 0) {
curr._insertHousePrice(price);
} else if (result.length === 1) {
console.log('need update')
}
});
// process.exit();
});
}
};
/**
* [description]
* @param {[type]} prices [description]
* @return {[type]} [description]
*/
this._insertHousePrice = function(prices) {
var house_id = db.escape(prices.house_id);
var price = db.escape(prices.price);
var per_price= db.escape(prices.per_price);
var today = moment().format('YYYY-MM-DD');
var update_time = moment().format('YYYY-MM-DD HH:mm:ss');
sql = "INSERT INTO HousePrice (HouseID,TotalPrice, PerPrice, Date, UpdateTime)"
+ " VALUES ("+house_id+","+price+","+per_price+",'"+today+"','"+update_time+"')";
db.query(sql, function(err, result, fields) {
if (err) throw err;
console.log('add house price:' + house_id + ', date:' + today);
});
};
/**
* [description]
* @param {[type]} details [description]
* @return {[type]} [description]
*/
this.upInsertHouseDetail = function(details) {
if (details.length > 0) {
var curr = this;
var today = moment().format('YYYY-MM-DD');
details.forEach(function(data) {
sql = "SELECT * FROM HouseDetail WHERE HouseID = " + db.escape(data.house_id);
db.query(sql, function(err, result, fields) {
if (result.length === 0) {
curr._insertHouseDetail(data);
} else if (result.length === 1) {
curr._updateHouseDetail(data);
}
})
});
}
}
/**
* [description]
* @param {[type]} data [description]
* @return {[type]} [description]
*/
this._insertHouseDetail = function (data) {
if (data.length != 6) return ;
var info = data['info'].split('|');
type = info[0] ? info[0] : '';
area = info[1] ? info[1] : '';
floor = info[2] ? info[2] : '';
head = info[3] ? info[3] : '';
sql = "INSERT INTO HouseDetail(HouseID,HouseName,Address,Type,Area,Floor,BuildHead,CommunityName,BuildYear)"
+ " VALUES ("+db.escape(data.house_id)+","+db.escape(data.name)+","+db.escape(data.addr)+","
+db.escape(type)+","+db.escape(area)+","+db.escape(floor)+","+db.escape(head)+","+
db.escape(data.comm)+","+db.escape(data.year)+")";
db.query(sql, function(err, result, fields) {
if (err) throw err;
console.log('add house detail:' + data.house_id);
});
}
/**
* [description]
* @return {[type]} [description]
*/
this._updateHouseDetail = function(data) {
info = data.info.split('|');
type = info[0] ? info[0] : '';
area = info[1] ? info[1] : '';
floor = info[2] ? info[2] : '';
head = info[3] ? info[3] : '';
sql = "UPDATE HouseDetail SET HouseName = "+db.escape(data.name)+",Address=" + db.escape(data.addr) +
", Type=" + db.escape(type) + ", Area=" + db.escape(area) + ", Floor=" + db.escape(floor) +
", BuildHead = " + db.escape(head) + ",CommunityName = " + db.escape(data.comm) +
",BuildYear = " + db.escape(data.year) +
" WHERE HouseID = " + db.escape(data.house_id);
db.query(sql, function(err, result, fields) {
if (err) throw err;
console.log('update house detail:' + data.house_id);
});
}
}
module.exports = new HouseModel();
| growable/nodespider | src/model/house_model.js | JavaScript | mit | 6,066 |
import path from 'path'
import fs from 'fs-promise'
import mkdirp from 'mkdirp-promise'
export async function exportDiff(diff, referenceScreenshotPath, newScreenshotPath, dir) {
await mkdirp(dir)
const exportedReferencePath = path.join(dir, 'reference.png')
const exportedNewPath = path.join(dir, 'new.png')
const exportedDiffPath = path.join(dir, 'diff.png')
const exportedHtmlPath = path.join(dir, 'index.html')
await fs.copy(referenceScreenshotPath, exportedReferencePath)
await fs.copy(newScreenshotPath, exportedNewPath)
await writeDiffToFile(diff, exportedDiffPath)
await writeHtmlDiff(exportedHtmlPath, diff.width, diff.height)
return {
reference: exportedReferencePath,
new: exportedNewPath,
diff: exportedDiffPath,
html: exportedHtmlPath,
}
}
async function writeDiffToFile(diff, diffPath) {
const packDiff = diff.pack()
packDiff.pipe(fs.createWriteStream(diffPath))
await new Promise(resolve => packDiff.once('end', resolve))
}
async function writeHtmlDiff(diffHtmlOutputPath, maxWidth, maxHeight) {
await fs.writeFile(diffHtmlOutputPath, `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Screenshot diff</title>
<style type="text/css">
body {
font-family: sans-serif;
}
#overlay-slider {
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
-webkit-appearance: none;
background: transparent;
overflow: hidden;
outline: none !important;
cursor: ew-resize;
}
#overlay-slider::-webkit-slider-thumb {
-webkit-appearance: none;
background: #000;
border-radius: 0;
width: 5px;
height: 10000px;
}
.image-slider {
position: relative;
display: inline-block;
line-height: 0;
width: ${maxWidth}px;
height: ${maxHeight}px;
}
.image-slider > #overlay-image {
position: absolute;
top: 0; bottom: 0; left: 0;
max-width: 100%;
overflow: hidden;
background: white;
}
.image-slider img {
user-select: none;
max-width: 95vw;
}
</style>
</head>
<body>
<p>
<details>
<summary>Diff</summary>
<img src="diff.png">
</details>
</p>
<p>
<details>
<summary>New / Original</summary>
<div class="image-slider">
<div id="overlay-image"><img src="new.png"></div>
<img src="reference.png">
<input type="range" min="0" max="100" value="50" step="0.1" oninput="handleSliderChange()" id="overlay-slider">
</div>
</details>
</p>
<script>
var overlayImage = document.getElementById("overlay-image");
var slider = document.getElementById("overlay-slider");
function handleSliderChange() {
overlayImage.style.width = slider.value+"%";
}
</script>
</body>
</html>
`.trim())
}
| ParmenionUX/screenie | packages/screenie-core/src/diff.js | JavaScript | mit | 2,909 |
var searchData=
[
['hmc5883l',['HMC5883L',['../structHMC5883L.html',1,'']]],
['hmc5883l_2eh',['hmc5883l.h',['../hmc5883l_8h.html',1,'']]],
['hmc5883l_5fgetxyz',['HMC5883L_GetXYZ',['../hmc5883l_8h.html#aa552169787e94e46b16f288daffcdd1b',1,'hmc5883l.h']]],
['hmc5883l_5finit',['HMC5883L_Init',['../hmc5883l_8h.html#a24b3cc080b91995fb1b3c837253f3a68',1,'hmc5883l.h']]],
['hmc5883l_5frange',['HMC5883L_range',['../hmc5883l_8h.html#a741d6341bd7d31bf60ea406397fd4ffe',1,'hmc5883l.h']]],
['hmc5883l_5frange_5f0_5f88',['HMC5883L_RANGE_0_88',['../hmc5883l_8h.html#a741d6341bd7d31bf60ea406397fd4ffeabd4f734a5ed9eaeb580e4afcb63890ec',1,'hmc5883l.h']]],
['hmc5883l_5frange_5f1_5f3',['HMC5883L_RANGE_1_3',['../hmc5883l_8h.html#a741d6341bd7d31bf60ea406397fd4ffea4a077e3c33798b4295f243c8b0b9d764',1,'hmc5883l.h']]],
['hmc5883l_5frange_5f1_5f9',['HMC5883L_RANGE_1_9',['../hmc5883l_8h.html#a741d6341bd7d31bf60ea406397fd4ffead0c3045e1f34aff68a3cea460851989d',1,'hmc5883l.h']]],
['hmc5883l_5frange_5f2_5f5',['HMC5883L_RANGE_2_5',['../hmc5883l_8h.html#a741d6341bd7d31bf60ea406397fd4ffeae183e113b72ab434c9d9403f00763f55',1,'hmc5883l.h']]],
['hmc5883l_5frange_5f4_5f0',['HMC5883L_RANGE_4_0',['../hmc5883l_8h.html#a741d6341bd7d31bf60ea406397fd4ffea3ae84c300b41fdb0db4ab882e42e67f2',1,'hmc5883l.h']]],
['hmc5883l_5frange_5f4_5f7',['HMC5883L_RANGE_4_7',['../hmc5883l_8h.html#a741d6341bd7d31bf60ea406397fd4ffea3c28e19815ebafe08e3e445ad733a441',1,'hmc5883l.h']]],
['hmc5883l_5frange_5f5_5f6',['HMC5883L_RANGE_5_6',['../hmc5883l_8h.html#a741d6341bd7d31bf60ea406397fd4ffeaffdc8235da08a2592866e28e9773bea6',1,'hmc5883l.h']]],
['hmc5883l_5frange_5f8_5f1',['HMC5883L_RANGE_8_1',['../hmc5883l_8h.html#a741d6341bd7d31bf60ea406397fd4ffeadbf91e7a1603328bc96bb58499717dbd',1,'hmc5883l.h']]],
['hmc5883l_5freadregister',['HMC5883L_ReadRegister',['../hmc5883l_8h.html#a0ffff13a0392be66d29d2ebc4dc9eead',1,'hmc5883l.h']]],
['hmc5883l_5freadregisters',['HMC5883L_ReadRegisters',['../hmc5883l_8h.html#aa88f4c99f95e2cf1f9bed6793bc62f21',1,'hmc5883l.h']]],
['hmc5883l_5fsetrange',['HMC5883L_SetRange',['../hmc5883l_8h.html#abcaa47591441d63bf763990731ae7fdd',1,'hmc5883l.h']]],
['hmc5883l_5fwriteregister',['HMC5883L_WriteRegister',['../hmc5883l_8h.html#a3416195149bb5ec812e5d2e89ee98865',1,'hmc5883l.h']]],
['htu21d',['HTU21D',['../structHTU21D.html',1,'']]],
['htu21d_2eh',['htu21d.h',['../htu21d_8h.html',1,'']]],
['htu21d_5fgetrh',['HTU21D_GetRH',['../htu21d_8h.html#abbf5873958a7120799455b4e3588c8e4',1,'htu21d.h']]],
['htu21d_5fgettemp',['HTU21D_GetTemp',['../htu21d_8h.html#af108e3929cf8898a97160f067c7a757c',1,'htu21d.h']]],
['htu21d_5finit',['HTU21D_Init',['../htu21d_8h.html#ad2b266b90dad1b2b70a80504314a1941',1,'htu21d.h']]]
];
| graycatlabs/Bicorder | docs/html/search/all_7.js | JavaScript | mit | 2,738 |
(function () {
'use strict';
const PATTERNS = {
default: {
en: 'DD/MM/YYYY',
ru: 'DD.MM.YYYY'
},
short: {
en: 'DD/MM',
ru: 'DD.MM'
}
};
const TIMES = {
sec: 1000,
min: 1000 * 60,
hour: 1000 * 60 * 60,
day: 1000 * 60 * 60 * 24,
week: 1000 * 60 * 60 * 24 * 7,
month: 1000 * 60 * 60 * 24 * 30,
year: 1000 * 60 * 60 * 24 * 365
};
const AVAILABLE_MODES = [
'default',
'short',
'time-ago'
];
/**
* @param {$rootScope.Scope} $scope
* @param {JQuery} $element
* @return {WDate}
*/
const controller = function ($scope, $element) {
class WDate {
get date() {
if ($scope.date instanceof Date) {
return $scope.date;
} else if (typeof $scope.date === 'string') {
return new Date(Number($scope.date));
} else {
return new Date($scope.date);
}
}
constructor() {
/**
* @type {string}
*/
this._date = null;
/**
* @type {string}
*/
this.handlerType = null;
/**
* @type {Function}
*/
this.timerCallback = null;
}
$postLink() {
this.mode = $scope.mode || AVAILABLE_MODES[0];
if (!AVAILABLE_MODES.includes(this.mode)) {
throw new Error('Wrong date mode!');
}
if (this.mode === 'time-ago') {
this.listener = () => this._initTimeAgoMode();
$scope.$watch('date', () => this._initTimeAgoMode());
this._initTimeAgoMode();
} else {
this.filter = tsUtils.date(PATTERNS[this.mode][i18next.language]);
this.listener = () => {
this.filter = tsUtils.date(PATTERNS[this.mode][i18next.language]);
this._initSimpleMode();
};
$scope.$watch('date', () => this._initSimpleMode());
this._initSimpleMode();
}
i18next.on('languageChanged', this.listener);
}
_initTimeAgoMode() {
if ($scope.date == null) {
return $element.html('');
}
if (this.handlerType && this.timerCallback) {
controller.off(this.handlerType, this.timerCallback);
}
const date = this.date;
const delta = Date.now() - date;
this.timerCallback = () => this._initTimeAgoMode();
if (delta < TIMES.min) {
$element.html(`${Math.round(delta / TIMES.sec)} sec ago`);
this.handlerType = 'sec';
controller.once(this.handlerType, this.timerCallback);
} else if (delta < TIMES.hour) {
$element.html(`${Math.round(delta / TIMES.min)} min ago`);
this.handlerType = 'min';
controller.once(this.handlerType, this.timerCallback);
} else if (delta < TIMES.day) {
$element.html(`${Math.round(delta / TIMES.hour)} hours ago`);
this.handlerType = 'hour';
controller.once(this.handlerType, this.timerCallback);
} else if (delta < TIMES.week) {
$element.html(`${Math.round(delta / TIMES.day)} days ago`);
} else if (delta < TIMES.month) {
$element.html(`${Math.round(delta / TIMES.week)} weeks ago`);
} else if (delta < TIMES.year) {
$element.html(`${Math.round(delta / TIMES.month)} months ago`);
} else {
$element.html('A lot of time ago');
}
}
_initSimpleMode() {
if ($scope.date == null) {
return $element.html('');
}
$element.text(this.filter(this.date));
}
$onDestroy() {
i18next.off('languageChanged', this.listener);
if (this.handlerType && this.timerCallback) {
controller.off(this.handlerType, this.timerCallback);
}
}
}
return new WDate();
};
controller.$inject = ['$scope', '$element'];
controller.handlers = {
sec: [],
min: [],
hour: []
};
controller.timers = {
sec: null,
min: null,
hour: null
};
controller.once = function (type, handler) {
controller.handlers[type].push(handler);
if (controller.isNeedStart(type)) {
controller.startTimer(type);
}
};
controller.off = function (type, handler) {
controller.handlers[type] = controller.handlers[type].filter(tsUtils.notContains(handler));
};
controller.trigger = function (type) {
const handlers = controller.handlers[type].slice();
controller.handlers[type] = [];
handlers.forEach((cb) => cb());
};
controller.isNeedStart = function (type) {
return !!controller.handlers[type].length && !controller.timers[type];
};
controller.startTimer = function (type) {
controller.timers[type] = setTimeout(() => {
controller.timers[type] = null;
controller.trigger(type);
}, TIMES[type]);
};
angular.module('app')
.directive('wDate', () => ({
restrict: 'A',
scope: {
mode: '@',
date: '<wDate'
},
controller: controller
}));
})();
| wavesplatform/WavesGUI | src/modules/ui/directives/date/Date.js | JavaScript | mit | 6,067 |
'use strict';
var _ = require('lodash');
var Actions = require('../constants/Actions');
var NavigationActions = require('./NavigationActions');
var NotificationActions = require('./NotificationActions');
var ga = require('../services/analytics');
var Promise = require('q');
module.exports = {
submitBooking: function (context, booking) {
var newsletter = booking.newsletter || false;
return context.hairfieApi
.post('/bookings', booking)
.then(
function (booking) {
ga('send', 'event', 'Booking', 'Confirm');
if(typeof fbq !== "undefined") {
fbq('track', 'Purchase', {value: '6.00', currency: 'EUR'});
}
return Promise.all([
context.dispatch(Actions.RECEIVE_BOOKING, _.assign(booking, {newsletter: newsletter})),
context.executeAction(NavigationActions.navigate, {
route: 'booking_confirmation',
params: { bookingId: booking.id }
})
]);
},
function () {
return context.executeAction(
NotificationActions.notifyError,
{
title: 'Problème lors de la réservation',
message: 'Un problème est survenu, avez-vous bien rempli les champs obligatoires ?'
}
);
}
);
},
cancelBooking: function(context, booking) {
var newsletter = booking.newsletter || false;
return context.hairfieApi
.post('/bookings/' + booking.bookingId + '/cancel')
.then(
function (booking) {
context.dispatch(Actions.RECEIVE_BOOKING, _.assign(booking, {newsletter: newsletter}));
}, function () {
return context.executeAction(
NotificationActions.notifyError,
{
title: 'Erreur',
message: 'Un problème est survenu'
}
);
}
);
},
submitBookingCheckCode: function (context, params) {
var newsletter = params.newsletter || false;
return context.hairfieApi
.post('/bookings/'+params.bookingId+'/userCheck', { userCheckCode: params.checkCode })
.then(function (booking) {
context.dispatch(Actions.RECEIVE_BOOKING, _.assign(booking, {newsletter: newsletter}))
});
}
};
| Hairfie/Website | actions/BookingActions.js | JavaScript | mit | 2,739 |
import ListDivided from './ListDivided'
import ListDividedItem from './ListDividedItem'
export default ListDivided
export {
ListDivided,
ListDividedItem
}
| ArkEcosystem/ark-desktop | src/renderer/components/ListDivided/index.js | JavaScript | mit | 160 |
/**
* Copyright (c) 2014, 2017, Oracle and/or its affiliates.
* The Universal Permissive License (UPL), Version 1.0
*/
"use strict";
define(["ojs/ojcore","knockout","jquery","ojs/ojcomponentcore","ojs/ojarraytabledatasource","ojs/ojcolor","ojs/ojlistview","ojs/ojeditablevalue"],function(a,g,c){(function(){a.ab("oj.ojColorPalette",c.oj.editableValue,{widgetEventPrefix:"oj",defaultElement:"\x3cinput\x3e",options:{palette:null,swatchSize:"lg",labelDisplay:null,layout:"grid",value:null,disabled:!1},getNodeBySubId:function(a){if(null==a)return this.element?this.element[0]:null;var c=a.index,e=null;switch(a.subId){case "oj-palette-entry":a=
this.Zd.find("li"),a.length&&c<a.length&&(e=a[c])}return e},getSubIdByNode:function(a){var d=c(a);a=null;var e=-1,f=null,g;d.is("li")&&d.hasClass("oj-listview-item-element")&&(a="oj-palette-entry",g=d.attr("id"),d=this.Zd.find("li"),c.each(d,function(a,b){if(c(b).attr("id")===g)return e=a,!1}));a&&(f={subId:a},0<=e&&(f.index=e));return f},add:function(b){var c=null,e;b instanceof a.o?c={color:b}:"object"===typeof b&&(e=b.color,e instanceof a.o&&(c=b));c&&(c.id=this.Wm.length,this.VB.add(c),b=this.Wm.slice(0),
b.push(c),this.xx("palette",b,null),this.Wm.push(c))},remove:function(b){var c=-1,e;e=typeof b;"number"===e?(c=b,b={}):"object"===e&&(c=b instanceof a.o?b:b.color,c=this.GM(c));0<=c&&c<this.Wm.length&&(e=this.Wm[c].id,b.id=e,this.VB.remove(b),this.Wm.splice(c,1))},whenReady:function(){var a=this;return new Promise(function(c){a.Zd.ojListView("whenReady").then(function(){c(!0)})})},_destroy:function(){this.Zd&&this.Zd.ojListView("destroy");this.VB=null;this.S6.remove();this.Lg.removeClass("oj-colorpalette");
this.nx();this._super()},_ComponentCreate:function(){this._super();this.RFa()},Mg:function(){this._super();var b=this.FK();b?(b=b.attr("id"))?this.Zd.attr("aria-labelledby",b):a.F.warn("JET Color Palette: The label for this component needs an id in order to be accessible"):(b=this.element.attr("aria-label"))&&this.Zd.attr("aria-label",b)},_setOption:function(a,c,e){switch(a){case "value":this.p0(c);break;case "palette":this.xLa(c);break;case "swatchSize":this.yLa(c);break;case "layout":this.wLa(c);
break;case "labelDisplay":this.vLa(c);break;case "disabled":this.EH(c,!0)}this._super(a,c,e)},cIa:function(a,c){"selection"===c.option&&this.LKa(a,c)},$L:function(b,c){var e=c instanceof a.o,f=!1;b instanceof a.o&&e&&(f=b.isEqual(c));return f},xx:function(a,c,e){"palette"===a&&this.option(a,c,{_context:{originalEvent:e,kb:!0},changed:!0})},GM:function(a){var c=-1,e=this.Wm,f=e.length,g,k;for(g=0;g<f;g++)if(k=e[g],a.isEqual(k.color)){c=g;break}return c},dKa:function(b){var c,e,f,g,k,l;c=b.data.color;
c instanceof a.o||(c=a.o.BLACK,a.F.warn("JET Color Palette: Substituting oj.Color.BLACK for an object that is not an instance of oj.Color"));e=f=b.data.label;g="auto"===this.nO&&"list"===this.Gf&&"sm"===this.oC||"auto"===this.nO&&"grid"===this.Gf&&"lg"===this.oC;null!=c&&(l=e?e:this.hW.format(c),g?(e=l?l:this.hW.format(c),e=f?e:e.toUpperCase()):e=null,k=!!(this.aga(c)||e&&"none"===e.toLowerCase()));f="";this.Wl===b.data.id&&(f="oj-selected",this.Wl=-1,this.f0=b.parentElement);b="list"===this.Gf?"oj-colorpalette-swatchsize-"+
this.oC+(k?" oj-colorpalette-swatch-none":""):this.Tja+(k?" oj-colorpalette-swatch-none":"");return k?this.$Ja(g,e,l,b,f):this.bKa(c,g,e,l,b,f)},bKa:function(a,d,e,f,g,k){a="\x3cdiv class\x3d'oj-colorpalette-swatch-entry "+g+(d?" oj-colorpalette-swatch-showlabel":"")+"'\x3e\x3cdiv class\x3d'oj-colorpalette-swatch-container'\x3e\x3cdiv class\x3d'oj-colorpalette-swatch "+k+"' style\x3d'background-color:"+a.toString()+"'"+(e?"":" title\x3d'"+f+"'")+"\x3e\x3c/div\x3e\x3c/div\x3e";e&&(a+="\x3cspan class\x3d'oj-colorpalette-swatch-text'\x3e"+
e+"\x3c/span\x3e");return c(a+"\x3c/div\x3e")[0]},$Ja:function(a,d,e,f,g){a="\x3cdiv class\x3d'oj-colorpalette-swatch-entry "+f+(a?" oj-colorpalette-swatch-showlabel":"")+"'\x3e\x3cdiv class\x3d'oj-colorpalette-swatch-container'\x3e\x3cdiv class\x3d'oj-colorpalette-swatch "+g+"'"+(d?"":" title\x3d'"+e+"'")+"\x3e\x3cdiv class\x3d'oj-colorpalette-swatch-none-icon'\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e";d&&(a+="\x3cspan class\x3d'oj-colorpalette-swatch-text'\x3e"+d+"\x3c/span\x3e");return c(a+"\x3c/div\x3e")[0]},
LKa:function(a,d){var e=null,f,e=c(d.items[0]).find(".oj-colorpalette-swatch");e.addClass("oj-selected");f=this.MKa;this.MKa=e;!f&&this.f0&&(f=c(this.f0).find(".oj-colorpalette-swatch"),this.f0=null);f&&f.removeClass("oj-selected");1===d.value.length&&(e=this.Wm[d.value].color,this.bc(e,a),this.uf=e)},EH:function(a,d){var e,f,g=!d||d&&a!==this.Pp;g&&(this.Zd&&this.Zd.ojListView("option","disabled",a),e=c(".oj-colorpalette-container .oj-colorpalette-swatch"),f=this,a?(this.CF=[],c.each(e,function(a,
b){f.CF.push(b.style.backgroundColor);b.style.backgroundColor="#eee"})):(this.CF&&this.CF.length&&c.each(e,function(a,b){b.style.backgroundColor=f.CF[a]}),this.CF=null),this.Pp=a);return g},p0:function(b){var c=-1,e=[];0<this.Wm.length&&b instanceof a.o&&!this.$L(this.uf,b)&&(c=this.GM(b),0<=c&&e.push(c),this.Zd.ojListView("option","selection",e),this.uf=b);return 0<=c},xLa:function(a){var d=!1;c.isArray(a)&&!this.JGa(a,this.Wm)&&(this.Wm=a.slice(0),this.Wl=this.GM(this.uf),this.Pia(a,this.Wl,!0),
d=!0);return d},yLa:function(a){var c=!1;"string"===typeof a&&a!==this.oC&&(this.oC=a,this.Tja="oj-colorpalette-swatchsize-"+("lg"===a?"lg":"sm"===a?"sm":"xs"),this.Zd.ojListView("refresh"),c=!0);return c},vLa:function(a){var c=!1;"string"!==typeof a||a===this.nO||"auto"!==a&&"off"!==a||(this.nO=a,this.Zd.ojListView("refresh"),c=!0);return c},wLa:function(a){var c=!1;"string"===typeof a&&a!==this.Gf&&(this.Gf=a,this.WKa(),this.Zd.ojListView("refresh"),c=!0);return c},WKa:function(){var a="grid"===
this.Gf,c=a?"oj-colorpalette-grid":"oj-colorpalette-list";this.Zd.removeClass("oj-colorpalette-grid oj-colorpalette-list oj-listview-card-layout");this.Zd.addClass(c);a?(this.Zd.css("display","flex"),this.Zd.css("flex-wrap","wrap")):(this.Zd.css("display",""),this.Zd.css("flex-wrap",""))},Pia:function(b,c,e){this.$va(b);this.VB=new a.Ya(b,{idAttribute:"id"});0<=c&&(0===this.yO.length?this.yO.push(c):this.yO[0]=c);e&&this.Zd.ojListView("option","data",this.VB)},RFa:function(){this.qG();this.hb()},
hb:function(){this.Lg.append(this.IG);this.Lg.addClass("oj-colorpalette");this.S6=this.Lg.find(".oj-colorpalette-container");this.Zd=this.S6.find(":first");this.uf&&this.uf instanceof a.o&&(this.Wl=this.GM(this.uf));this.Pia(this.Wm,this.Wl,!1);this.Zd.ojListView({data:this.VB,item:{renderer:this.dKa.bind(this)},optionChange:this.cIa.bind(this),selectionMode:"single",selection:this.yO,rootAttributes:{style:"height:100%;width:100%"}}).attr("data-oj-internal","");this.Zd.ojListView("option","translations").msgNoData=
"";var b=this;this.Zd.ojListView("whenReady").then(function(){b.EH(b.Pp);if(b.Zd[0].scrollWidth>b.Zd[0].clientWidth){var a=b.ICa(),c="rtl"===b.rd();b.Zd.css(c?"padding-left":"padding-right",a+1)}})},qG:function(){this.kV();this.taa=a.La.Vk(a.Mh.CONVERTER_TYPE_COLOR);this.hW=this.taa.createConverter({format:"hex"});this.R("labelNone");var b,c;"grid"===this.Gf?(b="oj-colorpalette-grid",c="display:flex;flex-wrap:wrap;"):(b="oj-colorpalette-list",c="");this.IG=["\x3cdiv class\x3d'oj-colorpalette-container'\x3e",
"\x3cul class\x3d'"+b+"'"+(c?" style\x3d'"+c+"'":"")+" /\x3e","\x3c/div\x3e"].join("")},kV:function(){var b=this.options,d;this.Lg=c(this.element);this.Pp=!1;this.yO=[];this.VB=null;d=b.swatchSize;"string"===typeof d&&(d=d.toLowerCase(),"lg"!==d&&"sm"!==d&&"xs"!==d&&(d="lg"));this.oC=d;this.Tja="oj-colorpalette-swatchsize-"+d;d=b.labelDisplay;"string"===typeof d&&(d=d.toLowerCase(),"auto"!==d&&"off"!==d&&(d="auto"));this.nO=d;d=b.layout;"string"===typeof d&&(d=d.toLowerCase(),"grid"!==d&&"list"!==
d&&(d="grid"),"grid"!==d&&"xs"===this.oC&&(d="grid"));this.Gf=d;d=b.value;d instanceof a.o||(d=null);this.uf=d?d:a.o.BLACK;d=b.palette;c.isArray(d)||(d=[]);this.Wm=d.slice(0);d=b.disabled;"boolean"===typeof d&&(this.Pp=d)},aga:function(a){var c=a.bz(),e=a.Yy(),f=a.Vy();a=a.Ty();return 0===c&&0===e&&0===f&&0===a},JGa:function(a,c){var e=a.length,f=c.length,g,k;g=!1;if(e===f){for(f=0;f<e&&(g=a[f],k=c[f],!this.$L(g.color,k.color)||(g=g.label,k=k.label,g===k));f++);g=f>=e}return g},$va:function(a){var c,
e,f=a.length;for(c=0;c<f;c++)e=a[c],e.id=c},nx:function(){this.taa=this.hW=this.IG=this.Zd=null},ICa:function(){var a=c("\x3cdiv style\x3d'overflow: scroll; width: 100px; height: 100px; position: absolute; visibility: hidden;'\x3e\x3cdiv style\x3d'width: 100%; height: 100%;'\x3e\x3c/div\x3e\x3c/div\x3e");this.element.append(a);var d=a[0].offsetWidth,e=a.children()[0].offsetWidth;a.remove();return d-e},_GetMessagingLauncherElement:function(){return this.element},Xf:function(){return this.Zd},Pt:function(){return this.uf},
rk:function(b){this.uf="string"===typeof b?new a.o(b):b},Zh:function(){return this.uf.toString()},_GetDefaultStyleClass:function(){return"oj-colorpalette"}})})()}); | crmouli/crmouli.github.io | js/libs/oj/v3.0.0/min/ojcolorpalette.js | JavaScript | mit | 9,022 |
var JSONStream = require('simple-jsonstream');
module.exports = function() {
return new JSONStream();
};
| jameswyse/pied-piper | lib/transforms/toJSON.js | JavaScript | mit | 108 |
export const template = (template, values) => {
let s = template;
for (let key in values) {
const value = values[key];
if (values.hasOwnProperty(key)) {
s = s.replace(`:${key}`, value);
}
}
return s;
}
| tobico/seaturtle | src/util/template.js | JavaScript | mit | 228 |
import React from 'react';
import {LineGraph, BarGraph, AreaGraph, PieChart, ScatterPlot} from './d3components';
// import rd3r from '../../lib-compiled';
// import rd3r from '../../script-compiled';
import ChartData from './d3components/testData/data.js';
class Main extends React.Component {
render() {
return (
<div>
<LineGraph
title="Line Graph - 700px max width"
width={700}
height={500}
chartId="custom-ID"
chartClassName="custom-CLASS"
xAxisLabel="X Axis Label"
yAxisLabel="Y Axis Label"
xDataKey="day"
yDataKey="count"
dateFormat="%m-%d-%Y"
xToolTipLabel="X-TT "
yToolTipLabel="Y-TT "
lineType="linear"
yMaxBuffer={50}
data={ChartData.lineGraphData}/>
<LineGraph
title="Line Graph - d3 cardinal line"
xAxisLabel="X Axis Label"
yAxisLabel="Y Axis Label"
xDataKey="day"
yDataKey="count"
dateFormat="%Y-%m-%dT%H:%M:%S.%LZ"
lineType="cardinal"
data={ChartData.lineGraphData4} />
<LineGraph
title="Line Graph - d3 cardinal line"
xAxisLabel="X Axis Label"
yAxisLabel="Y Axis Label"
xDataKey="day"
yDataKey="count"
lineType="cardinal"
data={ChartData.lineGraphData} />
<LineGraph
title="Multiple Line Graph - Date X axis"
xDataKey="day"
yDataKey="count"
lineType="cardinal"
strokeColor="#67ff67"
xFormat="%a"
data={ChartData.lineGraphData2} />
<LineGraph
title="Line Graph - Number X axis"
xDataKey="x"
yDataKey="y"
lineType="linear"
dataType="data"
data={ChartData.lineGraphData3} />
<AreaGraph
title="Area Graph - 700px max width"
width={700}
height={500}
chartId="custom-ID"
chartClassName="custom-CLASS"
xAxisLabel="X Axis Label"
yAxisLabel="Y Axis Label"
xDataKey="day"
yDataKey="count"
dateFormat="%m-%d-%Y"
xToolTipLabel="X-TT"
yToolTipLabel="Y-TT"
lineType="linear"
yMaxBuffer={50}
data={ChartData.areaGraphData} />
<AreaGraph
title="Area Graph"
xDataKey="day"
yDataKey="count"
lineType="linear"
fillColor="#53c79f"
strokeColor="#67ff67"
data={ChartData.areaGraphData} />
<AreaGraph
title="Area Graph - d3 cardinal line"
xDataKey="day"
yDataKey="count"
lineType="cardinal"
fillColor="#53c79f"
strokeColor="#67ff67"
data={ChartData.areaGraphData} />
<AreaGraph
title="Multiple Area Graph - d3 cardinal lines"
xDataKey="day"
yDataKey="count"
lineType="cardinal"
xFormat="%a"
data={ChartData.areaGraphData2} />
<ScatterPlot
title="Scatter Plot - Date X axis"
xDataKey="day"
yDataKey="count"
dataType="date"
trendLine={true}
data={ChartData.scatterPlotData} />
<ScatterPlot
title="Scatter Plot - data X axis, single trend line"
xDataKey="x"
yDataKey="y"
xAxisLabel="X Axis Label"
yAxisLabel="Y Axis Label"
trendLine={true}
lineNumbers="single"
data={ChartData.scatterPlotData3}
dataType="data" />
<ScatterPlot
title="Scatter Plot - data X axis, multiple trend line"
xDataKey="x"
yDataKey="y"
xAxisLabel="X Axis Label"
yAxisLabel="Y Axis Label"
trendLine={true}
lineNumbers="multi"
data={ChartData.scatterPlotData3}
dataType="data" />
<BarGraph
title="Bar Graph"
xDataKey="label"
barChartType="side"
xAxisLabel="X Axis Label"
yAxisLabel="Y Axis Label"
keys={['Your Score','Month To Date','Vin Average']}
legendValues={ChartData.soldRatiosLegend}
data={ChartData.soldRatios} />
<BarGraph
title="Bar Graph"
xDataKey="month"
barChartType="side"
individualSpacing={0}
yAxisPercent={true}
keys={['new','old','third','four']}
legendValues={ChartData.barGraphTestData2.legend}
data={ChartData.barGraphTestData2.data} />
<BarGraph
title="Bar Graph - With Axis Labels"
xDataKey="month"
xAxisLabel="X Axis Label"
yAxisLabel="Y Axis Label"
yAxisPercent={true}
colors={["#98abc5", "#7b6888", "#a05d56", "#ff8c00"]}
keys={['new','old','third','four']}
legendValues={ChartData.barGraphTestData2.legend}
data={ChartData.barGraphTestData2.data} />
<PieChart
title="Pie Chart"
chartId="piechart"
data={ChartData.pieTestData}
innerRadiusRatio={0}
labelOffset={1}
startAngle={0}
endAngle={360} />
<PieChart
title="Pie Chart - Different Start and End Angles"
chartId="piechart"
data={ChartData.pieTestData}
innerRadiusRatio={.8}
labelOffset={1}
showLabel={false}
legend={false}
startAngle={-50}
endAngle={154} />
</div>
);
}
}
export default Main;
| cox-auto-kc/react-d3-responsive | src/app/main.js | JavaScript | mit | 5,632 |
// Usage: run this with your admin password as an argument:
// user@host:~/preso$ node preso.js "lol hacked"
var express = require('express'),
app = require('express')(),
server = require('http').createServer(app),
io = require('socket.io').listen(server),
auth = {},
users = 0,
magic = 0
slide = 1;
server.listen(1337);
// Create routes for static content and the index
app.use(express.static(__dirname + '/static'));
app.get('/', function (req, res)
{
res.sendfile(__dirname + '/index.html');
});
app.get('/admin', function (req, res)
{
res.sendfile(__dirname + '/admin.html');
});
app.get('/time', function(req, res)
{
res.sendfile(__dirname + '/time.html');
});
// Function to control slides
// Used by the remote admin interface and arduino
var handleAction = function(action)
{
if(action.name == 'previous') {
if(slide > 0) slide--;
}
else if(action.name == 'next') {
slide++;
}
if(magic && action.name == 'next')
io.sockets.emit('slide', {number: slide, time: new Date().getTime() + 1000 });
else
io.sockets.emit('slide', {number: slide, time: new Date().getTime() + 100 });
magic = 0;
}
// Websocket magic
io.sockets.on('connection', function (socket)
{
users++;
// Notify other clients of the new user
io.sockets.emit('users', {count: users});
// Let the new user know they're connected
socket.emit('status', {message: "Connected"});
socket.emit('slide', {number: slide, name: "new"});
socket.emit('time', {serverTime: new Date().getTime()});
// Show navigation buttons to users if no admin password was used
if(process.argv[2] === undefined)
{
socket.emit('show', {selector: '.buttons'});
}
socket.on('action', function(action)
{
// Only accept actions from authed users
if(typeof auth[socket.id] != "undefined" && auth[socket.id] || process.argv[2] === undefined)
handleAction(action);
});
socket.on('abort', function()
{
if(typeof auth[socket.id] != "undefined" && auth[socket.id] || process.argv[2] === undefined)
io.sockets.emit('abort');
});
var ping;
var pingInterval = setInterval(function()
{
socket.emit('ping', {ping: new Date().getTime(), last: ping});
}, 1000);
socket.on('pong', function(time)
{
ping = (new Date().getTime() - time.ping) / 2;
});
socket.on('incoming-magic', function() { magic = 1 });
socket.on('debug', function()
{
socket.emit('debug', average);
});
socket.on('password', function(password)
{
if(password.value == process.argv[2])
{
auth[socket.id] = true;
socket.emit('authenticated');
socket.emit('status', {message: 'Authenticated'});
socket.emit('users', {count: users});
}
});
socket.on('disconnect', function ()
{
clearInterval(pingInterval);
users--;
io.sockets.emit('users', {count: users});
});
});
var net = require('net');
var server = net.createServer();
server.listen(9001, '0.0.0.0');
server.on('connection', function(sock)
{
sock.on('data', function(data)
{
if(data == "previous")
handleAction({name: 'previous'});
else if(data == "next")
handleAction({name: 'next'});
});
});
| itsrachelfish/preso | preso.js | JavaScript | mit | 3,457 |
"use strict";
var _ = require('./lodash');
var utils = require('./utils');
module.exports = function(content, type) {
// Deferring requiring these to sidestep a circular dependency:
// Block -> this -> Blocks -> Block
var Blocks = require('./blocks');
var Formatters = require('./formatters');
type = utils.classify(type);
var markdown = content;
//Normalise whitespace
markdown = markdown.replace(/ /g," ");
// First of all, strip any additional formatting
// MSWord, I'm looking at you, punk.
markdown = markdown.replace(/( class=(")?Mso[a-zA-Z]+(")?)/g, '')
.replace(/<!--(.*?)-->/g, '')
.replace(/\/\*(.*?)\*\//g, '')
.replace(/<(\/)*(meta|link|span|\\?xml:|st1:|o:|font)(.*?)>/gi, '');
var badTags = ['style', 'script', 'applet', 'embed', 'noframes', 'noscript'],
tagStripper, i;
for (i = 0; i< badTags.length; i++) {
tagStripper = new RegExp('<'+badTags[i]+'.*?'+badTags[i]+'(.*?)>', 'gi');
markdown = markdown.replace(tagStripper, '');
}
// Escape anything in here that *could* be considered as MD
// Markdown chars we care about: * [] _ () -
markdown = markdown.replace(/\*/g, "\\*")
.replace(/\[/g, "\\[")
.replace(/\]/g, "\\]")
.replace(/\_/g, "\\_")
.replace(/\(/g, "\\(")
.replace(/\)/g, "\\)")
.replace(/\-/g, "\\-");
var inlineTags = ["em", "i", "strong", "b"];
for (i = 0; i< inlineTags.length; i++) {
tagStripper = new RegExp('<'+inlineTags[i]+'><br></'+inlineTags[i]+'>', 'gi');
markdown = markdown.replace(tagStripper, '<br>');
}
function replaceBolds(match, p1, p2){
if(_.isUndefined(p2)) { p2 = ''; }
return "**" + p1.replace(/<(.)?br(.)?>/g, '') + "**" + p2;
}
function replaceItalics(match, p1, p2){
if(_.isUndefined(p2)) { p2 = ''; }
return "_" + p1.replace(/<(.)?br(.)?>/g, '') + "_" + p2;
}
markdown = markdown.replace(/<(\w+)(?:\s+\w+="[^"]+(?:"\$[^"]+"[^"]+)?")*>\s*<\/\1>/gim, '') //Empty elements
.replace(/\n/mg,"")
.replace(/<a.*?href=[""'](.*?)[""'].*?>(.*?)<\/a>/gim, function(match, p1, p2){
return "[" + p2.trim().replace(/<(.)?br(.)?>/g, '') + "]("+ p1 +")";
}) // Hyperlinks
.replace(/<strong>(?:\s*)(.*?)(\s)*?<\/strong>/gim, replaceBolds)
.replace(/<b>(?:\s*)(.*?)(\s*)?<\/b>/gim, replaceBolds)
.replace(/<em>(?:\s*)(.*?)(\s*)?<\/em>/gim, replaceItalics)
.replace(/<i>(?:\s*)(.*?)(\s*)?<\/i>/gim, replaceItalics);
// Use custom formatters toMarkdown functions (if any exist)
var formatName, format;
for(formatName in Formatters) {
if (Formatters.hasOwnProperty(formatName)) {
format = Formatters[formatName];
// Do we have a toMarkdown function?
if (!_.isUndefined(format.toMarkdown) && _.isFunction(format.toMarkdown)) {
markdown = format.toMarkdown(markdown);
}
}
}
// Do our generic stripping out
markdown = markdown.replace(/([^<>]+)(<div>)/g,"$1\n$2") // Divitis style line breaks (handle the first line)
.replace(/<div><div>/g,'\n<div>') // ^ (double opening divs with one close from Chrome)
.replace(/(?:<div>)([^<>]+)(?:<div>)/g,"$1\n") // ^ (handle nested divs that start with content)
.replace(/(?:<div>)(?:<br>)?([^<>]+)(?:<br>)?(?:<\/div>)/g,"$1\n") // ^ (handle content inside divs)
.replace(/<\/p>/g,"\n\n") // P tags as line breaks
.replace(/<(.)?br(.)?>/g,"\n") // Convert normal line breaks
.replace(/</g,"<").replace(/>/g,">"); // Encoding
// Use custom block toMarkdown functions (if any exist)
var block;
if (Blocks.hasOwnProperty(type)) {
block = Blocks[type];
// Do we have a toMarkdown function?
if (!_.isUndefined(block.prototype.toMarkdown) && _.isFunction(block.prototype.toMarkdown)) {
markdown = block.prototype.toMarkdown(markdown);
}
}
// Strip remaining HTML
markdown = markdown.replace(/<\/?[^>]+(>|$)/g, "");
return markdown;
};
| shelsonjava/sir-trevor-js | src/to-markdown.js | JavaScript | mit | 4,499 |
'use strict';
var assert = require('assert'),
ARC = require('../lib/arc.js'),
storage;
describe('ARC', function() {
it('simple init', function() {
storage = new ARC();
assert.equal(storage.max, Infinity);
assert.equal(storage.maxAge, null);
assert.equal(storage.length, 0);
});
it('number init', function() {
storage = new ARC(3);
assert.equal(storage.max, 3);
assert.equal(storage.maxAge, null);
assert.equal(storage.length, 0);
});
it('options init', function() {
storage = ARC({max: 10, maxAge: 10000, length: function(n) { return n * 2; }});
storage.set(1, 1);
assert.equal(storage.max, 10);
assert.equal(storage.maxAge, 10000);
assert.equal(storage.length, 2);
});
it('itemCount', function() {
storage = ARC({max: 3});
storage.set(1, 3);
storage.set(1, 2);
storage.set(1, 1);
assert.equal(storage.itemCount, 1);
storage.set(2, 2);
storage.set(3, 3);
storage.set(4, 4);
assert.equal(storage.itemCount, 3);
storage.set(3, 3);
assert.equal(storage.itemCount, 3);
});
it('set/get', function() {
storage = ARC();
storage.set(1, 3);
storage.set(1, 2);
storage.set(1, 1);
assert.equal(storage.get(1), 1);
storage.set(2, 4);
storage.set(3, 3);
storage.set(4, 2);
assert.equal(storage.get(2), 4);
assert.equal(storage.get(3), 3);
assert.equal(storage.get(4), 2);
storage.set(3, 3);
assert.equal(storage.itemCount, 4);
storage.max = 2;
assert.equal(storage.itemCount, 2);
assert.equal(storage.has(1), false);
assert.equal(storage.get(2), undefined);
assert.equal(storage.get(3), 3);
assert.equal(storage.get(4), 2);
});
it('expair', function(done) {
storage = new ARC({maxAge: 10});
var d = new Date();
storage.set(1, 1);
assert.equal(storage.get(1), 1);
setTimeout(function() {
assert.equal(storage.get(1), 1);
assert.equal(storage.info(1).created.toDateString(), d.toDateString());
assert.equal(storage.info(1).expire.toDateString(), new Date(d.valueOf() + 10).toDateString());
setTimeout(function() {
assert.equal(storage.get(1), undefined);
done();
}, 6);
}, 5);
});
it('expair custom maxAge', function(done) {
storage = new ARC({maxAge: 10});
storage.set(1, 1);
storage.set(2, 2, 15);
setTimeout(function() {
assert.equal(storage.get(1), undefined);
assert.equal(storage.get(2), 2);
setTimeout(function() {
assert.equal(storage.get(2), undefined);
done();
}, 5);
}, 11);
});
it('delete', function() {
storage = new ARC({max: 10});
var i = 10;
while (--i) {
storage.set(i);
}
i = 10;
while (--i) {
storage.del(i);
assert.equal(storage.get(i), undefined);
}
assert.equal(storage.itemCount, 0);
});
it('forEach', function(done) {
storage = ARC({maxAge: 10});
storage.set(1, 4);
storage.set(2, 3);
setTimeout(function() {
storage.set(3, 2);
storage.set(4, 1);
setTimeout(function() {
var arr = [];
storage.forEach(function(n) {
arr.push(n);
});
assert.equal(arr.sort().join(','), [1, 2].join(','));
done();
}, 5);
}, 5);
});
it('keys', function(done) {
storage = new ARC({max: 2});
storage.set(1, 4);
storage.set(2, 3);
storage.set(3, 2);
storage.set(4, 1);
assert.equal(storage.keys().sort().join(','), [1, 2].join(','));
storage.max = 4;
storage.set(3, 2);
storage.set(4, 1);
assert.equal(storage.keys().sort().join(','), [1, 2, 3, 4].join(','));
storage.get(1);
storage.get(2); storage.get(2);
storage.get(3); storage.get(3);
storage.get(4);
storage.max = 2;
assert.equal(storage.keys().sort().join(','), [2, 3].join(','));
done();
});
it('values', function(done) {
storage = new ARC({max: 2});
storage.set(1, 4);
storage.set(2, 3);
storage.set(3, 2);
storage.set(4, 1);
assert.equal(storage.values().sort().join(','), [3, 4].join(','));
storage.max = 4;
storage.set(3, 2);
storage.set(4, 1);
assert.equal(storage.values().sort().join(','), [1, 2, 3, 4].join(','));
storage.get(1); storage.get(1);
storage.get(2);
storage.get(3);
storage.get(4); storage.get(4);
storage.max = 2;
assert.equal(storage.values().sort().join(','), [1, 4].join(','));
done();
});
it('reset', function() {
var i = 1000000,
s = i / 100,
e = 0;
storage = new ARC({max: s});
while (i) {
storage.get(i % 2);
storage.set(--i, ++e);
storage.has(i % 2);
storage.set(i % 2, e);
}
assert.equal(storage.itemCount, s);
storage.reset();
assert.equal(storage.itemCount, 0);
});
});
| ex1st/node-arc-cache | test/test.js | JavaScript | mit | 4,537 |
'use strict';
/**
* @ngdoc function
* @name richlewismlApp.controller:AboutmeCtrl
* @description
* # AboutmeCtrl
* Controller of the richlewismlApp
*/
angular.module('richlewismlApp')
.controller('AboutmeCtrl', function ($scope) {
$scope.awesomeThings = [
'HTML5 Boilerplate',
'AngularJS',
'Karma'
];
});
| richlewis42/rich.lewis.ml | app/scripts/controllers/aboutme.js | JavaScript | mit | 342 |
'use strict';
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var paths = {
scripts: '*.js',
tests: 'test/*.js'
};
gulp.task('test', function () {
process.env.NODE_ENV = 'TEST';
return gulp.src(paths.tests)
.pipe(mocha({reporter: 'spec'}));
});
gulp.task('lint', function() {
return gulp.src([paths.scripts, paths.tests])
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
gulp.task('watch', function() {
gulp.watch([paths.scripts, paths.tests], ['lint', 'test']);
});
gulp.task('default', ['lint', 'test']);
| nickcs/node-training-setup | gulpfile.js | JavaScript | mit | 635 |
#!/usr/bin/env node
var parse = require("csv-parse");
var fs = require("fs");
var Table = require("cli-table");
var inputFile = process.argv[2];
console.log("Reading", inputFile);
var input = fs.readFileSync(inputFile, "utf-8");
var districts = {};
parse(input, {delimiter: ",", ltrim: true, rtrim: true, columns: true}, function (err, data) {
if (err) {
console.error(err);
}
for (var i = 0; i < data.length; i++) {
districts[data[i].district] = districts[data[i].district] || 0;
districts[data[i].district]++;
}
var table = new Table({
head: ["District", "Count", "%"],
colWidths: [30, 10, 10]
});
for (var d in districts) {
table.push([d, districts[d], Math.round(districts[d] / data.length * 100)]);
}
table.push(["Total", data.length, "100"]);
console.log(table.toString());
});
| nicjansma/talks | node-js-for-other-things/crimedata/index.3.js | JavaScript | mit | 881 |
// DESCRIPTION = require or disallow a space immediately following the // or /* in a comment
// STATUS = 2
// <!START
// Bad
/*
//comment
///<reference path="../../../../node_modules/@types/react/index.d.ts" />
*/
// Good
// comment
/// <reference path="../../../../node_modules/@types/react/index.d.ts" />
// END!>
document.window.append('', null);
| namics/eslint-config-namics | test/es5/rules/style/spaced-comment.js | JavaScript | mit | 352 |
'use strict';
var tape = require('../lib/thaliTape');
var IdentityExchange = require('thali/identityExchange/identityexchange');
var identityExchangeTestUtils = require('./identityExchangeTestUtils');
var ThaliEmitter = require('thali/thaliemitter');
var request = require('supertest-as-promised');
var identityExchangeUtils = require('thali/identityExchange/identityExchangeUtils');
var inherits = require('util').inherits;
var EventEmitter = require('events').EventEmitter;
var ThaliReplicationManager = require('thali/thalireplicationmanager');
var Promise = require('lie');
var urlSafeBase64 = require('urlsafe-base64');
var thaliApp = null;
var thaliServer = null;
var smallHash = null;
var bigHash = null;
function setUpServer() {
return identityExchangeTestUtils.createThaliAppServer()
.then(function(appAndServer) {
thaliApp = appAndServer.app;
thaliServer = appAndServer.server;
}).catch(function(err) {
throw err;
});
}
var test = tape({
setup: function(t) {
var smallAndBigHash = identityExchangeTestUtils.createSmallAndBigHash();
smallHash = smallAndBigHash.smallHash;
bigHash = smallAndBigHash.bigHash;
setUpServer().then(function() {
t.end();
});
},
teardown: function(t) {
thaliServer = null;
thaliApp = null;
if (thaliServer) {
thaliServer.close();
}
t.end();
}
});
inherits(ThaliEmitterMock, EventEmitter);
function ThaliEmitterMock() {
EventEmitter.call(this);
}
inherits(TRMMock, EventEmitter);
TRMMock.states = {
NotStarted: 'notStarted',
Started: 'started',
Stopped: 'stopped'
};
TRMMock.prototype.deviceIdentity = null;
TRMMock.prototype._emitter = null;
TRMMock.prototype.t = null;
TRMMock.prototype.expectedStartPort = null;
TRMMock.prototype.expectedDbName = null;
TRMMock.prototype.friendlyName = null;
TRMMock.prototype.state = TRMMock.states.NotStarted;
TRMMock.prototype.callBeforeStart = null;
function TRMMock(deviceIdentity, t, expectedStartPort, expectedDbName, friendlyName, callBeforeStart) {
EventEmitter.call(this);
this.deviceIdentity = deviceIdentity;
this.t = t;
this.expectedStartPort = expectedStartPort;
this.expectedDbName = expectedDbName;
this.friendlyName = friendlyName;
this.callBeforeStart = callBeforeStart;
this._emitter = new ThaliEmitterMock();
}
TRMMock.prototype.start = function(port, dbName, deviceName) {
var self = this;
if (self.state != TRMMock.states.NotStarted && self.state != TRMMock.states.Stopped) {
self.t.fail("Start was called on TRMMock when it wasn't in the right state.");
}
var localCallBeforeStart = this.callBeforeStart;
if (!localCallBeforeStart) {
localCallBeforeStart = function(port, dbName, deviceName, cb) {
cb();
};
}
localCallBeforeStart(port, dbName, deviceName, function() {
self.state = TRMMock.states.Started;
if (self.t) {
self.t.equal(port, self.expectedStartPort);
self.t.equal(dbName, self.expectedDbName);
self.t.equal(deviceName, self.deviceIdentity + ';' + self.friendlyName);
}
self.emit(ThaliReplicationManager.events.STARTED);
});
};
TRMMock.prototype.stop = function() {
if (this.state != TRMMock.states.Started) {
this.t.fail("Stop was called on TRMock when it wasn't in the start state.");
}
this.state = TRMMock.states.Stopped;
this.emit(ThaliReplicationManager.events.STOPPED);
};
TRMMock.prototype.getDeviceIdentity = function(cb) {
cb(null, this.deviceIdentity);
};
test('start with bad friendly names', function(t) {
var badNames = ['', {}, null, '123456789012345678901'];
badNames.forEach(function(badName) {
var identityExchange = new IdentityExchange(thaliApp, null, null, null);
identityExchange.startIdentityExchange(badName, function(err) {
t.notEqual(err, null);
});
});
t.end();
});
test('make sure startIdentityExchange sets things up properly', function(t) {
var myFriendlyName = 'Matt';
var trmMock = new TRMMock(urlSafeBase64.encode(smallHash), t, thaliServer.address().port, 'dbName', myFriendlyName);
var identityExchange = new IdentityExchange(thaliApp, thaliServer.address().port, trmMock, 'dbName');
var sawAbc = false;
var sawDef = false;
var peerAvailabilityEvents = [
{
peerName: '123;abc',
foo: 'bar1'
},
{
peerName: 'notlooking'
},
{
peerName: '456;def',
foo: 'bar2'
}
];
request(thaliApp)
.post(identityExchangeUtils.cbPath)
.send({ foo: 'bar'})
.expect(404)
.end(function(err, res) {
t.notOk(err);
identityExchange.startIdentityExchange(myFriendlyName, function(err) {
t.notOk(err);
request(thaliApp)
.post(identityExchangeUtils.rnMinePath)
.send({ foo: 'bar'})
.expect(400)
.end(function(err, res) {
t.notOk(err);
trmMock._emitter.emit(ThaliEmitter.events.PEER_AVAILABILITY_CHANGED, peerAvailabilityEvents);
});
});
});
identityExchange.on(IdentityExchange.Events.PeerIdentityExchange, function(peer) {
if (peer.peerFriendlyName == 'abc') {
t.notOk(sawAbc);
t.equals(peer.peerName, '123');
t.equals(peer.foo, 'bar1');
sawAbc = true;
}
if (peer.peerFriendlyName == 'def') {
t.notOk(sawDef);
t.equals(peer.peerName, '456');
t.equals(peer.foo, 'bar2');
sawDef = true;
}
if (sawAbc && sawDef) {
t.equal(trmMock.state, TRMMock.states.Started);
t.end();
}
});
});
test('make sure we get an error if we call start and then immediately call stop', function(t) {
var myFriendlyName = 'Toby';
var trmMock = new TRMMock(urlSafeBase64.encode(smallHash), t, thaliServer.address().port, 'dbName', myFriendlyName);
var identityExchange = new IdentityExchange(thaliApp, thaliServer.address().port, trmMock, 'dbName');
identityExchange.startIdentityExchange(myFriendlyName, function(err) {
t.equal(err, null);
});
t.throws(function() { identityExchange.stopExecutingIdentityExchange();});
t.end();
});
test('Make sure stop is clean from start', function(t) {
var myFriendlyName = 'Luke';
var trmMock = new TRMMock(urlSafeBase64.encode(smallHash), t, thaliServer.address().port, 'dbName', myFriendlyName);
var identityExchange = new IdentityExchange(thaliApp, thaliServer.address().port, trmMock, 'dbName');
identityExchange.on(IdentityExchange.Events.PeerIdentityExchange, function(peer) {
t.fail('Should not have been called on PeerIdentityExchange');
});
identityExchange.startIdentityExchange(myFriendlyName, function(err) {
t.notOk(err, 'Should not have gotten error on startIdentityExchange');
identityExchange.stopIdentityExchange(function(err) {
t.notOk(err, 'Should not have gotten error on stopIdentityExchange');
trmMock._emitter.emit(ThaliEmitter.events.PEER_AVAILABILITY_CHANGED, { peerName: 'abc;123' });
t.equal(trmMock.state, TRMMock.states.Stopped, 'State should be Stopped');
t.end();
});
});
});
test('Make sure stop is clean from stop execute identity exchange', function(t) {
var myFriendlyName = 'Jukka';
var trmMock = new TRMMock(urlSafeBase64.encode(smallHash), t, thaliServer.address().port, 'dbName', myFriendlyName);
var identityExchange = new IdentityExchange(thaliApp, thaliServer.address().port, trmMock, 'dbName');
identityExchange.on(IdentityExchange.Events.PeerIdentityExchange, function() {
t.fail();
});
identityExchange.startIdentityExchange(myFriendlyName, function(err) {
t.notOk(err);
identityExchange.executeIdentityExchange('foo', urlSafeBase64.encode(bigHash), function() { t.fail(); });
identityExchange.stopExecutingIdentityExchange();
identityExchange.stopIdentityExchange(function(err) {
t.notOk(err);
trmMock._emitter.emit(ThaliEmitter.events.PEER_AVAILABILITY_CHANGED, { peerName: 'abc;123' });
t.equal(trmMock.state, TRMMock.states.Stopped);
t.end();
});
});
});
test('make sure we do not have a race condition between startIdentityExchange and executeIdentityExchange',
function(t) {
var myFriendlyName = 'Doug';
var base64BigHash = urlSafeBase64.encode(bigHash);
var peerAvailabilityChangedEvents = [
{ peerName: base64BigHash+';abc'},
{ peerName: 'efg'},
{ peerName: base64BigHash+';def'}
];
var trmMock = new TRMMock(urlSafeBase64.encode(smallHash), t, thaliServer.address().port, 'dbName', myFriendlyName,
function(port, dbName, deviceName, cb) {
peerAvailabilityChangedEvents.forEach(function(peer) {
trmMock._emitter.emit(ThaliEmitter.events.PEER_AVAILABILITY_CHANGED, peer);
});
cb();
});
var identityExchange = new IdentityExchange(thaliApp, thaliServer.address().port, trmMock, 'dbName');
var sawAbc = false;
var sawDef = false;
var gotStartCallBack = false;
function checkAllDone(){
if (sawAbc && sawDef && gotStartCallBack) {
t.end();
}
}
identityExchange.on(IdentityExchange.Events.PeerIdentityExchange, function(peer) {
if (peer.peerFriendlyName == 'abc') {
t.notOk(sawAbc);
sawAbc = true;
t.doesNotThrow(function() {
identityExchange.executeIdentityExchange(peer.peerFriendlyName, peer.peerName, function() {
t.fail();
});
});
checkAllDone();
return;
}
if (peer.peerFriendlyName == 'def') {
t.notOk(sawDef);
sawDef = true;
checkAllDone();
return;
}
t.fail('We got an event we should not have');
});
identityExchange.startIdentityExchange(myFriendlyName, function(err) {
t.notOk(err);
gotStartCallBack = true;
checkAllDone();
});
});
test('illegal method combinations', function(t) {
var myFriendlyName = 'David';
var trmMock = new TRMMock(urlSafeBase64.encode(smallHash), t, thaliServer.address().port, 'dbName', myFriendlyName);
var identityExchange = new IdentityExchange(thaliApp, thaliServer.address().port, trmMock, 'dbName');
t.throws(function() { identityExchange.executeIdentityExchange('foo', 'bar', function() {t.fail(); }); });
t.throws(function() { identityExchange.stopExecutingIdentityExchange(); });
t.throws(function() { identityExchange.stopIdentityExchange(function() {t.fail(); }); });
identityExchange.startIdentityExchange(myFriendlyName, function(err) {
t.notOk(err);
t.throws(function() { identityExchange.startIdentityExchange(myFriendlyName, function() {t.fail(); }); });
t.throws(function() { identityExchange.stopExecutingIdentityExchange('foo', 'bar', function() {t.fail(); }); });
identityExchange.stopIdentityExchange(function(err) {
t.notOk(err);
t.throws(function() { identityExchange.stopExecutingIdentityExchange(); });
t.throws(function() { identityExchange.executeIdentityExchange('foo', 'bar', function() {t.fail(); }); });
identityExchange.startIdentityExchange(myFriendlyName, function(err) {
t.notOk(err);
identityExchange.executeIdentityExchange('foo', urlSafeBase64.encode(bigHash), function() {t.fail(); });
t.throws(function() { identityExchange.executeIdentityExchange('foo', 'bar', function() {t.fail(); }); });
t.throws(function() { identityExchange.stopIdentityExchange(function() {t.fail(); }); });
t.throws(function() { identityExchange.startIdentityExchange(myFriendlyName, function() {t.fail(); }); });
identityExchange.stopExecutingIdentityExchange();
t.throws(function() { identityExchange.stopExecutingIdentityExchange(); });
t.throws(function() { identityExchange.startIdentityExchange(myFriendlyName, function() {t.fail(); }); });
t.end();
});
});
});
});
function runToCompletion(t, identityExchange, myFriendlyName, trmMock, secondIdentityExchange, secondFriendlyName,
secondTrmMock, secondThaliServer) {
var firstPeerId = 'foo';
var secondPeerId = 'bar';
return new Promise(function(resolve, reject) {
var firstCode = null;
var secondCode = null;
function checkFinish() {
if (firstCode && secondCode) {
t.equal(firstCode, secondCode);
identityExchange.stopExecutingIdentityExchange();
identityExchange.stopIdentityExchange(function(err) {
t.notOk(err);
secondIdentityExchange.stopExecutingIdentityExchange();
secondIdentityExchange.stopIdentityExchange(function(err) {
t.notOk(err);
resolve();
});
});
}
}
identityExchange.startIdentityExchange(myFriendlyName, function(err) {
t.notOk(err);
identityExchange.executeIdentityExchange(secondPeerId, urlSafeBase64.encode(bigHash), function(err, code) {
t.notOk(err);
identityExchangeTestUtils.checkCode(t, code);
firstCode = code;
checkFinish();
});
secondIdentityExchange.startIdentityExchange(secondFriendlyName, function(err) {
t.notOk(err);
secondIdentityExchange.executeIdentityExchange(firstPeerId, urlSafeBase64.encode(smallHash), function(err, code) {
t.notOk(err);
identityExchangeTestUtils.checkCode(t, code);
secondCode = code;
checkFinish();
});
// Just for chuckles, this shouldn't do anything
secondTrmMock.emit(ThaliReplicationManager.events.CONNECTION_SUCCESS, { peerIdentifier: firstPeerId,
muxPort: thaliServer.address().port,
time: Date.now()});
trmMock.emit(ThaliReplicationManager.events.CONNECTION_SUCCESS, { peerIdentifier: secondPeerId,
muxPort: secondThaliServer.address().port,
time: Date.now()});
});
});
});
}
test('do an identity exchange and get code multiple times to make sure we do not hork state', function(t) {
var secondFriendlyName = 'Srikanth';
var secondThaliApp = null;
var secondThaliServer = null;
var secondTrmMock = null;
var secondIdentityExchange = null;
var myFriendlyName = 'John';
var trmMock = new TRMMock(urlSafeBase64.encode(smallHash), t, thaliServer.address().port, 'dbName', myFriendlyName);
var identityExchange = new IdentityExchange(thaliApp, thaliServer.address().port, trmMock, 'dbName');
identityExchangeTestUtils.createThaliAppServer()
.then(function(appAndServer) {
secondThaliApp = appAndServer.app;
secondThaliServer = appAndServer.server;
secondTrmMock = new TRMMock(urlSafeBase64.encode(bigHash), t, secondThaliServer.address().port, 'anotherDbName',
secondFriendlyName);
secondIdentityExchange = new IdentityExchange(secondThaliApp, secondThaliServer.address().port, secondTrmMock,
'anotherDbName');
function runIt() {
return runToCompletion(t, identityExchange, myFriendlyName, trmMock, secondIdentityExchange, secondFriendlyName,
secondTrmMock, secondThaliServer);
}
var testPromise = runIt();
for (var i = 0; i < 10; ++i) {
testPromise = testPromise.then(function () {
return runIt();
});
}
return testPromise;
}).then(function() {
secondThaliServer.close();
t.end();
}).catch(function(err) {
t.fail(err);
});
});
| thaliproject/Thali_CordovaPlugin | test/www/jxcore/bv_tests/disabled/IdentityExchange/testIdentityExchange.js | JavaScript | mit | 15,328 |
"use strict";
var _ = require('underscorem')
function stub(){}
var log = require('quicklog').make('minnow/pathmerger')
var editFp = require('./tcp_shared').editFp
var editCodes = editFp.codes
var editNames = editFp.names
function editToMatch(c, n, cb){
_.assertObject(c)
_.assertObject(n)
//console.log('editing to match: ' + JSON.stringify([c,n]))
//if(!n.property) _.errout('missing property: ' + JSON.stringify(n))
//_.assertInt(n.property)
if(n.object && c.object !== n.object){
c.object = n.object
if(n.object === n.top){
cb(editCodes.clearObject, {})
}else{
if(n.object === 36) _.errout('TODO: ' + n.top)
if(n.object < 0) _.errout('TODO')
cb(editCodes.selectObject, {id: n.object})
}
}
if(n.sub && c.sub !== n.sub){
c.sub = n.sub
if(_.isInt(n.sub)){
cb(editCodes.selectSubObject, {id: n.sub})
}else{
_.assertDefined(n.sub)
if(n.sub == undefined || n.sub == "undefined") _.errout('invalid sub: ' + JSON.stringify(n))
cb(editCodes.selectSubViewObject, {id: n.sub})
}
}
if(n.property !== c.property){
c.property = n.property
cb(editCodes.selectProperty, {typeCode: n.property})
}
if(n.keyOp && n.key === undefined) _.errout('missing key: ' + JSON.stringify(n))
if(n.key !== c.key){
if(n.key === undefined) return
//console.log('emitting key: ' + n.key)
_.assertInt(n.keyOp)
c.key = n.key
c.keyOp = n.keyOp
cb(n.keyOp, {key: n.key})
}
}
exports.editToMatch = editToMatch
| lfdoherty/minnow | server/pathmerger.js | JavaScript | mit | 1,452 |
var creds = (function () {
creds.API_SECRET="6CizSTGHXJ7QpfoWFUavgeepJNze4Gie9cyvIAAZsPM";
creds.API_KEY="www.greentechmedia.com";
return creds;
}());
| aleszu/parsely_dashboard | creds.js | JavaScript | mit | 161 |
module.exports = function( app, ExampleController ) {
// Define routes here
// app.all('/example/:action/:id?', ExampleController.attach());
// app.all('/example/?:action?', ExampleController.attach());
}
| CleverStack/backend-example-module | routes.js | JavaScript | mit | 217 |
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 155);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file.
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
var functional = options.functional
var existing = functional
? options.render
: options.beforeCreate
if (!functional) {
// inject component registration as beforeCreate hook
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
} else {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functioal component in vue file
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return existing(h, context)
}
}
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ }),
/***/ 155:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _buttonGroup = __webpack_require__(156);
var _buttonGroup2 = _interopRequireDefault(_buttonGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_buttonGroup2.default.install = function (Vue) {
Vue.component(_buttonGroup2.default.name, _buttonGroup2.default);
};
exports.default = _buttonGroup2.default;
/***/ }),
/***/ 156:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_button_group_vue__ = __webpack_require__(157);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_button_group_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_button_group_vue__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_0c71b59b_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_button_group_vue__ = __webpack_require__(158);
var normalizeComponent = __webpack_require__(0)
/* script */
/* template */
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = null
/* scopeId */
var __vue_scopeId__ = null
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_button_group_vue___default.a,
__WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_0c71b59b_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_button_group_vue__["a" /* default */],
__vue_template_functional__,
__vue_styles__,
__vue_scopeId__,
__vue_module_identifier__
)
/* harmony default export */ __webpack_exports__["default"] = (Component.exports);
/***/ }),
/***/ 157:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
//
//
//
//
//
exports.default = {
name: 'ElButtonGroup'
};
/***/ }),
/***/ 158:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"el-button-group"},[_vm._t("default")],2)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ __webpack_exports__["a"] = (esExports);
/***/ })
/******/ }); | Qinjianbo/blog | node_modules/element-ui/lib/button-group.js | JavaScript | mit | 8,372 |
// Regular expression that matches all symbols in the Variation Selectors Supplement block as per Unicode v4.0.1:
/\uDB40[\uDD00-\uDDEF]/; | mathiasbynens/unicode-data | 4.0.1/blocks/Variation-Selectors-Supplement-regex.js | JavaScript | mit | 138 |
/*
* pub-gatekeeper handle-errors.js
*
* Copyright (c) 2015-2022 Jürgen Leschner - github.com/jldec - MIT license
*/
var debug = require('debug')('pub:gatekeeper');
var u = require('pub-util');
module.exports = function handleErrors(server) {
// sugar
var opts = server.opts;
var log = opts.log;
var app = server.app;
app.use('/server/echo', testEcho);
// dev/test routes
if (!opts.production) {
app.use('/admin/testthrow', testThrow);
app.use('/admin/testerr', testErr);
app.use('/admin/testpost', testPost);
app.use('/admin/testget', testGet);
}
// mount 404 and 500 handlers
app.use(notFound);
app.use(errHandler);
return;
//--//--//--//--//--//--//--//--//--//--//
function notFound(req, res, next) {
debug('404 %s', req.originalUrl);
res.status(404).end();
}
function errHandler(err, req, res, next) {
if (!err.status) { log(err); }
error(err.status || 500, req, res, u.str(err));
}
// general purpose error response
function error(status, req, res, msg) {
debug('%s %s', status, req.originalUrl);
res.status(status).send(u.escape(msg || ''));
}
function testThrow() {
throw new Error('test throw');
}
function testErr(req, res) {
log(new Error('test err'));
error(403, req, res, '/admin/testerr');
}
function testPost(req, res) {
log('/admin/testpost', req.body);
res.status(200).send('OK');
};
function testGet(req, res) {
log('/admin/testget', req.query);
res.status(200).send('OK');
}
function testEcho(req, res) {
res.send(echoreq(req));
}
function echoreq(req) {
return {
ip: req.ip,
method: req.method,
url: req.originalUrl,
headers: req.headers,
query: req.query,
params: req.params,
body: req.body,
now: Date(),
user: req.user,
sessionID: req.sessionID,
session: req.session
};
}
}
| jldec/pub-gatekeeper | handle-errors.js | JavaScript | mit | 1,933 |
import * as Request from './request'
import React from 'react'
import { render } from 'react-dom'
import EditorWindow from './components/EditorWindow.jsx'
class Editor {
init() {
this.exists = true
let _self = this
Request.get("deck", function(deck) {
_self.deck = deck
})
}
clear() {
this.exists = false
this.deck = null
}
exists() {
return this.exists
}
getNobles () {
return this.deck.nobles
}
getCards(group) {
return this.deck.cards[group]
}
chooseCards(group, index, playerIndex) {
render(<EditorWindow group={group} index={index}
cards={this.getCards(group)} playerIndex={playerIndex} />,
document.getElementById("editor"))
}
chooseNoble(index) {
render(<EditorWindow index={index}
nobles={this.getNobles()} />,
document.getElementById("editor"))
}
}
let editor = new Editor()
export default editor | liuhb86/splendor-ai | react/src/editor.js | JavaScript | mit | 1,015 |
!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof exports?module.exports=b():a.EventEmitter=b()}(this,function(a){"use strict";function b(){this._bindings={}}var c=b.prototype;return c.on=function(a,b){if(b instanceof Function==!1)throw new Error("Callback is wrong type. Expected Function and got "+typeof b);var c=this._bindings[a];void 0===c&&(c=[],this._bindings[a]=c),c.push(b)},c.off=function(a,b){var c=this._bindings[a];if(void 0!==c){var d=c.indexOf(b);-1!==d&&(c.splice(d,1),0===c.length&&delete this._bindings[a])}},c.emit=function(a,c){var d=this._bindings[a];if(void 0!==d){var e,f=d.length,g=new b.Event(a,this,c);for(e=0;f>e;e++)d[e](g)}},b.Event=function(a,b,c){this.type=a,this.target=b,this.data=c},b}); | bpander/EventEmitter | dist/EventEmitter.min.js | JavaScript | mit | 751 |
var constants = require('./constants')
var QRMode = constants.QRMode
var QRErrorCorrectLevel = constants.QRErrorCorrectLevel
var QRMaskPattern = constants.QRMaskPattern
var QRRSBlock = function() {
var RS_BLOCK_TABLE = [
// L
// M
// Q
// H
// 1
[1, 26, 19],
[1, 26, 16],
[1, 26, 13],
[1, 26, 9],
// 2
[1, 44, 34],
[1, 44, 28],
[1, 44, 22],
[1, 44, 16],
// 3
[1, 70, 55],
[1, 70, 44],
[2, 35, 17],
[2, 35, 13],
// 4
[1, 100, 80],
[2, 50, 32],
[2, 50, 24],
[4, 25, 9],
// 5
[1, 134, 108],
[2, 67, 43],
[2, 33, 15, 2, 34, 16],
[2, 33, 11, 2, 34, 12],
// 6
[2, 86, 68],
[4, 43, 27],
[4, 43, 19],
[4, 43, 15],
// 7
[2, 98, 78],
[4, 49, 31],
[2, 32, 14, 4, 33, 15],
[4, 39, 13, 1, 40, 14],
// 8
[2, 121, 97],
[2, 60, 38, 2, 61, 39],
[4, 40, 18, 2, 41, 19],
[4, 40, 14, 2, 41, 15],
// 9
[2, 146, 116],
[3, 58, 36, 2, 59, 37],
[4, 36, 16, 4, 37, 17],
[4, 36, 12, 4, 37, 13],
// 10
[2, 86, 68, 2, 87, 69],
[4, 69, 43, 1, 70, 44],
[6, 43, 19, 2, 44, 20],
[6, 43, 15, 2, 44, 16],
// 11
[4, 101, 81],
[1, 80, 50, 4, 81, 51],
[4, 50, 22, 4, 51, 23],
[3, 36, 12, 8, 37, 13],
// 12
[2, 116, 92, 2, 117, 93],
[6, 58, 36, 2, 59, 37],
[4, 46, 20, 6, 47, 21],
[7, 42, 14, 4, 43, 15],
// 13
[4, 133, 107],
[8, 59, 37, 1, 60, 38],
[8, 44, 20, 4, 45, 21],
[12, 33, 11, 4, 34, 12],
// 14
[3, 145, 115, 1, 146, 116],
[4, 64, 40, 5, 65, 41],
[11, 36, 16, 5, 37, 17],
[11, 36, 12, 5, 37, 13],
// 15
[5, 109, 87, 1, 110, 88],
[5, 65, 41, 5, 66, 42],
[5, 54, 24, 7, 55, 25],
[11, 36, 12],
// 16
[5, 122, 98, 1, 123, 99],
[7, 73, 45, 3, 74, 46],
[15, 43, 19, 2, 44, 20],
[3, 45, 15, 13, 46, 16],
// 17
[1, 135, 107, 5, 136, 108],
[10, 74, 46, 1, 75, 47],
[1, 50, 22, 15, 51, 23],
[2, 42, 14, 17, 43, 15],
// 18
[5, 150, 120, 1, 151, 121],
[9, 69, 43, 4, 70, 44],
[17, 50, 22, 1, 51, 23],
[2, 42, 14, 19, 43, 15],
// 19
[3, 141, 113, 4, 142, 114],
[3, 70, 44, 11, 71, 45],
[17, 47, 21, 4, 48, 22],
[9, 39, 13, 16, 40, 14],
// 20
[3, 135, 107, 5, 136, 108],
[3, 67, 41, 13, 68, 42],
[15, 54, 24, 5, 55, 25],
[15, 43, 15, 10, 44, 16],
// 21
[4, 144, 116, 4, 145, 117],
[17, 68, 42],
[17, 50, 22, 6, 51, 23],
[19, 46, 16, 6, 47, 17],
// 22
[2, 139, 111, 7, 140, 112],
[17, 74, 46],
[7, 54, 24, 16, 55, 25],
[34, 37, 13],
// 23
[4, 151, 121, 5, 152, 122],
[4, 75, 47, 14, 76, 48],
[11, 54, 24, 14, 55, 25],
[16, 45, 15, 14, 46, 16],
// 24
[6, 147, 117, 4, 148, 118],
[6, 73, 45, 14, 74, 46],
[11, 54, 24, 16, 55, 25],
[30, 46, 16, 2, 47, 17],
// 25
[8, 132, 106, 4, 133, 107],
[8, 75, 47, 13, 76, 48],
[7, 54, 24, 22, 55, 25],
[22, 45, 15, 13, 46, 16],
// 26
[10, 142, 114, 2, 143, 115],
[19, 74, 46, 4, 75, 47],
[28, 50, 22, 6, 51, 23],
[33, 46, 16, 4, 47, 17],
// 27
[8, 152, 122, 4, 153, 123],
[22, 73, 45, 3, 74, 46],
[8, 53, 23, 26, 54, 24],
[12, 45, 15, 28, 46, 16],
// 28
[3, 147, 117, 10, 148, 118],
[3, 73, 45, 23, 74, 46],
[4, 54, 24, 31, 55, 25],
[11, 45, 15, 31, 46, 16],
// 29
[7, 146, 116, 7, 147, 117],
[21, 73, 45, 7, 74, 46],
[1, 53, 23, 37, 54, 24],
[19, 45, 15, 26, 46, 16],
// 30
[5, 145, 115, 10, 146, 116],
[19, 75, 47, 10, 76, 48],
[15, 54, 24, 25, 55, 25],
[23, 45, 15, 25, 46, 16],
// 31
[13, 145, 115, 3, 146, 116],
[2, 74, 46, 29, 75, 47],
[42, 54, 24, 1, 55, 25],
[23, 45, 15, 28, 46, 16],
// 32
[17, 145, 115],
[10, 74, 46, 23, 75, 47],
[10, 54, 24, 35, 55, 25],
[19, 45, 15, 35, 46, 16],
// 33
[17, 145, 115, 1, 146, 116],
[14, 74, 46, 21, 75, 47],
[29, 54, 24, 19, 55, 25],
[11, 45, 15, 46, 46, 16],
// 34
[13, 145, 115, 6, 146, 116],
[14, 74, 46, 23, 75, 47],
[44, 54, 24, 7, 55, 25],
[59, 46, 16, 1, 47, 17],
// 35
[12, 151, 121, 7, 152, 122],
[12, 75, 47, 26, 76, 48],
[39, 54, 24, 14, 55, 25],
[22, 45, 15, 41, 46, 16],
// 36
[6, 151, 121, 14, 152, 122],
[6, 75, 47, 34, 76, 48],
[46, 54, 24, 10, 55, 25],
[2, 45, 15, 64, 46, 16],
// 37
[17, 152, 122, 4, 153, 123],
[29, 74, 46, 14, 75, 47],
[49, 54, 24, 10, 55, 25],
[24, 45, 15, 46, 46, 16],
// 38
[4, 152, 122, 18, 153, 123],
[13, 74, 46, 32, 75, 47],
[48, 54, 24, 14, 55, 25],
[42, 45, 15, 32, 46, 16],
// 39
[20, 147, 117, 4, 148, 118],
[40, 75, 47, 7, 76, 48],
[43, 54, 24, 22, 55, 25],
[10, 45, 15, 67, 46, 16],
// 40
[19, 148, 118, 6, 149, 119],
[18, 75, 47, 31, 76, 48],
[34, 54, 24, 34, 55, 25],
[20, 45, 15, 61, 46, 16]
]
var qrRSBlock = function(totalCount, dataCount) {
var _this = {}
_this.totalCount = totalCount
_this.dataCount = dataCount
return _this
}
var _this = {}
var getRsBlockTable = function(typeNumber, errorCorrectLevel) {
switch(errorCorrectLevel) {
case QRErrorCorrectLevel.L :
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]
case QRErrorCorrectLevel.M :
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]
case QRErrorCorrectLevel.Q :
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]
case QRErrorCorrectLevel.H :
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]
default :
return undefined
}
}
_this.getRSBlocks = function(typeNumber, errorCorrectLevel) {
var rsBlock = getRsBlockTable(typeNumber, errorCorrectLevel)
if (typeof rsBlock == 'undefined') {
throw new Error('bad rs block @ typeNumber:' + typeNumber +
'/errorCorrectLevel:' + errorCorrectLevel)
}
var length = rsBlock.length / 3
var list = new Array()
for (var i = 0; i < length; i += 1) {
var count = rsBlock[i * 3 + 0]
var totalCount = rsBlock[i * 3 + 1]
var dataCount = rsBlock[i * 3 + 2]
for (var j = 0; j < count; j += 1) {
list.push(qrRSBlock(totalCount, dataCount) )
}
}
return list
}
return _this
}()
module.exports = QRRSBlock
| rexwhitten/qstudent | node_modules/qr-encode/lib/rsblock.js | JavaScript | mit | 6,426 |
'use strict';
var chai = require('chai'),
findInFiles = require('../index'),
stringOne = 'dolor sit amet',
stringTwo = 'Träumen',
stringThree = 'This is in both files',
stringFour = 'This is duplicate';
chai.should();
describe('find some test strings', function () {
it('should find stringOne only in fileOne exactly one time', function (done) {
findInFiles.find(stringOne, '.', '.txt$')
.then(function(result) {
result['test/fileOne.txt'].count.should.equal(1);
result.should.not.have.property('test/fileTwo.txt');
done();
});
});
it('should find stringTwo only in fileTwo exactly one time', function (done) {
findInFiles.find(stringTwo, '.', '.txt$')
.then(function(result) {
result['test/fileTwo.txt'].count.should.equal(1);
result.should.not.have.property('test/fileOne.txt');
done();
});
});
it('should find stringThree in both files exactly one time', function (done) {
findInFiles.find(stringThree, '.', '.txt$')
.then(function(result) {
result['test/fileOne.txt'].count.should.equal(1);
result['test/fileTwo.txt'].count.should.equal(1);
done();
});
});
it('should find stringFour 2 times in fileOne and 3 times in fileTwo', function (done) {
findInFiles.find(stringFour, '.', '.txt$')
.then(function(result) {
result['test/fileOne.txt'].count.should.equal(2);
result['test/fileTwo.txt'].count.should.equal(3);
done();
});
});
it('should not find strings in the .js file', function (done) {
findInFiles.find(stringOne, '.', '.txt$')
.then(function(result) {
result['test/fileOne.txt'].count.should.equal(1);
result.should.not.have.property('test/fileOne.md');
done();
});
});
it('should find strings in all files', function (done) {
findInFiles.find(stringOne, '.')
.then(function(result) {
result['test/fileOne.txt'].count.should.equal(1);
result['test/fileOne.md'].count.should.equal(1);
done();
});
});
});
| erwinmombay/find-in-files | test/test.js | JavaScript | mit | 2,254 |
// Given a binary tree, return all root-to-leaf paths.
//
// For example, given the following binary tree:
//
// 1
// / \
// 2 3
// \
// 5
//
// All root-to-leaf paths are:
//
// ["1->2->5", "1->3"]
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @return {string[]}
*/
var binaryTreePaths = function(root) {
if (!root) {
return [];
}
root.path = root.val.toString();
var paths = [];
var nodes = [root];
var node;
while (nodes.length > 0) {
node = nodes.pop();
if (!node.left && !node.right) {
paths.push(node.path);
} else {
if (node.right) {
node.right.path = node.path + `->${node.right.val}`;
nodes.push(node.right);
}
if (node.left) {
node.left.path = node.path + `->${node.left.val}`;
nodes.push(node.left);
}
}
}
return paths;
};
| haoliangyu/leetcode | easy/125.binary.tree.paths.js | JavaScript | mit | 978 |
var Column = (function () {
function Column(id, settings, dataSet) {
this.id = id;
this.settings = settings;
this.dataSet = dataSet;
this.title = '';
this.type = '';
this.class = '';
this.width = '';
this.isSortable = false;
this.isEditable = true;
this.isAddable = true;
this.isFilterable = false;
this.sortDirection = '';
this.defaultSortDirection = '';
this.editor = { type: '', config: {}, component: null };
this.filter = { type: '', config: {} };
this.renderComponent = null;
this.process();
}
Column.prototype.getCompareFunction = function () {
return this.compareFunction;
};
Column.prototype.getValuePrepareFunction = function () {
return this.valuePrepareFunction;
};
Column.prototype.getFilterFunction = function () {
return this.filterFunction;
};
Column.prototype.getConfig = function () {
return this.editor && this.editor.config;
};
Column.prototype.getFilterType = function () {
return this.filter && this.filter.type;
};
Column.prototype.getFilterConfig = function () {
return this.filter && this.filter.config;
};
Column.prototype.process = function () {
this.title = this.settings['title'];
this.class = this.settings['class'];
this.width = this.settings['width'];
this.type = this.prepareType();
this.editor = this.settings['editor'];
this.filter = this.settings['filter'];
this.renderComponent = this.settings['renderComponent'];
this.isFilterable = typeof this.settings['filter'] === 'undefined' ? true : !!this.settings['filter'];
this.defaultSortDirection = ['asc', 'desc']
.indexOf(this.settings['sortDirection']) !== -1 ? this.settings['sortDirection'] : '';
this.isSortable = typeof this.settings['sort'] === 'undefined' ? true : !!this.settings['sort'];
this.isEditable = typeof this.settings['editable'] === 'undefined' ? true : !!this.settings['editable'];
this.isAddable = typeof this.settings['addable'] === 'undefined' ? true : !!this.settings['addable'];
this.sortDirection = this.prepareSortDirection();
this.compareFunction = this.settings['compareFunction'];
this.valuePrepareFunction = this.settings['valuePrepareFunction'];
this.filterFunction = this.settings['filterFunction'];
};
Column.prototype.prepareType = function () {
return this.settings['type'] || this.determineType();
};
Column.prototype.prepareSortDirection = function () {
return this.settings['sort'] === 'desc' ? 'desc' : 'asc';
};
Column.prototype.determineType = function () {
// TODO: determine type by data
return 'text';
};
return Column;
}());
export { Column };
//# sourceMappingURL=column.js.map | rtnews/rtsfnt | node_modules/ng2-smart-table/lib/data-set/column.js | JavaScript | mit | 2,957 |
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
require('babel-polyfill');
var _xml2js = require('xml2js');
var _xml2js2 = _interopRequireDefault(_xml2js);
var _fs = require('fs');
var _fs2 = _interopRequireDefault(_fs);
var _changeCase = require('change-case');
var _changeCase2 = _interopRequireDefault(_changeCase);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var ResxParser = function () {
function ResxParser() {
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var _ref$convertIdCase = _ref.convertIdCase;
var convertIdCase = _ref$convertIdCase === undefined ? 'camel' : _ref$convertIdCase;
var _ref$fnTransformId = _ref.fnTransformId;
var // camel,constant,dot,header,lower,lcFirst,no,param,pascal,path,sentence,snake,swap,title,upper,ucFirst
fnTransformId = _ref$fnTransformId === undefined ? null : _ref$fnTransformId;
var _ref$fnTransformValue = _ref.fnTransformValue;
var // (idString)=>{ doSometing(idString) ... return idString;}
fnTransformValue = _ref$fnTransformValue === undefined ? this.transformResource : _ref$fnTransformValue;
var _ref$filter = _ref.filter;
var // (valueString)=>{ doSometing(valueString) ... return valueString;
filter = _ref$filter === undefined ? null : _ref$filter;
_classCallCheck(this, ResxParser);
var supportedCases = ["camel", "constant", "dot", "header", "lower", "lcFirst", "no", "param", "pascal", "path", "sentence", "snake", "swap", "title", "upper", "ucFirst"];
if (convertIdCase) {
if (supportedCases.includes(convertIdCase) == true) {
this.convertIdCase = convertIdCase;
} else {
throw new Error(convertIdCase + ' is not a supported case conversion');
}
}
this.fnTransformId = fnTransformId;
this.fnTransformValue = fnTransformValue;
this.filter = filter;
}
_createClass(ResxParser, [{
key: 'do',
value: function _do(fn, callback) {
var that = this;
return function (err) {
if (err) {
console.log(err);
if (callback) {
callback(err, null);
}
} else {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
if (callback) {
fn.bind(that).apply(undefined, args.concat([callback]));
} else {
fn.bind(that).apply(undefined, args);
}
}
};
}
}, {
key: 'parseResxFile',
value: function parseResxFile(filename, callback) {
_fs2.default.readFile(filename, this.do(this.parseString, callback));
}
}, {
key: 'parseString',
value: function parseString(xmlString, callback) {
var parser = new _xml2js2.default.Parser();
parser.parseString(xmlString, this.do(this.extractFromXml, callback));
}
}, {
key: 'extractFromXml',
value: function extractFromXml(xmlDom, callback) {
var _this = this;
var resources = {};
try {
if (xmlDom && xmlDom.root && xmlDom.root.data && xmlDom.root.data.length > 0) {
xmlDom.root.data.forEach(function (node) {
var res = _this.getResource(node);
if (res) {
resources[res.id] = res.resource;
}
});
if (callback) {
callback(null, resources);
}
}
} catch (ex) {
if (callback) {
callback(ex, null);
}
}
}
}, {
key: 'getResource',
value: function getResource(item) {
if (item && item.$ && item.$.name) {
var id = this.getID(item.$.name),
value = item.value && item.value[0] ? item.value[0] : "",
comment = item.comment && item.comment[0] ? item.comment[0] : "";
if (this.filter) {
if (this.filter(id, value, comment)) {
return null;
}
}
return {
id: id,
resource: this.fnTransformValue(id, value, comment)
};
} else {
throw new Error("Resource Id missing");
}
}
}, {
key: 'transformResource',
value: function transformResource(id, value, comment) {
return value;
}
}, {
key: 'getID',
value: function getID(id) {
if (this.convertIdCase) {
id = _changeCase2.default[this.convertIdCase](id);
}
if (this.fnTransformId) {
id = this.fnTransformId(id);
}
return id;
}
}]);
return ResxParser;
}();
exports.default = ResxParser;
module.exports = exports['default']; | kjayasa/resx-parser | lib/resx-parser.js | JavaScript | mit | 5,442 |
export default class Fetcher {
constructor(basePath) {
this.basePath = basePath
}
static checkStatus(response) {
if (response.status >= 200 && response.status < 300) {
return response
}
const error = new Error(response.statusText)
error.response = response
throw error
}
static parseJson(response) {
return response.json()
}
get(path, headers) {
return this.makeRequest('GET', path, headers)
}
post(path, headers, body) {
return this.makeRequest('POST', path, headers, body)
}
put(path, headers, body) {
return this.makeRequest('PUT', path, headers, body)
}
delete(path, headers, body) {
return this.makeRequest('DELETE', path, headers, body)
}
makeRequest(method, path, headers, body) {
const url = `${this.basePath}${path}`
const data = { method, headers, credentials: 'same-origin' }
if (body) {
data.body = JSON.stringify(body)
}
return fetch(url, data).then(Fetcher.checkStatus).
then(Fetcher.parseJson)
}
}
| cheshire137/overwatch-team-comps | app/assets/javascripts/models/fetcher.js | JavaScript | mit | 1,034 |
import React, { Component } from 'react';
import svg from 'lib/svg';
@svg({
width: 600,
height: 513.1
})
class Bible365 extends Component {
render = () => {
const st3Style = {
opacity: '0.1'
};
const st9Style = {
opacity: '0.5'
};
/* eslint-disable */
return (
<g>
<g>
<g>
<polygon fill="#FF5959" points="3.5,385.8 121.5,385.8 121.5,268.3 3.5,268.3 27.1,327.1 "/>
<path fill="#3A364D" d="M123.9,388.2H0l24.5-61.1L0,265.9h123.9V388.2z M7.1,383.4h112V270.7H7.1l22.5,56.3
L7.1,383.4z"/>
</g>
<g>
<polygon fill="#FF5959" points="596.5,385.8 479,385.8 479,268.3 596.5,268.3 572.9,327.1 "/>
<path fill="#3A364D" d="M600,388.2H476.6V265.9H600l-24.5,61.1L600,388.2z M481.4,383.4h111.5l-22.5-56.3l22.5-56.3
H481.4V383.4z"/>
</g>
<g>
<path fill="#3A364D" d="M479,315.3v-23.5h35.2c6.5,0,11.7,5.3,11.7,11.7v11.7H479z"/>
<path fill="#3A364D" d="M528.4,317.7h-51.8v-28.3h37.6c7.8,0,14.1,6.3,14.1,14.1V317.7z M481.4,312.9h42.2v-9.3
c0-5.2-4.2-9.3-9.3-9.3h-32.8V312.9z"/>
</g>
<g>
<path fill="#3A364D" d="M121.5,315.3v-23.5H86.3c-6.5,0-11.7,5.3-11.7,11.7v11.7H121.5z"/>
<path fill="#3A364D" d="M123.9,317.7H72.2v-14.1c0-7.8,6.3-14.1,14.1-14.1h37.6V317.7z M77,312.9h42.2v-18.7H86.3
c-5.2,0-9.3,4.2-9.3,9.3V312.9z"/>
</g>
<g>
<path fill="#3A364D" d="M74.6,354.5H53.4c-1.3,0-2.4-1.1-2.4-2.4c0-1.3,1.1-2.4,2.4-2.4h21.1c1.3,0,2.4,1.1,2.4,2.4
C77,353.4,75.9,354.5,74.6,354.5z"/>
</g>
<g>
<path fill="#3A364D" d="M74.6,342.7h-6.7c-1.3,0-2.4-1.1-2.4-2.4c0-1.3,1.1-2.4,2.4-2.4h6.7c1.3,0,2.4,1.1,2.4,2.4
C77,341.7,75.9,342.7,74.6,342.7z"/>
</g>
<g>
<path fill="#3A364D" d="M74.6,318.9H57.1c-1.3,0-2.4-1.1-2.4-2.4c0-1.3,1.1-2.4,2.4-2.4h17.4c1.3,0,2.4,1.1,2.4,2.4
C77,317.8,75.9,318.9,74.6,318.9z"/>
</g>
<g>
<path fill="#3A364D" d="M58.7,342.7H43.6c-1.3,0-2.4-1.1-2.4-2.4c0-1.3,1.1-2.4,2.4-2.4h15.1c1.3,0,2.4,1.1,2.4,2.4
C61.1,341.7,60.1,342.7,58.7,342.7z"/>
</g>
<g>
<path fill="#3A364D" d="M539.5,317.7H526c-1.3,0-2.4-1.1-2.4-2.4c0-1.3,1.1-2.4,2.4-2.4h13.5c1.3,0,2.4,1.1,2.4,2.4
C541.9,316.6,540.8,317.7,539.5,317.7z"/>
</g>
<g>
<path fill="#3A364D" d="M547.1,345.1H526c-1.3,0-2.4-1.1-2.4-2.4c0-1.3,1.1-2.4,2.4-2.4h21.1c1.3,0,2.4,1.1,2.4,2.4
C549.5,344.1,548.4,345.1,547.1,345.1z"/>
</g>
<g>
<path fill="#3A364D" d="M556.9,356.9h-6.7c-1.3,0-2.4-1.1-2.4-2.4c0-1.3,1.1-2.4,2.4-2.4h6.7c1.3,0,2.4,1.1,2.4,2.4
C559.3,355.8,558.2,356.9,556.9,356.9z"/>
</g>
<g>
<path fill="#3A364D" d="M539.5,356.9H526c-1.3,0-2.4-1.1-2.4-2.4c0-1.3,1.1-2.4,2.4-2.4h13.5c1.3,0,2.4,1.1,2.4,2.4
C541.9,355.8,540.8,356.9,539.5,356.9z"/>
</g>
</g>
<g>
<g>
<g>
<path fill="#605B73" d="M299.7,508.3c-8.4,0-16.6-2.2-23.8-6.4l-113.4-65.5l-35.9-20.7c-0.2-0.1-0.3-0.2-0.5-0.3
c-1.2-0.7-2.4-1.5-3.6-2.4c-2.2-1.6-4.3-3.4-6.1-5.4c-3.3-3.4-6.1-7.3-8.2-11.5c-3.4-6.7-5.2-14.1-5.2-21.6V146.3
c0-17,9.1-32.8,23.8-41.3L275.9,19c7.2-4.2,15.5-6.4,23.8-6.4s16.6,2.2,23.8,6.4l149.1,86.1c14.7,8.5,23.8,24.3,23.8,41.3v228.2
c0,12.4-4.8,24.2-13.4,33.1c-1.9,2-4,3.7-6.1,5.3c-1.4,1-2.8,1.9-4.3,2.8l-149.1,86.1C316.3,506.1,308.1,508.3,299.7,508.3z"/>
</g>
<g>
<path fill="#3A364D" d="M299.7,17.4c7.4,0,14.8,1.9,21.4,5.7l149.1,86.1c13.3,7.7,21.4,21.8,21.4,37.1v228.2
c0,11.3-4.4,21.9-12.1,29.8c-1.7,1.7-3.5,3.4-5.5,4.8c-1.2,0.9-2.5,1.7-3.9,2.5l-28.4,16.4l-7.2,4.2l-8.3,4.8l-13.2,7.6
l-91.9,53.1c-6.6,3.8-14,5.7-21.4,5.7c-7.4,0-14.8-1.9-21.4-5.7l-91.9-53.1l-13.2-7.6l-8.3-4.8l-35.7-20.6
c-0.2-0.1-0.4-0.2-0.6-0.4c-1.1-0.7-2.2-1.4-3.3-2.2c-2-1.4-3.8-3.1-5.5-4.8c-3-3.1-5.5-6.6-7.4-10.3c-3-5.9-4.7-12.6-4.7-19.5
V146.3c0-15.3,8.2-29.5,21.4-37.1l149.1-86.1C284.9,19.3,292.3,17.4,299.7,17.4 M299.7,7.8c-9.2,0-18.3,2.4-26.2,7l-149.1,86.1
c-16.2,9.3-26.2,26.7-26.2,45.4v228.2c0,8.2,2,16.5,5.7,23.8c2.4,4.6,5.4,8.9,9,12.6c2,2.1,4.3,4.1,6.8,5.9
c1.3,1,2.6,1.8,3.9,2.6c0.2,0.1,0.4,0.2,0.5,0.3l0.1,0.1l0.1,0l0.1,0l35.7,20.6l8.3,4.8l13.2,7.6l91.9,53.1c8,4.6,17,7,26.2,7
c9.2,0,18.3-2.4,26.2-7l91.9-53.1l13.2-7.6l8.3-4.8l7.2-4.2l28.4-16.4c1.6-0.9,3.2-2,4.7-3.1c2.4-1.7,4.7-3.7,6.7-5.9
c9.5-9.8,14.8-22.8,14.8-36.5V146.3c0-18.7-10-36.1-26.2-45.4L326,14.8C318,10.2,308.9,7.8,299.7,7.8L299.7,7.8z"/>
</g>
</g>
<g style={ st3Style }>
<path fill="#FFFFFF" d="M138.3,169.3v182.3c0,18.6,9.9,35.8,26.1,45.1l109.3,63.1c16.1,9.3,36,9.3,52.1,0
l109.3-63.1c16.1-9.3,26.1-26.5,26.1-45.1V169.3c0-18.6-9.9-35.8-26.1-45.1L325.8,61c-16.1-9.3-36-9.3-52.1,0l-109.3,63.1
C148.2,133.5,138.3,150.7,138.3,169.3z"/>
</g>
<g style={ st3Style }>
<path fill="#FFFFFF" d="M172.9,178.6v166.2c0,11.2,6,21.6,15.7,27.2l95.4,55.1c9.7,5.6,21.7,5.6,31.4,0l95.4-55.1
c9.7-5.6,15.7-16,15.7-27.2V178.6c0-11.2-6-21.6-15.7-27.2l-95.4-55.1c-9.7-5.6-21.7-5.6-31.4,0l-95.4,55.1
C178.9,157.1,172.9,167.4,172.9,178.6z"/>
</g>
</g>
<g>
<g>
<g>
<path fill="#EBF1FA" d="M300.2,60.5V50.3c0-8.2-5.5-15.4-13.4-17.5l-111-29.7v39L300.2,60.5z"/>
<path fill="#3A364D" d="M302.6,63.3L173.4,44.2V0l114,30.5c9,2.4,15.2,10.5,15.2,19.8V63.3z M178.2,40l119.7,17.7
v-7.5c0-7.1-4.8-13.3-11.6-15.2l-108-28.9V40z"/>
</g>
<g>
<path fill="#A6CFE6" d="M300.2,60.5L300.2,60.5c0-8.2-5.5-15.4-13.4-17.5l-111-29.7v31L300.2,60.5z"/>
<path fill="#3A364D" d="M302.6,63.3L173.4,46.5V10.3l114,30.5c9,2.4,15.2,10.5,15.2,19.8V63.3z M178.2,42.3
l119.4,15.5c-1.1-5.9-5.5-10.8-11.4-12.4l-108-28.9V42.3z"/>
</g>
<g>
<path fill="#EBF1FA" d="M300.2,60.5V50.3c0-8.2,5.5-15.4,13.4-17.5l111-29.7v39L300.2,60.5z"/>
<path fill="#3A364D" d="M297.8,63.3V50.3c0-9.3,6.3-17.4,15.2-19.8L427.1,0v44.2L297.8,63.3z M422.3,6.3l-108,28.9
c-6.9,1.8-11.6,8.1-11.6,15.2v7.5L422.3,40V6.3z"/>
</g>
<g>
<path fill="#A6CFE6" d="M300.2,60.5L300.2,60.5c0-8.2,5.5-15.4,13.4-17.5l111-29.7v31L300.2,60.5z"/>
<path fill="#3A364D" d="M297.8,63.3v-2.7c0-9.3,6.3-17.4,15.2-19.8l114-30.5v36.2L297.8,63.3z M422.3,16.5
l-108,28.9c-6,1.6-10.3,6.5-11.4,12.4l119.4-15.5V16.5z"/>
</g>
<g>
<path fill="#FAC04A" d="M326.3,50.8v176.4c0,0-9.3,10.1-26.1,10.1c-16.8,0-26.1-10.1-26.1-10.1V50.8
c0,0,11.6,9.7,26.1,9.7C314.7,60.6,326.3,50.8,326.3,50.8z"/>
</g>
<g>
<path fill="#3A364D" d="M326.3,85.7v29.7c0,0-9.5,6.7-26.1,6.7c-16.5,0-26.1-6.7-26.1-6.7V85.7
c0,0,12.5,6.2,26.1,6.2v0C313.8,91.9,326.3,85.7,326.3,85.7z"/>
</g>
<g>
<path fill="#3A364D" d="M326.3,131.2v7.4c0,0-9.5,6.7-26.1,6.7c-16.5,0-26.1-6.7-26.1-6.7v-7.4
c0,0,12.5,6.2,26.1,6.2S326.3,131.2,326.3,131.2z"/>
</g>
<g>
<path fill="#3A364D" d="M326.3,202.2v7.4c0,0-9.5,6.7-26.1,6.7c-16.5,0-26.1-6.7-26.1-6.7v-7.4
c0,0,12.5,6.2,26.1,6.2S326.3,202.2,326.3,202.2z"/>
</g>
<g>
<path fill="#FAC04A" d="M274.1,227.2L170.7,201c-4.2-1.1-7.1-4.7-7.1-8.8V33.3c0-6.1,6.1-10.5,12.2-8.8l98.4,26.3
V227.2z"/>
</g>
<g>
<polygon fill="#EBF1FA" points="237.2,38.7 237.2,108.3 247.1,103.2 257.1,112.9 257.1,44 "/>
</g>
<g>
<path fill="#FAC04A" d="M326.3,227.2L429.8,201c4.2-1.1,7.1-4.7,7.1-8.8V33.3c0-6.1-6.1-10.5-12.2-8.8l-98.4,26.3
V227.2z"/>
</g>
<g>
<polygon fill="#FF9D4D" points="326.3,227.2 341.5,223.4 326.3,50.8 "/>
</g>
<g>
<polygon fill="#FF9D4D" points="401.9,171.8 436.9,192.4 436.9,169.7 401.9,169.7 "/>
</g>
<g>
<polygon fill="#FF9D4D" points="198.6,171.8 163.5,192.4 163.6,169.7 198.6,169.7 "/>
</g>
<g>
<polygon fill="#FF9D4D" points="274.1,227.2 259,223.4 274.1,50.8 "/>
</g>
<g>
<path fill="#3A364D" d="M300.2,239.7c-17.7,0-27.4-10.4-27.8-10.9c-0.4-0.4-0.6-1-0.6-1.6V50.8
c0-0.9,0.5-1.8,1.4-2.2c0.8-0.4,1.8-0.3,2.6,0.3c0.1,0.1,11.1,9.2,24.5,9.2c13.5,0,24.4-9.1,24.5-9.2c0.7-0.6,1.7-0.7,2.6-0.3
c0.8,0.4,1.4,1.2,1.4,2.2v176.4c0,0.6-0.2,1.2-0.6,1.6C327.7,229.3,317.9,239.7,300.2,239.7z M276.5,226.2
c2.3,2.1,10.6,8.7,23.7,8.7c13.2,0,21.4-6.6,23.7-8.7V55.5c-4.8,3.1-13.5,7.5-23.7,7.5c-10.2,0-18.9-4.4-23.7-7.5V226.2z"/>
</g>
<g>
<path fill="#3A364D" d="M274.1,229.6c-0.2,0-0.4,0-0.6-0.1l-103.5-26.2c-5.3-1.3-9-5.9-9-11.2V33.3
c0-3.5,1.6-6.8,4.5-9c3.1-2.3,7-3.1,10.7-2.1l98.4,26.3c1.1,0.3,1.8,1.2,1.8,2.3v176.4c0,0.7-0.3,1.4-0.9,1.9
C275.2,229.4,274.7,229.6,274.1,229.6z M173.1,26.6c-1.6,0-3.2,0.5-4.5,1.5c-1.7,1.3-2.6,3.2-2.6,5.2v158.8c0,3,2.2,5.7,5.3,6.5
l100.5,25.5V52.7l-96.6-25.8C174.5,26.7,173.8,26.6,173.1,26.6z"/>
</g>
<g>
<path fill="#3A364D" d="M326.3,229.6c-0.5,0-1-0.2-1.5-0.5c-0.6-0.5-0.9-1.2-0.9-1.9V50.8c0-1.1,0.7-2,1.8-2.3
l98.4-26.3c3.8-1,7.7-0.2,10.7,2.1c2.9,2.2,4.5,5.5,4.5,9v158.8c0,5.2-3.7,9.8-9,11.2l-103.5,26.2
C326.7,229.6,326.5,229.6,326.3,229.6z M328.7,52.7v171.5l100.5-25.5c3.1-0.8,5.3-3.5,5.3-6.5V33.3c0-2-1-3.9-2.6-5.2
c-1.9-1.4-4.3-1.9-6.6-1.3L328.7,52.7z"/>
</g>
<g>
<path fill="#3A364D" d="M326.3,196.7c-1.1,0-2-0.7-2.3-1.8c-0.3-1.3,0.5-2.6,1.7-2.9l14.1-3.6
c1.3-0.3,2.6,0.5,2.9,1.7c0.3,1.3-0.5,2.6-1.7,2.9l-14.1,3.6C326.7,196.6,326.5,196.7,326.3,196.7z"/>
</g>
<g>
<path fill="#3A364D" d="M326.3,182c-1.1,0-2-0.7-2.3-1.8c-0.3-1.3,0.5-2.6,1.7-2.9l9.2-2.3
c1.3-0.3,2.6,0.5,2.9,1.7c0.3,1.3-0.5,2.6-1.7,2.9l-9.2,2.3C326.7,182,326.5,182,326.3,182z"/>
</g>
<g>
<path fill="#3A364D" d="M346.8,191.5c-1.1,0-2-0.7-2.3-1.8c-0.3-1.3,0.5-2.6,1.7-2.9l2.7-0.7
c1.3-0.3,2.6,0.5,2.9,1.7c0.3,1.3-0.5,2.6-1.7,2.9l-2.7,0.7C347.2,191.4,347,191.5,346.8,191.5z"/>
</g>
<g>
<path fill="#3A364D" d="M260.8,153.9c-0.2,0-0.4,0-0.6-0.1l-13.2-3.3c-1.3-0.3-2.1-1.6-1.7-2.9
c0.3-1.3,1.6-2.1,2.9-1.7l13.2,3.3c1.3,0.3,2.1,1.6,1.7,2.9C262.8,153.1,261.9,153.9,260.8,153.9z"/>
</g>
<g>
<path fill="#3A364D" d="M176.7,70c-0.2,0-0.4,0-0.6-0.1L163,66.6c-1.3-0.3-2.1-1.6-1.7-2.9
c0.3-1.3,1.6-2.1,2.9-1.7l13.2,3.3c1.3,0.3,2.1,1.6,1.7,2.9C178.8,69.3,177.8,70,176.7,70z"/>
</g>
<g>
<path fill="#3A364D" d="M274.1,157.2c-0.2,0-0.4,0-0.6-0.1l-5.1-1.3c-1.3-0.3-2.1-1.6-1.7-2.9
c0.3-1.3,1.6-2.1,2.9-1.7l5.1,1.3c1.3,0.3,2.1,1.6,1.7,2.9C276.2,156.5,275.2,157.2,274.1,157.2z"/>
</g>
<g>
<polygon fill="#FF9D4D" points="257.1,105.8 264.7,109.3 257.1,48.7 "/>
</g>
<g>
<path fill="#3A364D" d="M410.5,83.1c-1.3,0-2.4-1.1-2.4-2.4V50.5c0-1.3,1.1-2.4,2.4-2.4c1.3,0,2.4,1.1,2.4,2.4
v30.3C412.9,82,411.9,83.1,410.5,83.1z"/>
</g>
<g>
<path fill="#3A364D" d="M401.8,64.8c-1,0-2-0.7-2.3-1.7c-0.4-1.3,0.3-2.6,1.6-3l17.6-5.2c1.3-0.4,2.6,0.3,3,1.6
c0.4,1.3-0.3,2.6-1.6,3l-17.6,5.2C402.2,64.7,402,64.8,401.8,64.8z"/>
</g>
</g>
<g>
<path fill="#EBF1FA" d="M458.7,157.7c-0.4,1.2-0.6,2.5-0.5,3.8l0.5,5.5c0.3,3.9-0.7,7.7-2.9,11l-21.3,39.7v27.6
h-57.7v-30.9l29.9-7.6l23.1-5.8c4.1-1.1,7-4.9,7-9.1v-22.1h-31.1c-1.3,0-2.5-0.3-3.5-0.8c-0.8-0.4-1.5-0.9-2.2-1.5
c-1-1-1.8-2.3-2.1-3.7c-0.2-0.6-0.2-1.3-0.2-2c0-4.5,3.6-8.1,8.1-8.1H396c-1.3,0-2.6-0.3-3.7-0.9c-0.8-0.4-1.5-0.9-2.1-1.5
c-1-1-1.8-2.3-2.1-3.8c-0.2-0.6-0.2-1.3-0.2-1.9c0-4.5,3.6-8.1,8.1-8.1h-5.3c-1.3,0-2.5-0.3-3.6-0.9c-0.8-0.4-1.5-0.9-2.1-1.5
c-1-1-1.8-2.3-2.1-3.8c-0.2-0.7-0.2-1.3-0.2-2c0.1-4.5,3.8-8,8.3-8h5c-1.3,0-2.6-0.3-3.7-0.9c-0.8-0.4-1.5-0.9-2.1-1.5
c-1-1-1.8-2.3-2.1-3.8c-0.2-0.7-0.2-1.3-0.2-2c0-4.5,3.8-8,8.3-8h52.2c2.8,0,5.1,2.1,5.4,4.9l0.5,6.2c0.1,1.5,0.6,3,1.4,4.2
l2.1,3.3c1,1.5,1.5,3.3,1.5,5c0,1.4-0.3,2.8-0.9,4c-1.4,2.9-1.2,6.3,0.5,9l1,1.5c1.5,2.4,1.8,5.3,0.9,8L458.7,157.7z"/>
</g>
<g>
<path fill="#A6CFE6" d="M420.5,120.4L420.5,120.4l-28.2,0c-0.8-0.4-1.5-0.9-2.1-1.5c-1-1-1.8-2.3-2.1-3.8h27.1
C418.2,115.1,420.5,117.5,420.5,120.4z"/>
</g>
<g>
<path fill="#A6CFE6" d="M422.3,136.5L422.3,136.5l-35.1,0c-0.8-0.4-1.5-0.9-2.1-1.5c-1-1-1.8-2.3-2.1-3.8h34
C419.9,131.3,422.3,133.6,422.3,136.5z"/>
</g>
<g>
<path fill="#A6CFE6" d="M426.4,152.7L426.4,152.7l-34.1,0c-0.8-0.4-1.5-0.9-2.1-1.5c-1-1-1.8-2.3-2.1-3.8h33
C424.1,147.4,426.4,149.8,426.4,152.7z"/>
</g>
<g>
<path fill="#A6CFE6" d="M442,163.6v5.3h-39.8c-0.8-0.4-1.5-0.9-2.2-1.5c-1-1-1.8-2.3-2.1-3.7H442z"/>
</g>
<g>
<path fill="#A6CFE6" d="M458.7,157.7c-0.4,1.2-0.6,2.5-0.5,3.8l0.5,5.6c0.3,3.9-0.7,7.7-2.9,11l-21.3,39.7v27.6
h-27.8v-38.5l23.1-5.8c4.1-1.1,7-4.9,7-9.1v-22.1l0,0l2.1-4.1c1.3-2.5,1.3-5.5,0-8l-2.2-4.3l2.2-4.6c1.3-2.7,1.1-5.8-0.5-8.3
l-1.7-2.8l2.3-4.6c1.2-2.5,1.2-5.4-0.1-7.9l-2.2-4.2l2.5-4.9c1.1-2.1,1.3-4.6,0.5-6.8l-1.4-4.1h10c2.8,0,5.1,2.1,5.4,4.9l0.5,6.2
c0.1,1.5,0.6,3,1.4,4.2l2.1,3.3c1,1.5,1.5,3.3,1.5,5c0,1.4-0.3,2.8-0.9,4c-1.4,2.9-1.2,6.3,0.5,9l1,1.5c1.5,2.4,1.8,5.3,0.9,8
L458.7,157.7z"/>
</g>
<g>
<polygon fill="#A6CFE6" points="406.8,206.8 376.9,214.4 376.9,229.8 406.8,222.2 "/>
</g>
<g>
<rect x="370.6" y="263.5" fill="#605B73" width="72.5" height="91.1"/>
</g>
<g style={ st9Style }>
<g>
<rect x="423.4" y="263.5" fill="#3A364D" width="19.8" height="91.1"/>
</g>
</g>
<g>
<polygon fill="#3A364D" points="370.6,283 443.2,283 443.2,273.8 "/>
</g>
<g>
<path fill="#3A364D" d="M436.9,247.7h-62.5v-35.2l31.7-8.1l23.1-5.8c3-0.8,5.2-3.6,5.2-6.8v-19.7h-28.7
c-2.8,0-5.4-1.1-7.4-3.1c-2-2-3.1-4.6-3.1-7.4c0-2.1,0.6-4,1.7-5.7H396c-2.8,0-5.4-1.1-7.4-3.1c-2-2-3.1-4.6-3.1-7.4
c0-2.3,0.7-4.4,2-6.2c-1.6-0.5-3-1.4-4.2-2.6c-2-2-3.1-4.7-3.1-7.5c0.1-4.6,3.1-8.4,7.3-9.8c-1.4-1.8-2.1-4-2-6.3
c0.1-5.7,4.9-10.4,10.7-10.4h52.2c4.1,0,7.4,3.1,7.8,7.1l0.5,6.2c0.1,1.1,0.5,2.2,1.1,3.2l2.1,3.3c1.2,1.9,1.8,4.1,1.8,6.3
c0,1.8-0.4,3.5-1.1,5.1c-1,2.2-0.9,4.7,0.4,6.7l1,1.5c1.9,3,2.3,6.7,1.2,10l-2.2,6.4c-0.3,0.9-0.4,1.9-0.3,2.8l0.5,5.5
c0.4,4.4-0.8,8.8-3.2,12.4l-20.9,39.1V247.7z M379.3,242.9h52.9v-25.8l21.7-40.5c1.9-2.7,2.8-6.1,2.5-9.4l-0.5-5.5
c-0.1-1.6,0.1-3.2,0.6-4.8l2.2-6.4c0.7-2,0.4-4.2-0.7-5.9l-1-1.5c-2.2-3.4-2.4-7.7-0.7-11.3c0.5-1,0.7-2,0.7-3
c0-1.3-0.4-2.6-1.1-3.7l-2.1-3.3c-1-1.6-1.6-3.4-1.8-5.3l-0.5-6.2c-0.1-1.6-1.4-2.7-3-2.7h-52.2c-3.2,0-5.8,2.5-5.9,5.6
c0,1.5,0.6,3,1.7,4.1c1.1,1.1,2.5,1.7,4,1.7v4.8h-5c-3.2,0-5.9,2.5-5.9,5.6c0,1.5,0.6,3,1.7,4.1c1.1,1.1,2.5,1.7,4,1.7h5.2v4.8
c-3.1,0-5.7,2.5-5.7,5.7c0,1.5,0.6,2.9,1.7,4c1.1,1.1,2.5,1.7,4,1.7h9.7v4.8c-3.1,0-5.7,2.5-5.7,5.7c0,1.5,0.6,2.9,1.7,4
c1.1,1.1,2.5,1.7,4,1.7h33.5v24.5c0,5.4-3.6,10.1-8.8,11.5l-23.2,5.8l-28.1,7.1V242.9z M458.7,157.7L458.7,157.7L458.7,157.7z"/>
</g>
<g>
<path fill="#3A364D" d="M445.6,356.9h-77.3v-95.9h77.3V356.9z M373,352.1h67.7v-86.3H373V352.1z"/>
</g>
<g>
<path fill="#605B73" d="M446.9,272.8l-79.6,8c-1.5,0.1-2.8-1-2.8-2.5v-31.8c0-1.2,0.9-2.2,2-2.5l79.6-15.1
c1.5-0.3,3,0.9,3,2.5v39C449.2,271.6,448.2,272.7,446.9,272.8z"/>
</g>
<g style={ st9Style }>
<g>
<path fill="#3A364D" d="M446.9,272.8l-33.5,3.4v-41.1l32.7-6.2c1.5-0.3,3,0.9,3,2.5v39
C449.2,271.6,448.2,272.7,446.9,272.8z"/>
</g>
</g>
<g>
<path fill="#3A364D" d="M367.1,283.2c-1.2,0-2.4-0.4-3.3-1.3c-1-0.9-1.6-2.3-1.6-3.6v-31.8c0-2.4,1.7-4.4,4-4.8
l79.6-15.1c1.4-0.3,2.9,0.1,4,1c1.1,0.9,1.8,2.3,1.8,3.8v39c0,2.5-1.9,4.6-4.4,4.9l-79.6,8C367.5,283.2,367.3,283.2,367.1,283.2z
M446.7,231.2C446.7,231.2,446.7,231.2,446.7,231.2l-79.6,15.1c-0.1,0-0.1,0.1-0.1,0.1v31.8c0,0,0,0,0,0.1c0,0,0.1,0,0.1,0
l79.6-8c0.1,0,0.1-0.1,0.1-0.1v-39C446.8,231.3,446.8,231.3,446.7,231.2C446.7,231.2,446.7,231.2,446.7,231.2z"/>
</g>
<g>
<path fill="#3A364D" d="M418.1,123.6H396c-1.3,0-2.4-1.1-2.4-2.4s1.1-2.4,2.4-2.4h22.2c1.3,0,2.4,1.1,2.4,2.4
S419.5,123.6,418.1,123.6z"/>
</g>
<g>
<path fill="#3A364D" d="M419.9,139.8H396c-1.3,0-2.4-1.1-2.4-2.4s1.1-2.4,2.4-2.4h23.9c1.3,0,2.4,1.1,2.4,2.4
S421.2,139.8,419.9,139.8z"/>
</g>
<g>
<path fill="#3A364D" d="M424,155.9h-18.3c-1.3,0-2.4-1.1-2.4-2.4c0-1.3,1.1-2.4,2.4-2.4H424c1.3,0,2.4,1.1,2.4,2.4
C426.4,154.9,425.3,155.9,424,155.9z"/>
</g>
<g>
<circle fill="#FFFFFF" cx="376.9" cy="259.9" r="4.3"/>
</g>
<g>
<path fill="#EBF1FA" d="M141.1,157.7c0.4,1.2,0.6,2.5,0.5,3.8l-0.5,5.5c-0.3,3.9,0.7,7.7,2.9,11l21.3,39.7v27.6
h57.7v-30.9l-29.9-7.6l-23.1-5.8c-4.1-1.1-7-4.9-7-9.1v-22.1H194c1.3,0,2.5-0.3,3.5-0.8c0.8-0.4,1.5-0.9,2.2-1.5
c1-1,1.8-2.3,2.1-3.7c0.2-0.6,0.2-1.3,0.2-2c0-4.5-3.6-8.1-8.1-8.1h9.7c1.3,0,2.6-0.3,3.7-0.9c0.8-0.4,1.5-0.9,2.1-1.5
c1-1,1.8-2.3,2.1-3.8c0.2-0.6,0.2-1.3,0.2-1.9c0-4.5-3.6-8.1-8.1-8.1h5.3c1.3,0,2.5-0.3,3.6-0.9c0.8-0.4,1.5-0.9,2.1-1.5
c1-1,1.8-2.3,2.1-3.8c0.2-0.7,0.2-1.3,0.2-2c-0.1-4.5-3.8-8-8.3-8h-5c1.3,0,2.6-0.3,3.7-0.9c0.8-0.4,1.5-0.9,2.1-1.5
c1-1,1.8-2.3,2.1-3.8c0.2-0.7,0.2-1.3,0.2-2c0-4.5-3.8-8-8.3-8h-52.2c-2.8,0-5.1,2.1-5.4,4.9l-0.5,6.2c-0.1,1.5-0.6,3-1.4,4.2
l-2.1,3.3c-1,1.5-1.5,3.3-1.5,5c0,1.4,0.3,2.8,0.9,4c1.4,2.9,1.2,6.3-0.5,9l-1,1.5c-1.5,2.4-1.8,5.3-0.9,8L141.1,157.7z"/>
</g>
<g>
<path fill="#A6CFE6" d="M179.2,120.4L179.2,120.4l28.2,0c0.8-0.4,1.5-0.9,2.1-1.5c1-1,1.8-2.3,2.1-3.8h-27.1
C181.5,115.1,179.2,117.5,179.2,120.4z"/>
</g>
<g>
<path fill="#A6CFE6" d="M177.5,136.5L177.5,136.5l35.1,0c0.8-0.4,1.5-0.9,2.1-1.5c1-1,1.8-2.3,2.1-3.8h-34
C179.8,131.3,177.5,133.6,177.5,136.5z"/>
</g>
<g>
<path fill="#A6CFE6" d="M173.3,152.7L173.3,152.7l34.1,0c0.8-0.4,1.5-0.9,2.1-1.5c1-1,1.8-2.3,2.1-3.8h-33
C175.7,147.4,173.3,149.8,173.3,152.7z"/>
</g>
<g>
<path fill="#A6CFE6" d="M157.7,163.6v5.3h39.8c0.8-0.4,1.5-0.9,2.2-1.5c1-1,1.8-2.3,2.1-3.7H157.7z"/>
</g>
<g>
<path fill="#A6CFE6" d="M141.1,157.7c0.4,1.2,0.6,2.5,0.5,3.8l-0.5,5.6c-0.3,3.9,0.7,7.7,2.9,11l21.3,39.7v27.6H193
v-38.5l-23.1-5.8c-4.1-1.1-7-4.9-7-9.1v-22.1l0,0l-2.1-4.1c-1.3-2.5-1.3-5.5,0-8l2.2-4.3l-2.2-4.6c-1.3-2.7-1.1-5.8,0.5-8.3
l1.7-2.8l-2.3-4.6c-1.2-2.5-1.2-5.4,0.1-7.9l2.2-4.2l-2.5-4.9c-1.1-2.1-1.3-4.6-0.5-6.8l1.4-4.1h-10c-2.8,0-5.1,2.1-5.4,4.9
l-0.5,6.2c-0.1,1.5-0.6,3-1.4,4.2l-2.1,3.3c-1,1.5-1.5,3.3-1.5,5c0,1.4,0.3,2.8,0.9,4c1.4,2.9,1.2,6.3-0.5,9l-1,1.5
c-1.5,2.4-1.8,5.3-0.9,8L141.1,157.7z"/>
</g>
<g>
<polygon fill="#A6CFE6" points="193,206.8 222.9,214.4 222.9,229.8 193,222.2 "/>
</g>
<g>
<rect x="156.6" y="263.5" fill="#605B73" width="72.5" height="91.1"/>
</g>
<g style={ st9Style }>
<g>
<rect x="156.6" y="263.5" fill="#3A364D" width="19.8" height="91.1"/>
</g>
</g>
<g>
<polygon fill="#3A364D" points="229.1,283 156.6,283 156.6,273.8 "/>
</g>
<g>
<path fill="#3A364D" d="M225.3,247.7h-62.5v-29.4l-20.9-39.1c-2.4-3.6-3.6-8-3.2-12.4l0.5-5.6c0.1-1,0-1.9-0.3-2.8
v0l-2.2-6.4c-1.1-3.4-0.7-7,1.2-10l1-1.5c1.3-2,1.4-4.5,0.4-6.7c-0.8-1.6-1.1-3.3-1.1-5.1c0-2.2,0.6-4.4,1.8-6.3l2.1-3.3
c0.6-0.9,1-2,1.1-3.1l0.5-6.2c0.3-4.1,3.7-7.1,7.8-7.1h52.2c5.8,0,10.6,4.6,10.7,10.4c0,2.3-0.7,4.5-2,6.3
c4.2,1.4,7.2,5.3,7.3,9.8c0,2.8-1.1,5.5-3.1,7.5c-1.2,1.2-2.6,2.1-4.2,2.6c1.3,1.7,2,3.9,2,6.2c0,2.8-1.1,5.4-3.1,7.4
c-2,2-4.6,3.1-7.4,3.1h-0.9c1.1,1.6,1.7,3.6,1.7,5.7c0,2.8-1.1,5.4-3.1,7.4c-2,2-4.6,3.1-7.4,3.1h-28.7v19.7c0,3.2,2.1,6,5.2,6.8
l23.1,5.8l31.7,8.1V247.7z M167.6,242.9h52.9v-26.7l-28.1-7.1l-23.1-5.8c-5.2-1.4-8.8-6.1-8.8-11.5v-24.5H194
c1.5,0,2.9-0.6,4-1.7c1.1-1.1,1.7-2.5,1.7-4c0-3.1-2.5-5.7-5.7-5.7v-4.8h9.7c1.5,0,2.9-0.6,4-1.7c1.1-1.1,1.7-2.5,1.7-4
c0-3.1-2.5-5.7-5.7-5.7V135h5.2c1.5,0,2.9-0.6,4-1.7c1.1-1.1,1.7-2.5,1.7-4.1c0-3.1-2.7-5.6-5.9-5.6h-5v-4.8c1.5,0,2.9-0.6,4-1.7
c1.1-1.1,1.7-2.5,1.7-4.1c0-3.1-2.7-5.6-5.9-5.6h-52.2c-1.6,0-2.8,1.2-3,2.7l-0.5,6.2c-0.2,1.9-0.8,3.7-1.8,5.3l-2.1,3.3
c-0.7,1.1-1.1,2.4-1.1,3.7c0,1,0.2,2.1,0.7,3c1.7,3.7,1.5,7.9-0.7,11.3l-1,1.5c-1.1,1.8-1.4,3.9-0.7,5.9l2.2,6.4
c0.5,1.5,0.7,3.1,0.6,4.8l-0.5,5.6c-0.3,3.3,0.6,6.7,2.5,9.4l0.1,0.2l21.6,40.2V242.9z"/>
</g>
<g>
<path fill="#3A364D" d="M231.5,356.9h-77.3v-95.9h77.3V356.9z M159,352.1h67.7v-86.3H159V352.1z"/>
</g>
<g>
<path fill="#605B73" d="M152.8,272.8l79.6,8c1.5,0.1,2.8-1,2.8-2.5v-31.8c0-1.2-0.9-2.2-2-2.5l-79.6-15.1
c-1.5-0.3-3,0.9-3,2.5v39C150.5,271.6,151.5,272.7,152.8,272.8z"/>
</g>
<g style={ st9Style }>
<g>
<path fill="#3A364D" d="M152.8,272.8l33.5,3.4v-41.1l-32.7-6.2c-1.5-0.3-3,0.9-3,2.5v39
C150.5,271.6,151.5,272.7,152.8,272.8z"/>
</g>
</g>
<g>
<path fill="#3A364D" d="M232.6,283.2c-0.2,0-0.3,0-0.5,0l-79.6-8h0c-2.5-0.3-4.4-2.4-4.4-4.9v-39
c0-1.5,0.6-2.8,1.8-3.8c1.1-0.9,2.6-1.3,4-1l79.6,15.1c2.3,0.4,4,2.5,4,4.8v31.8c0,1.4-0.6,2.7-1.6,3.6
C235,282.8,233.8,283.2,232.6,283.2z M153,231.2C153,231.2,153,231.2,153,231.2c-0.1,0.1-0.1,0.1-0.1,0.1v39c0,0.1,0,0.1,0.1,0.1
h0l79.6,8c0,0,0,0,0.1,0c0,0,0-0.1,0-0.1v-31.8c0-0.1,0-0.1-0.1-0.1L153,231.2C153.1,231.2,153,231.2,153,231.2z"/>
</g>
<g>
<path fill="#3A364D" d="M203.8,123.6h-22.2c-1.3,0-2.4-1.1-2.4-2.4s1.1-2.4,2.4-2.4h22.2c1.3,0,2.4,1.1,2.4,2.4
S205.1,123.6,203.8,123.6z"/>
</g>
<g>
<path fill="#3A364D" d="M203.8,139.8h-23.9c-1.3,0-2.4-1.1-2.4-2.4s1.1-2.4,2.4-2.4h23.9c1.3,0,2.4,1.1,2.4,2.4
S205.1,139.8,203.8,139.8z"/>
</g>
<g>
<path fill="#3A364D" d="M194.1,155.9h-18.3c-1.3,0-2.4-1.1-2.4-2.4c0-1.3,1.1-2.4,2.4-2.4h18.3
c1.3,0,2.4,1.1,2.4,2.4C196.5,154.9,195.4,155.9,194.1,155.9z"/>
</g>
<g>
<circle fill="#FFFFFF" cx="222.9" cy="259.9" r="4.3"/>
</g>
<g>
<path fill="#3A364D" d="M188.6,291c-1.3,0-2.4-1.1-2.4-2.4v-11.7c0-1.3,1.1-2.4,2.4-2.4c1.3,0,2.4,1.1,2.4,2.4v11.7
C191,289.9,189.9,291,188.6,291z"/>
</g>
<g>
<path fill="#3A364D" d="M188.6,302c-1.3,0-2.4-1.1-2.4-2.4v-2.7c0-1.3,1.1-2.4,2.4-2.4c1.3,0,2.4,1.1,2.4,2.4v2.7
C191,300.9,189.9,302,188.6,302z"/>
</g>
</g>
<g>
<path fill="#3A364D" d="M406.1,254.8c-1.3,0-2.4-1.1-2.4-2.4V245c0-1.3,1.1-2.4,2.4-2.4s2.4,1.1,2.4,2.4v7.4
C408.5,253.7,407.5,254.8,406.1,254.8z"/>
</g>
<g>
<path fill="#3A364D" d="M379.2,316.4c-1.3,0-2.4-1.1-2.4-2.4v-9.3c0-1.3,1.1-2.4,2.4-2.4c1.3,0,2.4,1.1,2.4,2.4v9.3
C381.6,315.3,380.6,316.4,379.2,316.4z"/>
</g>
<g>
<path fill="#FF5959" d="M74.6,422V303.6c0,3.2,1.3,6.2,3.4,8.3c2.1,2.1,5.1,3.4,8.3,3.4h427.9c3.2,0,6.2-1.3,8.3-3.4
c2.1-2.1,3.4-5.1,3.4-8.3V422c0,6.5-5.3,11.7-11.7,11.7H86.3C79.8,433.8,74.6,428.5,74.6,422z"/>
<path fill="#3A364D" d="M514.2,436.2H86.3c-7.8,0-14.1-6.3-14.1-14.1V303.6H77c0,2.5,1,4.8,2.7,6.6
c1.8,1.8,4.1,2.7,6.6,2.7h427.9c2.5,0,4.8-1,6.6-2.7c1.8-1.8,2.7-4.1,2.7-6.6h4.8V422C528.4,429.8,522,436.2,514.2,436.2z
M77,314.2V422c0,5.2,4.2,9.3,9.3,9.3h427.9c5.2,0,9.3-4.2,9.3-9.3V314.2c-2.6,2.3-5.9,3.5-9.3,3.5H86.3
C82.8,317.7,79.5,316.5,77,314.2z"/>
</g>
<g>
<path fill="#FFFFFF" d="M114.4,333.4h-7.6c-1.3,0-2.4-1.1-2.4-2.4c0-1.3,1.1-2.4,2.4-2.4h7.6c1.3,0,2.4,1.1,2.4,2.4
C116.8,332.3,115.7,333.4,114.4,333.4z"/>
</g>
<g>
<path fill="#FFFFFF" d="M151.1,333.4h-26.3c-1.3,0-2.4-1.1-2.4-2.4c0-1.3,1.1-2.4,2.4-2.4h26.3
c1.3,0,2.4,1.1,2.4,2.4C153.5,332.3,152.4,333.4,151.1,333.4z"/>
</g>
<g>
<path fill="#FFFFFF" d="M158.2,367.6c0,5-2.4,7.7-4.6,9.1c2.8,1.3,6.1,4.6,6.1,10.3c0,8.6-7.2,11.9-14,11.9h-16.9
v-42H146C153.3,356.8,158.2,360.8,158.2,367.6z M139.1,365.4v8.1h5c2.3,0,3.9-1.5,3.9-4c0-2.8-1.6-4.1-4.1-4.1H139.1z
M139.1,381.5v8.6h5.2c2.5,0,4.8-1,4.8-4.3c0-3.3-2.3-4.3-4.6-4.3H139.1z"/>
<path fill="#FFFFFF" d="M181.3,398.8h-10.4v-42h10.4V398.8z"/>
<path fill="#FFFFFF" d="M223.8,367.6c0,5-2.4,7.7-4.6,9.1c2.8,1.3,6.1,4.6,6.1,10.3c0,8.6-7.2,11.9-14,11.9h-16.9
v-42h17.2C218.9,356.8,223.8,360.8,223.8,367.6z M204.8,365.4v8.1h5c2.3,0,3.9-1.5,3.9-4c0-2.8-1.6-4.1-4.1-4.1H204.8z
M204.8,381.5v8.6h5.2c2.5,0,4.8-1,4.8-4.3c0-3.3-2.3-4.3-4.6-4.3H204.8z"/>
<path fill="#FFFFFF" d="M247,389h14.3v9.8h-24.7v-42H247V389z"/>
<path fill="#FFFFFF" d="M272.2,356.8H297v9.2h-14.4v7.1h13v9h-13v7.3h14.8v9.4h-25.1V356.8z"/>
<path fill="#FFFFFF" d="M341.5,382.1h-16.7v-8.5h16.7V382.1z"/>
<path fill="#FFFFFF" d="M349.6,398.1v-10c2.9,1,5.3,1.4,8.7,1.3c3.5,0,6.1-1.1,6.1-3.7c0-2.2-1.4-3.2-4-3.2h-5.6v-9.2
h4.7c2.1,0,3.8-1.1,3.8-3.1c0-1.9-1.4-3.2-4.7-3.2c-2.9,0-5.8,0.5-8.9,1.8v-9.6c3.1-1.3,6.4-2,10.4-2c7.4,0,13.5,3.8,13.5,11.3
c0,4-1.9,7.2-4.9,8.8c3.4,1.3,6.4,4.6,6.4,10.3c0,8.8-7.9,12.2-15.1,12.2C355.9,399.7,352.9,399.2,349.6,398.1z"/>
<path fill="#FFFFFF" d="M415.2,385.6c0,9.1-5.9,14.1-13.5,14.1c-11.5,0-16-8.7-16-20c0-16.1,8.3-22.5,17.7-22.5
c3.6,0,5.6,0.4,9.1,2v9.4c-2.4-1.1-4.8-1.6-7.1-1.6c-4.7,0-7.4,2.3-8.5,7.2c1.8-1,4-1.6,6.5-1.6
C409.9,372.5,415.2,376.8,415.2,385.6z M405.3,385.4c0-3.1-1.4-4.6-4-4.6c-1.7,0-3.3,0.5-4.9,1.6c0.4,5.3,1.9,7.6,4.9,7.6
C404.1,390.1,405.3,388,405.3,385.4z"/>
<path fill="#FFFFFF" d="M425.7,398.3v-9.8c2.7,0.9,5.9,1.4,9.1,1.4c3.9,0,6.1-1.4,6.1-4.3c0-2.9-2.9-4.1-6.8-4.1
c-2.5,0-5.2,0.3-7.4,0.8l1.3-24.2h21.9v9.6h-12.2l-0.3,5.5c1.4,0,3,0.1,4.6,0.5c5.5,1,9.7,4.6,9.7,12c0,10-8,14-15.4,14
C431.8,399.7,429,399.3,425.7,398.3z"/>
<path fill="#FFFFFF" d="M475.9,382.1h-16.7v-8.5h16.7V382.1z"/>
</g>
</g>
);
}
}
export default Bible365;
| Ftornik/forwardteam.space | src/components/Assets/Pins/Bible365.js | JavaScript | mit | 30,685 |
const _ = require('lodash');
const parser = require('@babel/parser');
const minimatch = require('minimatch');
const vio = require('./vio');
const logger = require('./logger');
const config = require('./config');
let cache = {};
const failedToParse = {};
function getAst(filePath, throwIfError) {
const astFolders = config.getRekitConfig().astFolders || [];
const excludeAstFolders = config.getRekitConfig().excludeAstFolders || [];
if (
(astFolders.length &&
!astFolders.some(d => _.startsWith(filePath, d + '/') || minimatch(filePath, d))) ||
excludeAstFolders.some(d => _.startsWith(filePath, d + '/') || minimatch(filePath, d))
) {
return;
}
const checkAst = ast => {
if (!ast && throwIfError) {
throw new Error(`Failed to parse ast or file not exists, please check syntax: ${filePath}`);
}
};
if (!vio.fileExists(filePath)) {
checkAst(null);
return null;
}
const code = vio.getContent(filePath);
if (!cache[filePath] || cache[filePath].code !== code) {
try {
const ast = parser.parse(code, {
// parse in strict mode and allow module declarations
sourceType: 'module',
plugins: [
'jsx',
'flow',
'doExpressions',
'objectRestSpread',
'decorators-legacy',
'classProperties',
'exportExtensions',
'asyncGenerators',
'functionBind',
'functionSent',
'dynamicImport',
'optionalChaining'
],
});
checkAst(ast);
if (!ast) {
failedToParse[filePath] = true;
logger.warn(`Failed to parse ast, please check syntax: ${filePath}`);
return null;
}
delete failedToParse[filePath];
cache[filePath] = { ast, code };
ast._filePath = filePath;
} catch (e) {
console.log('parse ast failed: ', e);
checkAst(null);
failedToParse[filePath] = true;
logger.warn(`Failed to parse ast, please check syntax: ${filePath}`);
return null;
}
}
return cache[filePath].ast;
}
function getFilesFailedToParse() {
return failedToParse;
}
function clearCache(filePath) {
if (filePath) delete cache[filePath];
else cache = {};
}
module.exports = {
getAst,
clearCache,
getFilesFailedToParse,
};
| supnate/rekit-core | core/ast.js | JavaScript | mit | 2,309 |
'use strict'
class Scene {
constructor(canvas, options) {
if (typeof canvas == 'string') {
canvas = document.getElementById(canvas)
}
this.canvas = canvas
this.ctx = canvas.getContext('2d')
this.layers = {}
if (options && options.stretch) {
this.canvas.width = window.innerWidth
this.canvas.height = window.innerHeight
}
}
layer(name, fn) {
this.layers[name] = fn.bind(this)
return this
}
color(color) {
this.ctx.fillStyle = color
return this
}
border(color, width) {
this.ctx.strokeStyle = color
this.ctx.lineWidth = width
return this
}
region(x, y, width, height) {
this.ctx.fillRect(x, y, width, height)
return this
}
dot(x, y) {
this.ctx.fillRect(x, y, 1, 1)
return this
}
circle(x, y, r) {
this.ctx.beginPath()
this.ctx.arc(x, y, r, 0, 2 * Math.PI)
this.ctx.fill()
this.ctx.stroke()
return this
}
shape(points) {
this.ctx.beginPath()
this.ctx.moveTo(points[0][0], points[0][1])
for (var i = 1; i < points.length; i++) {
this.ctx.lineTo(points[i][0], points[i][1])
}
this.ctx.fill()
this.ctx.stroke()
return this
}
animation(fn, interval) {
var state = {}
var bound = fn.bind(this, state)
window.setInterval(bound, interval)
}
}
| efcsystems/codingchallenges | 07/mdedmon/Scene.js | JavaScript | mit | 1,244 |
/**
* Module dependencies.
*/
var express = require('express');
var async = require('async');
var partials = require('express-partials');
var flash = require('connect-flash');
var moment = require('moment');
var Check = require('../../models/check');
var Tag = require('../../models/tag');
var TagDailyStat = require('../../models/tagDailyStat');
var TagMonthlyStat = require('../../models/tagMonthlyStat');
var CheckMonthlyStat = require('../../models/checkMonthlyStat');
var moduleInfo = require('../../package.json');
var Account = require('../../models/user/accountManager');
var app = module.exports = express();
// middleware
app.configure(function(){
app.use(partials());
app.use(flash());
app.use(function locals(req, res, next) {
res.locals.route = app.route;
res.locals.addedCss = [];
res.locals.renderCssTags = function (all) {
if (all != undefined) {
return all.map(function(css) {
return '<link rel="stylesheet" href="' + app.route + '/css/' + css + '">';
}).join('\n ');
} else {
return '';
}
};
res.locals.moment = moment;
next();
});
app.use(function (req, res, next) {
if(app.locals.cluster) {
res.setHeader('x-cluster-node', 'node'+app.locals.cluster.worker.id+'.'+serverUrl.hostname);
}
next();
});
app.use(express.cookieParser('Z5V45V6B5U56B7J5N67J5VTH345GC4G5V4'));
/*app.use(express.cookieSession({
key: 'uptime',
secret: 'FZ5HEE5YHD3E566756234C45BY4DSFZ4',
proxy: true,
cookie: { maxAge: 60 * 60 * 1000 }
}));*/
app.use(app.router);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(express.static(__dirname + '/public'));
});
app.configure('development', function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure('production', function(){
app.use(express.errorHandler());
});
app.locals({
version: moduleInfo.version
});
// Routes
app.get('/', function(req, res) {
res.render('index');
});
| brantje/webspy | app/root/app.js | JavaScript | mit | 2,047 |
/**
* Created by out_xu on 16/12/21.
*/
export default {
mobile: /^(1+\d{10})$/,
password: /^\w{6,18}$/,
mail: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
phone: /^(1+\d{10})$/,
stuCode: /^\d{2,}$/,
qq: /[1-9][0-9]{4,}/,
number: /^[0-9]\d*$/,
age: /^(?:[1-9][0-9]?|1[01][0-9]|120)$/,
chinese: /[\u4E00-\u9FA5\uF900-\uFA2D]/,
IDCard: /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/
}
| ouxu/NEUQ-OJ | app/src/utils/verify.js | JavaScript | mit | 491 |
/* 作者: dailc
* 时间: 2017-07-16
* 描述: Integer-to-English-Words
*
* 来自: https://leetcode.com/problems/integer-to-english-words
*/
(function(exports) {
/**
* @param {number} num
* @return {string}
*/
var numberToWords = function(num) {
if (!num || num < 0) {
return 'Zero';
}
// 先把最低的 3位转换出来
var res = convertHundred(num % 1000);
var unit = ["Thousand", "Million", "Billion"];
for (var i = 0, len = unit.length; i < len; i ++) {
num = ~~(num / 1000);
res = num % 1000 ? (convertHundred(num % 1000) + ' ' + unit[i] + ' ' + res) : res;
}
// 替换空格
res = res.replace(/\s+$/, '');
return res;
};
function convertHundred(num) {
var unit1 = ["", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine",
"Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen",
"Eighteen", "Nineteen"];
var unit2 = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"];
var res = '',
divisor = ~~(num / 100),
remainderT = num % 100,
remainderH = num % 10;
res = remainderT < 20 ? unit1[remainderT] : (unit2[~~(remainderT / 10)] + (remainderH ? " " + unit1[remainderH] : ''));
if (divisor > 0) {
res = unit1[divisor] + ' Hundred' + (res ? ' ' + res : '');
}
return res;
}
exports.numberToWords = numberToWords;
})(window.LeetCode = window.LeetCode || {}); | dailc/leetcode | algorithms/273-Integer-to-English-Words/Integer-to-English-Words.js | JavaScript | mit | 1,724 |
/* #######################################################################################
* Javascript code-behind page for the Timeline view
* ######################################################################################*/
/* ======================================================================================
* Dataset and Chart Configurations
* ======================================================================================*/
/* Declaration & Initialization */
var timeUnitSize = {
// These are intended for bar width only
"day": 24 * 60 * 60 * 800,
"week": 7 * 24 * 60 * 60 * 800,
"month": 30 * 24 * 60 * 60 * 800,
"quarter": 90 * 24 * 60 * 60 * 800,
"year": 365.2425 * 24 * 60 * 60 * 800
};
var standardDay = 24 * 60 * 60 * 1000;
var MainList = new Array(),
RunningTotalList = new Array(),
CreditList = new Array(),
DebitList = new Array(),
NetAmount = new Array(),
dailyBarWidth = timeUnitSize.day,
choiceContainer, format;
/* Datasets */
var dsRunningTotal = [
{
label: "Running Total",
data: RunningTotalList,
color: "blue",
points: { symbol: "triangle", fillColor: "blue", show: true },
lines: { show: true }
}
];
var dsCredits = {
label: "Credits",
data: CreditList,
color: "green",
bars: {
show: true,
align: "center",
barWidth: dailyBarWidth,
lineWidth: 1
}
};
var dsDebits = {
label: "Debits",
data: DebitList,
color: "red",
bars: {
show: true,
align: "center",
barWidth: dailyBarWidth,
lineWidth: 1
}
};
var dsNet = {
label: "Net Daily",
data: NetAmount,
color: "black",
points: {
symbol: "circle",
radius: 1,
show: true
},
lines: {
show: true,
lineWidth: .5
}
};
/* Overall container for "dsCredits", "dsDebits" & "dsNet" */
var dsCDND = [
[], [], []
];
/* Chart Options */
var options = {
xaxis: {
mode: "time",
tickLength: 0,
rotateTicks: 75,
labelWidth: 50,
axisLabelAlign: "center",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 10,
axisLabelFontFamily: "Verdana, Arial",
axisLabelPadding: 10,
color: "black"
},
yaxes: [
{
tickFormatter: function(yvalue) {
return FormatNumber(yvalue, 0, "", ",", ".");
},
position: "left",
color: "black",
labelWidth: 50,
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: "Verdana, Arial",
axisLabelPadding: 3
}
],
legend: {
noColumns: 1,
labelBoxBorderColor: "#000000",
position: "nw"
},
grid: {
hoverable: true,
clickable: true,
borderWidth: 3,
backgroundColor: { colors: ["#ffffff", "#EDF5FF"] },
margin: {
top: 0,
left: 0,
bottom: 10,
right: 0
}
}
};
/* ======================================================================================
* Initialize page
* ======================================================================================*/
function InitializeTimelineChart(model)
{
choiceContainer = $("#choicesCDND");
choiceContainer.find("input").click(PlotCDND);
if (model != undefined)
GetData(model);
}
/* ======================================================================================
* Utility Functions
* ======================================================================================*/
/* ---------------------------------------------------------------------------------------
* This function gets the base data from the "spCreateLedgerReadout" database procedure by
* calling the associated controller function "GetLedgerReadout", which in turn calls its
* respective repository function.
* Then take the data and construct the "PrimaryList" which is distinct list of the
* overall and summary fields which are repeated for a given date such as
* Date, Credit Summary, Debit Summary, Net Daily and RunningTotal.
* Next construct the "DetailList" of Credit and Detail items which consist of the
* fields Date, ItemType (1 "Credit" or 2 "Debit"), Period (period type), Name (Item Name)
* and Item Amount.
* -------------------------------------------------------------------------------------*/
function GetData(model) {
var viewModel = {
timeFrameBegin: $("#TimeFrameBegin").val(),
timeFrameEnd: $("#TimeFrameEnd").val()
};
MainList = model.Result;
/* Diagnostic */
//viewModel.TimeFrameBegin = "1/1/2016";
//viewModel.TimeFrameEnd = "3/1/2016";
/* In days */
var dailyCutoff = 60;
var weeklyCutoff = 360;
var monthlyCutoff = 1090;
var quarterlyCutoff = 2850;
AutoAdjustBarWidth(
viewModel.timeFrameBegin,
viewModel.timeFrameEnd,
dailyCutoff,
weeklyCutoff,
monthlyCutoff,
quarterlyCutoff,
dsCredits,
dsDebits
);
RunningTotalList.length = 0;
CreditList.length = 0;
DebitList.length = 0;
NetAmount.length = 0;
$.each(MainList, function(index, value) {
/* Running Total */
var rt = [];
rt.push(GetTime(value.WDate), value.RunningTotal); // Date, Running Total
RunningTotalList.push(rt);
/* Credits */
var c = [];
c.push(GetTime(value.WDate), value.CreditSummary); // Date, Credit Summary
CreditList.push(c);
/* Debits */
var d = [];
d.push(GetTime(value.WDate), value.DebitSummary); // Date, Debit Summary
DebitList.push(d);
/* Net Daily Amounts */
var nda = [];
nda.push(GetTime(value.WDate), value.Net); // Date, Net Daily Amount
NetAmount.push(nda);
});
PlotRT();
PlotCDND();
}
/* ---------------------------------------------------------------------------------------
* Auto adjust the bar width by determining the time span in days and setting the
* bar width according introduced cutoff values.
* -------------------------------------------------------------------------------------*/
function AutoAdjustBarWidth(
timeFrameBegin,
timeFrameEnd,
dailyCutoff,
weeklyCutoff,
monthlyCutoff,
quarterlyCutoff,
barFirst,
barSecond) {
var start = new Date(timeFrameBegin);
var end = new Date(timeFrameEnd);
var timespan = end - start;
var days = timespan / standardDay;
/* Time frame In days */
if (days <= dailyCutoff) {
barFirst.bars.barWidth = timeUnitSize.day;
barSecond.bars.barWidth = timeUnitSize.day;
format = "%a %m/%d/%y";
} else if (days > dailyCutoff && days <= weeklyCutoff) {
barFirst.bars.barWidth = timeUnitSize.week;
barSecond.bars.barWidth = timeUnitSize.week;
format = "Week ending %a %m/%d/%y";
} else if (days > weeklyCutoff && days <= monthlyCutoff) {
barFirst.bars.barWidth = timeUnitSize.month;
barSecond.bars.barWidth = timeUnitSize.month;
format = "%b %Y";
} else if (days > monthlyCutoff && days <= quarterlyCutoff) {
barFirst.bars.barWidth = timeUnitSize.quarter;
barSecond.bars.barWidth = timeUnitSize.quarter;
format = "%q %Y";
} else if (days > quarterlyCutoff) {
barFirst.bars.barWidth = timeUnitSize.year;
barSecond.bars.barWidth = timeUnitSize.year;
format = "%Y";
}
}
/* ---------------------------------------------------------------------------------------
* Plot the data on the RT (Running Total) chart and initialize its "tooltip" popup function
* -------------------------------------------------------------------------------------*/
function PlotRT() {
options.xaxis.show = true;
$.plot($("#phRT"), dsRunningTotal, options);
$("#phRT").UseTooltip();
}
/* ---------------------------------------------------------------------------------------
* Plot the data on the CDND (Credits, Debits & Net Daily) chart and initialize its
* "tooltip" popup function.
* -------------------------------------------------------------------------------------*/
function PlotCDND() {
InitCDNDDataset();
options.xaxis.show = false;
$.plot("#phCDND", dsCDND, options);
$("#phCDND").UseTooltip();
}
/* ---------------------------------------------------------------------------------------
* Initialize the "dsCDND" with child datasets (dsCredits, dsDebits & dsNet) based
* on the user's checkbox selections.
* -------------------------------------------------------------------------------------*/
function InitCDNDDataset() {
dsCDND = [[], [], []];
choiceContainer.find("input:checked").each(function() {
var key = parseInt($(this).attr("name"));
switch (key) {
case 0:
dsCDND[key] = dsCredits;
break;
case 1:
dsCDND[key] = dsDebits;
break;
case 2:
dsCDND[key] = dsNet;
break;
}
});
}
/* ---------------------------------------------------------------------------------------
* Event function that displays a popup screen when user hovers over a chart data point.
* It calls the "TooltipDialogPanel" function which constucts the panel within the screen.
* -------------------------------------------------------------------------------------*/
$.fn.UseTooltip = function() {
$(this).bind("plothover", function(event, pos, item) {
TooltipDialogPanel(event, pos, item, MainList, format);
});
};
/* Archived ********************************************************************************/
/* ---------------------------------------------------------------------------------------
* This function takes the returned data and constructs the distinct list of items that
* go into the PrimaryList dataset by using the "Date" field
* -------------------------------------------------------------------------------------*/
function GetUniqueList(list) {
var result = new Array();
for (var i = 0; i < list.length; i++) {
var exists = false;
var x = list[i][0];
for (var j = 0; j < result.length; j++) {
var y = result[j][0];
if (x === y) {
exists = true;
}
}
if (!exists)
result.push(list[i]);
}
return result;
}
/******************************************************************************************/ | rdonalson/FinancialPlanner | FinancialPlanner.Web/Scripts/codebehind/views/Timeline/Index.js | JavaScript | mit | 10,675 |
/**
* Created by grupo-becm on 1/25/16.
*/
angular.module('CapitalBusApp').factory('Bracelet', function ($resource) {
return $resource('bracelet/:id', {id: '@id'}, {
get: {
method: 'GET',
url: 'bracelet/show/:id'
},
update: {
method: 'PUT',
url: 'bracelet/update/'
},
delete: {
method: 'DELETE',
url: 'bracelet/delete/:id'
},
create: {
method: 'GET',
url: 'bracelet/create/'
},
save: {
method: 'GET',
url: 'bracelet/save'
},
toAssign: {
method: 'POST',
url: 'bracelet/toAssignForSalesman'
},
history: {
method: 'GET',
isArray: true,
url: 'bracelet/history'
},
costs: {
method: 'GET',
isArray: true,
url: 'bracelet/costs'
},
getMyAssignmentsSold: {
method: 'GET',
isArray: true,
url: 'bracelet/salesman/sold'
},
historyBySalesman: {
method: 'GET',
isArray: true,
url: 'bracelet/salesman/history'
},
getResumeHistoryByDate: {
method: 'GET',
isArray: true,
url: 'bracelet/salesman/history/resume'
},
getBraceletsNotSold: {
method: 'GET',
isArray: true,
url: 'bracelet/salesman/notSold'
},
saveCorteCaja: {
method: 'POST',
url: 'salesman/corteCaja'
},
getBraceletsYesSold: {
method: 'GET',
isArray: true,
url: 'bracelet/salesman/yesSold'
},
getHistory:{
method: 'GET',
url: 'bracelet/getHistorySalesman'
},
findByIdOrCode:{
method: 'GET',
url: 'bracelet/findByIdOrCode'
},
findByIdOrCodeWithRange:{
method: 'GET',
isArray: true,
url: 'bracelet/findByIdOrCodeWithRange'
}
});
}); | darcusfenix/cb | src/main/webapp/angularjs-app/resources/BraceletResource.js | JavaScript | mit | 2,161 |
import "start";
import "dsv/";
import "end";
| ile/csv2json | src/index.js | JavaScript | mit | 52 |
'use strict';
(function( $ ){
$.extend($.fn, {
/**
* srcset.js — responsive image tag generator
*
* @author Chris Vogt [mail@chrisvogt.me]
* @link https://github.com/chrisvogt/cdn-srcset-generator
* @license MIT
*/
srcset: function(){
var patterns = getPatterns(),
input = '',
sizes = getSizes(),
$img = '';
$('.controls input').change(function() {
input = $(this).val();
if (validateInput(input)) {
$img = buildImage(input);
updateExample($img);
}
});
/**
* Builds image element.
*
* @param {String} Path to image source
* @returns {Object}
*/
function buildImage(path) {
var $img = $('<img>', {
src: path
});
if (sizes) {
$img.attr('srcset', buildSrcset(sizes));
}
$img.attr('alt', 'ALT DESC');
return $img;
}
/**
* Attempts to verify host by path.
*
* @param {String}
* @returns {Boolean}
*/
function validateInput(input) {
if (input.match(patterns.cloudinary)) {
return 'cloudinary';
} else {
return false;
}
}
/**
* Updates the rendered and highlighted code.
*
* @param {Object} jQuery image element
* @returns {Boolean}
*/
function updateExample(img) {
var htmlString = formatNewCode(img[0]),
$codeEl = $('code');
//htmlString = htmlString.substr(0, 12) + '<br>' + htmlString.substr(12);
htmlString = htmlString
.replace('srcset', '\n\t srcset')
.replace('alt', '\n\t alt')
.replace(/.(jpg|png),/g, ',\n\t\t\t ');
$codeEl.html(htmlString);
if (typeof Prism !== 'undefined') {
Prism.highlightElement($codeEl[0]);
}
return true;
}
/**
* Sanitizes code to be rendered.
*
* @param {Object}
* @returns {String}
*/
function formatNewCode(string) {
var formatted = string.outerHTML
.replace('<', '<')
.replace('>', '>');
return formatted;
}
/**
* Generates a set of source files.
*
* @param {Array}
* @returns {Array}
*/
function buildSrcset(sizes) {
var set = [];
if (validateInput(input) === 'cloudinary') {
var re = new RegExp('upload/'),
idx = input.search(re) + 7;
for (var i = 0; i < sizes.length; i++) {
var s = 'c_scale%2Cw_' + sizes[i];
set.push(input.substr(0, idx) +
s + '/' + input.substr(idx));
}
}
return set.join();
}
/**
* Gets a list of breakpoints.
*
* @returns {Array}
*/
function getSizes() {
return [2000, 1024, 640, 320];
}
/**
* Supported providers and their RegEx patterns.
*
* @returns {Object}
*/
function getPatterns() {
return {
'cloudinary': new RegExp('^(http|https):\/\/res.cloudinary.com.*\.(jpg|png)$')
};
}
}
});
})( jQuery );
| chrisvogt/cdn-srcset-generator | app/js/srcset.js | JavaScript | mit | 3,804 |
/**
* # extra
* Copyright(c) 2019 Stefano Balietti
* MIT Licensed
*
* GameWindow extras
*
* http://www.nodegame.org
*/
(function(window, node) {
"use strict";
var GameWindow = node.GameWindow;
var DOM = J.require('DOM');
/**
* ### GameWindow.getScreen
*
* Returns the "screen" of the game
*
* i.e. the innermost element inside which to display content
*
* In the following order the screen can be:
*
* - the body element of the iframe
* - the document element of the iframe
* - the body element of the document
* - the last child element of the document
*
* @return {Element} The screen
*/
GameWindow.prototype.getScreen = function() {
var el;
el = this.getFrameDocument();
if (el) el = el.body || el;
else el = document.body || document.lastElementChild;
return el;
};
/**
* ### GameWindow.cssRule
*
* Add a css rule to the page
*
* @param {string} rule The css rule
* @param {boolean} clear Optional. TRUE to clear all previous rules
* added with this method to the page
*
* @return {Element} The HTML style element where the rules were added
*
* @see handleFrameLoad
*/
GameWindow.prototype.cssRule = function(rule, clear) {
var root;
if ('string' !== typeof rule) {
throw new TypeError('Game.execStep: style property must be ' +
'string. Found: ' + rule);
}
if (!this.styleElement) {
root = W.getFrameDocument() || window.document;
this.styleElement = W.append('style', root.head, {
type: 'text/css',
id: 'ng_style'
});
}
else if (clear) {
this.styleElement.innerHTML = '';
}
this.styleElement.innerHTML += rule;
return this.styleElement;
};
/**
* ### GameWindow.write
*
* Appends content inside a root element
*
* The content can be a text string, an HTML node or element.
* If no root element is specified, the default screen is used.
*
* @param {string|object} text The content to write
* @param {Element|string} root Optional. The root element or its id
*
* @return {string|object} The content written
*
* @see GameWindow.writeln
*/
GameWindow.prototype.write = function(text, root) {
if ('string' === typeof root) root = this.getElementById(root);
else if (!root) root = this.getScreen();
if (!root) {
throw new
Error('GameWindow.write: could not determine where to write');
}
return DOM.write(root, text);
};
/**
* ### GameWindow.writeln
*
* Appends content inside a root element followed by a break element
*
* The content can be a text string, an HTML node or element.
* If no root element is specified, the default screen is used.
*
* @param {string|object} text The content to write
* @param {Element|string} root Optional. The root element or its id
*
* @return {string|object} The content written
*
* @see GameWindow.write
*/
GameWindow.prototype.writeln = function(text, root, br) {
if ('string' === typeof root) root = this.getElementById(root);
else if (!root) root = this.getScreen();
if (!root) {
throw new Error('GameWindow.writeln: ' +
'could not determine where to write');
}
return DOM.writeln(root, text, br);
};
/**
* ### GameWindow.generateUniqueId
*
* Generates a unique id
*
* Overrides JSUS.DOM.generateUniqueId.
*
* @param {string} prefix Optional. The prefix to use
*
* @return {string} The generated id
*
* @experimental
* TODO: it is not always working fine.
*/
GameWindow.prototype.generateUniqueId = function(prefix) {
var id, found;
id = '' + (prefix || J.randomInt(0, 1000));
found = this.getElementById(id);
while (found) {
id = '' + prefix + '_' + J.randomInt(0, 1000);
found = this.getElementById(id);
}
return id;
};
/**
* ### GameWindow.toggleInputs
*
* Enables / disables the input forms
*
* If an id is provided, only input elements that are children
* of the element with the specified id are toggled.
*
* If id is not given, it toggles the input elements on the whole page,
* including the frame document, if found.
*
* If a state parameter is given, all the input forms will be either
* disabled or enabled (and not toggled).
*
* @param {string} id Optional. The id of the element container
* of the forms. Default: the whole page, including the frame document
* @param {boolean} disabled Optional. Forces all the inputs to be either
* disabled or enabled (not toggled)
*
* @return {boolean} FALSE, if the method could not be executed
*
* @see GameWindow.getFrameDocument
* @see toggleInputs
*/
GameWindow.prototype.toggleInputs = function(id, disabled) {
var container;
if (!document.getElementsByTagName) {
node.err(
'GameWindow.toggleInputs: getElementsByTagName not found');
return false;
}
if (id && 'string' === typeof id) {
throw new Error('GameWindow.toggleInputs: id must be string or ' +
'undefined. Found: ' + id);
}
if (id) {
container = this.getElementById(id);
if (!container) {
throw new Error('GameWindow.toggleInputs: no elements found ' +
'with id ' + id);
}
toggleInputs(disabled, container);
}
else {
// The whole page.
toggleInputs(disabled);
container = this.getFrameDocument();
// If there is a frame, apply it there too.
if (container) toggleInputs(disabled, container);
}
return true;
};
/**
* ### GameWindow.getLoadingDots
*
* Creates and returns a span element with incrementing dots inside
*
* New dots are added every second until the limit is reached, then it
* starts from the beginning.
*
* Gives the impression of a loading time.
*
* @param {number} len Optional. The maximum length of the loading dots.
* Default: 5
* @param {string} id Optional The id of the span
*
* @return {object} An object containing two properties: the span element
* and a method stop, that clears the interval
*/
GameWindow.prototype.getLoadingDots = function(len, id) {
var spanDots, counter, intervalId;
if (len & len < 0) {
throw new Error('GameWindow.getLoadingDots: len cannot be < 0. ' +
'Found: ' + len);
}
spanDots = document.createElement('span');
spanDots.id = id || 'span_dots';
// Refreshing the dots...
counter = 0;
len = len || 5;
// So the height does not change.
spanDots.innerHTML = ' ';
intervalId = setInterval(function() {
if (counter < len) {
counter++;
spanDots.innerHTML = spanDots.innerHTML + '.';
}
else {
counter = 0;
spanDots.innerHTML = '.';
}
}, 1000);
function stop() {
spanDots.innerHTML = '.';
clearInterval(intervalId);
}
return {
span: spanDots,
stop: stop
};
};
/**
* ### GameWindow.addLoadingDots
*
* Appends _loading dots_ to an HTML element
*
* By invoking this method you lose access to the _stop_ function of the
* _loading dots_ element.
*
* @param {HTMLElement} root The element to which the loading dots will be
* appended
* @param {number} len Optional. The maximum length of the loading dots.
* Default: 5
* @param {string} id Optional The id of the span
*
* @return {object} An object containing two properties: the span element
* and a method stop, that clears the interval
*
* @see GameWindow.getLoadingDots
*/
GameWindow.prototype.addLoadingDots = function(root, len, id) {
var ld;
ld = this.getLoadingDots(len, id);
root.appendChild(ld.span);
return ld;
};
/**
* ### GameWindow.getEventButton
*
* Creates an HTML button element that will emit an event when clicked
*
* @param {string} event The event to emit when clicked
* @param {string|object} attributes Optional. The attributes of the
* button, or if string the text to display inside the button.
*
* @return {Element} The newly created button
*
* @see GameWindow.get
*/
GameWindow.prototype.getEventButton = function(event, attributes) {
var b;
if ('string' !== typeof event) {
throw new TypeError('GameWindow.getEventButton: event must ' +
'be string. Found: ' + event);
}
if ('string' === typeof attributes) {
attributes = { innerHTML: attributes };
}
else if (!attributes) {
attributes = {};
}
if (!attributes.innerHTML) attributes.innerHTML = event;
b = this.get('button', attributes);
b.onclick = function() { node.emit(event); };
return b;
};
/**
* ### GameWindow.addEventButton
*
* Adds an EventButton to the specified root element
*
* @param {string} event The event to emit when clicked
* @param {Element} root Optional. The root element. Default: last element
* on the page
* @param {string|object} attributes Optional. The attributes of the
* button, or if string the text to display inside the button.
*
* @return {Element} The newly created button
*
* @see GameWindow.get
* @see GameWindow.getEventButton
*/
GameWindow.prototype.addEventButton = function(event, root, attributes) {
var eb;
eb = this.getEventButton(event, attributes);
if (!root) root = this.getScreen();
return root.appendChild(eb);
};
/**
* ### GameWindow.searchReplace
*
* Replaces the innerHTML of the element/s with matching id or class name
*
* It iterates through each element and passes it to
* `GameWindow.setInnerHTML`.
*
* If elements is array, each item in the array must be of the type:
*
* ```javascript
*
* { search: 'key', replace: 'value' }
*
* // or
*
* { search: 'key', replace: 'value', mod: 'id' }
* ```
*
* If elements is object, it must be of the type:
*
* ```javascript
*
* {
* search1: value1, search2: value 2 // etc.
* }
* ```
*
* It accepts a variable number of input parameters. The first is always
* _elements_. If there are 2 input parameters, the second is _prefix_,
* while if there are 3 input parameters, the second is _mod_ and the third
* is _prefix_.
*
* @param {object|array} Elements to search and replace
* @param {string} mod Optional. Modifier passed to GameWindow.setInnerHTML
* @param {string} prefix Optional. Prefix added to the search string.
* Default: 'ng_replace_', null or '' equals no prefix.
*
* @see GameWindow.setInnerHTML
*/
GameWindow.prototype.searchReplace = function() {
var elements, mod, prefix;
var name, len, i;
if (arguments.length === 2) {
mod = 'g';
prefix = arguments[1];
}
else if (arguments.length > 2) {
mod = arguments[1];
prefix = arguments[2];
}
if ('undefined' === typeof prefix) {
prefix = 'ng_replace_';
}
else if (null === prefix) {
prefix = '';
}
else if ('string' !== typeof prefix) {
throw new TypeError('GameWindow.searchReplace: prefix ' +
'must be string, null or undefined. Found: ' +
prefix);
}
elements = arguments[0];
if (J.isArray(elements)) {
i = -1, len = elements.length;
for ( ; ++i < len ; ) {
this.setInnerHTML(prefix + elements[i].search,
elements[i].replace,
elements[i].mod || mod);
}
}
else if ('object' !== typeof elements) {
for (name in elements) {
if (elements.hasOwnProperty(name)) {
this.setInnerHTML(prefix + name, elements[name], mod);
}
}
}
else {
throw new TypeError('GameWindow.setInnerHTML: elements must be ' +
'object or arrray. Found: ' + elements);
}
};
/**
* ### GameWindow.setInnerHTML
*
* Replaces the innerHTML of the element with matching id or class name
*
* @param {string|number} search Element id or className
* @param {string|number} replace The new value of the property innerHTML
* @param {string} mod Optional. A modifier defining how to use the
* search parameter. Values:
*
* - 'id': replaces at most one element with the same id (default)
* - 'className': replaces all elements with same class name
* - 'g': replaces globally, both by id and className
*/
GameWindow.prototype.setInnerHTML = function(search, replace, mod) {
var el, i, len;
// Only process strings or numbers.
if ('string' !== typeof search && 'number' !== typeof search) {
throw new TypeError('GameWindow.setInnerHTML: search must be ' +
'string or number. Found: ' + search +
" (replace = " + replace + ")");
}
// Only process strings or numbers.
if ('string' !== typeof replace && 'number' !== typeof replace) {
throw new TypeError('GameWindow.setInnerHTML: replace must be ' +
'string or number. Found: ' + replace +
" (search = " + search + ")");
}
if ('undefined' === typeof mod) {
mod = 'id';
}
else if ('string' === typeof mod) {
if (mod !== 'g' && mod !== 'id' && mod !== 'className') {
throw new Error('GameWindow.setInnerHTML: invalid ' +
'mod value: ' + mod +
" (search = " + search + ")");
}
}
else {
throw new TypeError('GameWindow.setInnerHTML: mod must be ' +
'string or undefined. Found: ' + mod +
" (search = " + search + ")");
}
if (mod === 'id' || mod === 'g') {
// Look by id.
el = W.getElementById(search);
if (el && el.className !== search) el.innerHTML = replace;
}
if (mod === 'className' || mod === 'g') {
// Look by class name.
el = W.getElementsByClassName(search);
len = el.length;
if (len) {
i = -1;
for ( ; ++i < len ; ) {
el[i].innerHTML = replace;
}
}
}
};
/**
* ## GameWindow.hide
*
* Gets and hides an HTML element
*
* Sets the style of the display to 'none' and adjust the frame
* height as necessary.
*
* @param {string|HTMLElement} idOrObj The id of or the HTML element itself
*
* @return {HTMLElement} The hidden element, if found
*
* @see getElement
*/
GameWindow.prototype.hide = function(idOrObj) {
var el;
el = getElement(idOrObj, 'GameWindow.hide');
if (el) {
el.style.display = 'none';
W.adjustFrameHeight(0, 0);
}
return el;
};
/**
* ## GameWindow.show
*
* Gets and shows (makes visible) an HTML element
*
* Sets the style of the display to '' and adjust the frame height
* as necessary.
*
* @param {string|HTMLElement} idOrObj The id of or the HTML element itself
* @param {string} display Optional. The value of the display attribute.
* Default: '' (empty string).
*
* @return {HTMLElement} The shown element, if found
*
* @see getElement
*/
GameWindow.prototype.show = function(idOrObj, display) {
var el;
display = display || '';
if ('string' !== typeof display) {
throw new TypeError('GameWindow.show: display must be ' +
'string or undefined. Found: ' + display);
}
el = getElement(idOrObj, 'GameWindow.show');
if (el) {
el.style.display = display;
W.adjustFrameHeight(0, 0);
}
return el;
};
/**
* ## GameWindow.toggle
*
* Gets and toggles the visibility of an HTML element
*
* Sets the style of the display to '' or 'none' and adjust
* the frame height as necessary.
*
* @param {string|HTMLElement} idOrObj The id of or the HTML element itself
* @param {string} display Optional. The value of the display attribute
* in case it will be set visible. Default: '' (empty string).
*
* @return {HTMLElement} The toggled element, if found
*
* @see getElement
*/
GameWindow.prototype.toggle = function(idOrObj, display) {
var el;
display = display || '';
if ('string' !== typeof display) {
throw new TypeError('GameWindow.toggle: display must ' +
'be string or undefined. Found: ' + display);
}
el = getElement(idOrObj, 'GameWindow.toggle');
if (el) {
if (el.style.display === 'none') el.style.display = display;
else el.style.display = 'none';
W.adjustFrameHeight(0, 0);
}
return el;
};
// ## Helper Functions
/**
* ### toggleInputs
*
* @api private
*/
function toggleInputs(state, container) {
var inputTags, j, len, i, inputs, nInputs;
container = container || document;
inputTags = ['button', 'select', 'textarea', 'input'];
len = inputTags.length;
for (j = 0; j < len; j++) {
inputs = container.getElementsByTagName(inputTags[j]);
nInputs = inputs.length;
for (i = 0; i < nInputs; i++) {
// Set to state, or toggle.
if ('undefined' === typeof state) {
state = inputs[i].disabled ? false : true;
}
if (state) {
inputs[i].disabled = state;
}
else {
inputs[i].removeAttribute('disabled');
}
}
}
}
/**
* ### getElement
*
* Gets the element or returns it
*
* @param {string|HTMLElement} The id or the HTML element itself
*
* @return {HTMLElement} The HTML Element
*
* @see GameWindow.getElementById
* @api private
*/
function getElement(idOrObj, prefix) {
var el;
if ('string' === typeof idOrObj) {
el = W.getElementById(idOrObj);
}
else if (J.isElement(idOrObj)) {
el = idOrObj;
}
else {
throw new TypeError(prefix + ': idOrObj must be string ' +
' or HTML Element. Found: ' + idOrObj);
}
return el;
}
})(
// GameWindow works only in the browser environment. The reference
// to the node.js module object is for testing purpose only
('undefined' !== typeof window) ? window : module.parent.exports.window,
('undefined' !== typeof window) ? window.node : module.parent.exports.node
);
| nodeGame/nodegame-window | lib/modules/extra.js | JavaScript | mit | 20,674 |