Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mapscreenr

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapscreenr - npm Package Compare versions

Comparing version 0.6.2 to 0.7.0

.vscode/settings.json

82

package.json
{
"name": "mapscreenr",
"description": "A flexible container for map attributes and viewport.",
"version": "0.6.2",
"author": {
"name": "Josh Goldberg",
"email": "joshuakgoldberg@outlook.com"
},
"repository": {
"type": "git",
"url": "ssh://git@github.com:FullScreenShenanigans/MapScreenr.git"
},
"bugs": {
"url": "https://github.com/FullScreenShenanigans/MapScreenr/issues"
},
"license": "MIT",
"devDependencies": {
"gulp-shenanigans": "0.6.X"
}
"author": {
"email": "joshuakgoldberg@outlook.com",
"name": "Josh Goldberg"
},
"bugs": {
"url": "https://github.com/FullScreenShenanigans/MapScreenr/issues"
},
"dependencies": {},
"description": "A flexible container for map attributes and viewport.",
"devDependencies": {
"@types/chai": "^4.0.4",
"@types/lolex": "^1.5.32",
"@types/mocha": "^2.2.44",
"@types/sinon": "^4.0.0",
"@types/sinon-chai": "^2.7.29",
"chai": "^4.1.2",
"glob": "^7.1.2",
"lolex": "^2.3.0",
"mocha": "^4.0.1",
"mocha-headless-chrome": "^1.7.1",
"requirejs": "^2.3.5",
"run-for-every-file": "^1.1.0",
"shenanigans-manager": "^0.2.0",
"sinon": "^4.1.2",
"sinon-chai": "^2.14.0",
"tslint": "5.8.0",
"typedoc": "^0.9.0",
"typescript": "^2.6.2",
"webpack": "^3.10.0"
},
"license": "MIT",
"name": "mapscreenr",
"repository": {
"type": "git",
"url": "ssh://git@github.com:FullScreenShenanigans/MapScreenr.git"
},
"scripts": {
"dist": "npm run dist:webpack",
"dist:webpack": "webpack --config webpack.config.js",
"docs": "npm run docs:typedoc",
"docs:typedoc": "typedoc src/ --out docs/generated",
"init": "npm install && npm run setup && npm run verify",
"setup": "npm run setup:copy && npm run setup:package",
"setup:copy": "npm run setup:copy:default",
"setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/default/\" --file \"**/*\" --run \"mustache package.json {{src-file}} {{file}}\" --dest \".\" --only-files",
"setup:package": "shenanigans-manager hydrate-package-json",
"src": "npm run src:tsc && npm run src:tslint",
"src:tsc": "tsc -p .",
"src:tslint": "tslint -c tslint.json --exclude ./node_modules/**/*.ts* -p tsconfig.json -t stylish",
"test": "npm run test:setup && npm run test:run",
"test:run": "mocha-headless-chrome --file test/index.html",
"test:setup": "npm run test:setup:copy && npm run test:setup:html && npm run test:setup:tsc",
"test:setup:copy": "npm run test:setup:copy:default",
"test:setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/test/\" --file \"**/*\" --run \"mustache package.json {{src-file}} ./test/{{file}}\" --dest \".\" --only-files",
"test:setup:html": "shenanigans-manager generate-test-html",
"test:setup:tsc": "tsc -p test",
"verify": "npm run src && npm run test && npm run dist && npm run docs",
"watch": "run-p \"tsc -p . -w\" \"echo sup\""
},
"shenanigans": {
"name": "MapScreenr"
},
"types": "./src/index.d.ts",
"version": "0.7.0"
}

@@ -0,1 +1,2 @@

<!-- {{Top}} -->
# MapScreenr

@@ -6,17 +7,10 @@ [![Build Status](https://travis-ci.org/FullScreenShenanigans/MapScreenr.svg?branch=master)](https://travis-ci.org/FullScreenShenanigans/MapScreenr)

A flexible container for map attributes and viewport.
<!-- {{/Top}} -->
<!-- {{Development}} -->
## Development
See [Documentation/Development](https://github.com/FullScreenShenanigans/Documentation).
## Build Process
MapScreenr uses [Gulp](http://gulpjs.com/) to automate building, which requires [Node.js](http://node.js.org).
To build from scratch, install NodeJS and run the following commands:
```
npm install -g gulp
npm install
gulp
```
See [Build Details](https://github.com/FullScreenShenanigans/Documentation/blob/master/Build%20Details.md) for detailed Gulp usage.
<!-- {{/Development}} -->
/**
* Functions to compute new variable values, keyed by their variable's names.
* functions to compute new variable values, keyed by their variable's names.
*/
export interface IVariableFunctions {
[i: string]: Function;
[i: string]: () => any;
}

@@ -31,6 +31,2 @@ /**

/**
* Arguments to be passed to variable Functions.
*/
variableArgs?: any[];
/**
* Assorted known variables, keyed by name.

@@ -77,10 +73,6 @@ */

/**
* A listing of variable Functions to be calculated on screen resets.
* A listing of variable functions to be calculated on screen resets.
*/
variableFunctions: IVariableFunctions;
/**
* Arguments to be passed into variable computation Functions.
*/
variableArgs: any[];
/**
* Known variables, keyed by name.

@@ -103,10 +95,10 @@ */

/**
* Recalculates all variables by passing variableArgs to their Functions.
* Recalculates all variables.
*/
setVariables(): void;
/**
* Recalculates a variable by passing variableArgs to its Function.
* Recalculates a variable by passing variableArgs to its function.
*
* @param name The name of the variable to recalculate.
* @param value A new value for the variable instead of its Function's result.
* @param value A new value for the variable instead of its function's result.
* @returns The new value of the variable.

@@ -113,0 +105,0 @@ */

define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
});
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJJTWFwU2NyZWVuci5qcyIsInNvdXJjZXNDb250ZW50IjpbXX0=
/**
* Functions to compute new variable values, keyed by their variable's names.
* functions to compute new variable values, keyed by their variable's names.
*/
export interface IVariableFunctions {
[i: string]: Function;
[i: string]: () => any;
}

@@ -36,7 +36,2 @@

/**
* Arguments to be passed to variable Functions.
*/
variableArgs?: any[];
/**
* Assorted known variables, keyed by name.

@@ -92,3 +87,3 @@ */

/**
* A listing of variable Functions to be calculated on screen resets.
* A listing of variable functions to be calculated on screen resets.
*/

@@ -98,7 +93,2 @@ variableFunctions: IVariableFunctions;

/**
* Arguments to be passed into variable computation Functions.
*/
variableArgs: any[];
/**
* Known variables, keyed by name.

@@ -125,3 +115,3 @@ */

/**
* Recalculates all variables by passing variableArgs to their Functions.
* Recalculates all variables.
*/

@@ -131,6 +121,6 @@ setVariables(): void;

/**
* Recalculates a variable by passing variableArgs to its Function.
*
* Recalculates a variable by passing variableArgs to its function.
*
* @param name The name of the variable to recalculate.
* @param value A new value for the variable instead of its Function's result.
* @param value A new value for the variable instead of its function's result.
* @returns The new value of the variable.

@@ -142,3 +132,3 @@ */

* Shifts the MapScreenr horizontally and vertically via shiftX and shiftY.
*
*
* @param dx How far to scroll horizontally.

@@ -151,3 +141,3 @@ * @param dy How far to scroll vertically.

* Shifts the MapScreenr horizontally by changing left and right by the dx.
*
*
* @param dx How far to scroll horizontally.

@@ -159,3 +149,3 @@ */

* Shifts the MapScreenr vertically by changing top and bottom by the dy.
*
*
* @param dy How far to scroll vertically.

@@ -162,0 +152,0 @@ */

@@ -9,8 +9,4 @@ import { IMapScreenr, IMapScreenrSettings, IVariableFunctions, IVariables } from "./IMapScreenr";

*/
variableFunctions: IVariableFunctions;
readonly variableFunctions: IVariableFunctions;
/**
* Arguments to be passed into variable computation Functions.
*/
variableArgs: any[];
/**
* Top border measurement of the bounding box.

@@ -42,16 +38,15 @@ */

*/
width: number;
readonly width: number;
/**
* Constant height of the bounding box.
*/
height: number;
readonly height: number;
/**
* Assorted known variables, keyed by name.
*/
variables: IVariables;
readonly variables: IVariables;
/**
* Resets the MapScreenr. All members of the settings argument are copied
* to the MapScreenr itself, though only width and height are required.
* Initializes a new instance of the MapScreenr class.
*
* @param {IMapScreenrSettings} settings
* @param settings Settings to be used for initialization.
*/

@@ -73,3 +68,3 @@ constructor(settings: IMapScreenrSettings);

/**
* Recalculates all variables by passing variableArgs to their Functions.
* Recalculates all variables.
*/

@@ -76,0 +71,0 @@ setVariables(): void;

define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* A flexible container for map attributes and viewport.
*/
var MapScreenr = (function () {
var MapScreenr = /** @class */ (function () {
/**
* Resets the MapScreenr. All members of the settings argument are copied
* to the MapScreenr itself, though only width and height are required.
* Initializes a new instance of the MapScreenr class.
*
* @param {IMapScreenrSettings} settings
* @param settings Settings to be used for initialization.
*/

@@ -18,14 +18,5 @@ function MapScreenr(settings) {

this.variables = {};
if (typeof settings === "undefined") {
throw new Error("No settings object given to MapScreenr.");
}
if (!settings.width) {
throw new Error("No width given to MapScreenr.");
}
if (!settings.height) {
throw new Error("No height given to MapScreenr.");
}
if (settings.variables) {
if (settings.variables !== undefined) {
for (var name_1 in settings.variables) {
if (settings.variables.hasOwnProperty(name_1)) {
if ({}.hasOwnProperty.call(settings.variables, name_1)) {
this.variables[name_1] = settings.variables[name_1];

@@ -37,4 +28,5 @@ }

this.width = settings.width;
this.variableFunctions = settings.variableFunctions || {};
this.variableArgs = settings.variableArgs || [];
this.variableFunctions = settings.variableFunctions === undefined
? {}
: settings.variableFunctions;
}

@@ -67,9 +59,7 @@ /**

/**
* Recalculates all variables by passing variableArgs to their Functions.
* Recalculates all variables.
*/
MapScreenr.prototype.setVariables = function () {
for (var i in this.variableFunctions) {
if (this.variableFunctions.hasOwnProperty(i)) {
this.setVariable(i);
}
this.setVariable(i);
}

@@ -86,3 +76,3 @@ };

this.variables[name] = arguments.length === 1
? this.variableFunctions[name].apply(this, this.variableArgs)
? this.variableFunctions[name]()
: value;

@@ -97,6 +87,6 @@ };

MapScreenr.prototype.shift = function (dx, dy) {
if (dx) {
if (dx !== 0) {
this.shiftX(dx);
}
if (dy) {
if (dy !== 0) {
this.shiftY(dy);

@@ -127,3 +117,1 @@ }

});
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIk1hcFNjcmVlbnIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7SUFJQTs7T0FFRztJQUNIO1FBd0RJOzs7OztXQUtHO1FBQ0gsb0JBQW1CLFFBQTZCO1lBWGhEOztlQUVHO1lBQ0ksY0FBUyxHQUFlLEVBQUUsQ0FBQztZQVM5QixFQUFFLENBQUMsQ0FBQyxPQUFPLFFBQVEsS0FBSyxXQU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gICAgLyoqXHJcbiAgICAgKiBCb3R0b20gYm9yZGVyIG1lYXN1cmVtZW50IG9mIHRoZSBib3VuZGluZyBib3guXHJcbiAgICAgKi9cclxuICAgIHB1YmxpYyBib3R0b206IG51bWJlcjtcclxuXHJcbiAgICAvKipcclxuICAgICAqIExlZnQgYm9yZGVyIG1lYXN1cmVtZW50IG9mIHRoZSBib3VuZGluZyBib3guXHJcbiAgICAgKi9cclxuICAgIHB1YmxpYyBsZWZ0OiBudW1iZXI7XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBDb25zdGFudCBob3Jpem9udGFsIG1pZHBvaW50IG9mIHRoZSBib3VuZGluZyBib3gsIGVxdWFsIHRvIChsZWZ0ICsgcmlnaHQpIC8gMi5cclxuICAgICAqL1xyXG4gICAgcHVibGljIG1pZGRsZVg6IG51bWJlcjtcclxuXHJcbiAgICAvKipcclxuICAgICAqIENvbnN0YW50IHZlcnRpY2FsIG1pZHBvaW50IG9mIHRoZSBib3VuZGluZyBib3gsIGVxdWFsIHRvICh0b3AgKyBib3R0b20pIC8gMi5cclxuICAgICAqL1xyXG4gICAgcHVibGljIG1pZGRsZVk6IG51bWJlcjtcclxuXHJcbiAgICAvKipcclxuICAgICAqIENvbnN0YW50IHdpZHRoIG9mIHRoZSBib3VuZGluZyBib3guXHJcbiAgICAgKi9cclxuICAgIHB1YmxpYyB3aWR0aDogbnVtYmVyO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogQ29uc3RhbnQgaGVpZ2h0IG9mIHRoZSBib3VuZGluZyBib3guXHJcbiAgICAgKi9cclxuICAgIHB1YmxpYyBoZWlnaHQ6IG51bWJlcjtcclxuXHJcbiAgICAvKipcclxuICAgICAqIEFzc29ydGVkIGtub3duIHZhcmlhYmxlcywga2V5ZWQgYnkgbmFtZS5cclxuICAgICAqL1xyXG4gICAgcHVibGljIHZhcmlhYmxlczogSVZhcmlhYmxlcyA9IHt9O1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogUmVzZXR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YXBTY3JlZW5yIGhvcml6b250YWxseSBieSBjaGFuZ2luZyBsZWZ0IGFuZCByaWdodCBieSB0aGUgZHguXHJcbiAgICAgKiBcclxuICAgICAqIEBwYXJhbSBkeCAgIEhvdyBmYXIgdG8gc2Nyb2xsIGhvcml6b250YWxseS5cclxuICAgICAqL1xyXG4gICAgcHVibGljIHNoaWZ0WChkeDogbnVtYmVyKTogdm9pZCB7XHJcbiAgICAgICAgdGhpcy5sZWZ0ICs9IGR4O1xyXG4gICAgICAgIHRoaXMucmlnaHQgKz0gZHg7XHJcbiAgICB9XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBTaGlmdHMgdGhlIE1hcFNjcmVlbnIgdmVydGljYWxseSBieSBjaGFuZ2luZyB0b3AgYW5kIGJvdHRvbSBieSB0aGUgZHkuXHJcbiAgICAgKiBcclxuICAgICAqIEBwYXJhbSBkeSAgIEhvdyBmYXIgdG8gc2Nyb2xsIHZlcnRpY2FsbHkuXHJcbiAgICAgKi9cclxuICAgIHB1YmxpYyBzaGlmdFkoZHk6IG51bWJlcik6IHZvaWQge1xyXG4gICAgICAgIHRoaXMudG9wICs9IGR5O1xyXG4gICAgICAgIHRoaXMuYm90dG9tICs9IGR5O1xyXG4gICAgfVxyXG59XHJcbiJdfQ==

@@ -1,4 +0,2 @@

import {
IMapScreenr, IMapScreenrSettings, IVariableFunctions, IVariables
} from "./IMapScreenr";
import { IMapScreenr, IMapScreenrSettings, IVariableFunctions, IVariables } from "./IMapScreenr";

@@ -12,10 +10,5 @@ /**

*/
public variableFunctions: IVariableFunctions;
public readonly variableFunctions: IVariableFunctions;
/**
* Arguments to be passed into variable computation Functions.
*/
public variableArgs: any[];
/**
* Top border measurement of the bounding box.

@@ -53,3 +46,3 @@ */

*/
public width: number;
public readonly width: number;

@@ -59,3 +52,3 @@ /**

*/
public height: number;
public readonly height: number;

@@ -65,24 +58,13 @@ /**

*/
public variables: IVariables = {};
public readonly variables: IVariables = {};
/**
* Resets the MapScreenr. All members of the settings argument are copied
* to the MapScreenr itself, though only width and height are required.
*
* @param {IMapScreenrSettings} settings
* Initializes a new instance of the MapScreenr class.
*
* @param settings Settings to be used for initialization.
*/
public constructor(settings: IMapScreenrSettings) {
if (typeof settings === "undefined") {
throw new Error("No settings object given to MapScreenr.");
}
if (!settings.width) {
throw new Error("No width given to MapScreenr.");
}
if (!settings.height) {
throw new Error("No height given to MapScreenr.");
}
if (settings.variables) {
if (settings.variables !== undefined) {
for (const name in settings.variables) {
if (settings.variables.hasOwnProperty(name)) {
if ({}.hasOwnProperty.call(settings.variables, name)) {
this.variables[name] = settings.variables[name];

@@ -95,4 +77,5 @@ }

this.width = settings.width;
this.variableFunctions = settings.variableFunctions || {};
this.variableArgs = settings.variableArgs || [];
this.variableFunctions = settings.variableFunctions === undefined
? {}
: settings.variableFunctions;
}

@@ -131,9 +114,7 @@

/**
* Recalculates all variables by passing variableArgs to their Functions.
* Recalculates all variables.
*/
public setVariables(): void {
for (const i in this.variableFunctions) {
if (this.variableFunctions.hasOwnProperty(i)) {
this.setVariable(i);
}
this.setVariable(i);
}

@@ -144,3 +125,3 @@ }

* Recalculates a variable by passing variableArgs to its Function.
*
*
* @param name The name of the variable to recalculate.

@@ -152,3 +133,3 @@ * @param value A new value for the variable instead of its Function's result.

this.variables[name] = arguments.length === 1
? this.variableFunctions[name].apply(this, this.variableArgs)
? this.variableFunctions[name]()
: value;

@@ -159,3 +140,3 @@ }

* Shifts the MapScreenr horizontally and vertically via shiftX and shiftY.
*
*
* @param dx How far to scroll horizontally.

@@ -165,7 +146,7 @@ * @param dy How far to scroll vertically.

public shift(dx: number, dy: number): void {
if (dx) {
if (dx !== 0) {
this.shiftX(dx);
}
if (dy) {
if (dy !== 0) {
this.shiftY(dy);

@@ -177,3 +158,3 @@ }

* Shifts the MapScreenr horizontally by changing left and right by the dx.
*
*
* @param dx How far to scroll horizontally.

@@ -188,3 +169,3 @@ */

* Shifts the MapScreenr vertically by changing top and bottom by the dy.
*
*
* @param dy How far to scroll vertically.

@@ -191,0 +172,0 @@ */

{
"compilerOptions": {
"declaration": true,
"experimentalDecorators": true,
"jsx": "react",
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"],
"module": "amd",

@@ -10,10 +13,14 @@ "moduleResolution": "node",

"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"pretty": true,
"strictNullChecks": true,
"target": "es3"
"target": "es5"
},
"exclude": [
"dist",
"node_modules"
],
"include": [
"./src/**/*.ts"
"./src/**/*.ts",
"./src/**/*.tsx"
]
}
{
"extends": "./node_modules/shenanigans-manager/setup/tslint.json",
"rules": {
"align": [
true,
"parameters",
"arguments",
"statements"
],
"class-name": true,
"comment-format": [true, "check-space"],
"curly": true,
"eofline": true,
"forin": true,
"indent": [true, 4],
"interface-name": [true, "always-prefix"],
"jsdoc-format": true,
"label-position": true,
"max-line-length": [true, 140],
"member-access": true,
"member-ordering": [
true,
"public-before-private",
"static-before-instance",
"variables-before-functions"
],
"new-parens": true,
"no-angle-bracket-type-assertion": true,
"no-arg": true,
"no-conditional-assignment": true,
"no-consecutive-blank-lines": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-variable": true,
"no-empty": true,
"no-eval": true,
"no-internal-module": true,
"no-null-keyword": true,
"no-shadowed-variable": true,
"no-string-literal": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unsafe-finally": true,
"no-unused-expression": true,
"no-unused-new": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"one-line": [
true,
"check-catch",
"check-else",
"check-finally",
"check-open-brace",
"check-whitespace"
],
"one-variable-per-declaration": true,
"ordered-imports": true,
"quotemark": [true, "double"],
"semicolon": [true, "always"],
"switch-default": true,
"trailing-comma": true,
"triple-equals": [true, "allow-null-check"],
"typedef": [
true,
"call-signature",
"parameter",
"property-declaration",
"variable-declaration",
"member-variable-declaration"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"use-isnan": true,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
]
"no-any": false
}
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc