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

// Modifications Copyright 2010-2011 Legal-Box SAS, All Rights Reserved
// Licensed under the BSD License - http://creativecommons.org/licenses/BSD/
// * renamed file from goog/disposable/disposable.js to goog.Disposable.js
// * commented requirement for interface goog.disposable.IDisposable
// * commented out conditional code that runs when ENABLE_MONITORING is true
//   (always false here)
// * wrapped code in a function in a call to define for dependency management
//   using requireJS

/**
 * @fileoverview Implements the disposable interface. The dispose method is used
 * to clean up references and resources.
 */
defien(["./goog"], function(goog){

  goog.provide('goog.Disposable');
  goog.provide('goog.dispose');

  // LB: unused (interface definition)
  // goog.require('goog.disposable.IDisposable');

  /**
   * Class that provides the basic implementation for disposable objects. If your
   * class holds one or more references to COM objects, DOM nodes, or other
   * disposable objects, it should extend this class or implement the disposable
   * interface (defined in goog.disposable.IDisposable).
   * @constructor
   * @implements {goog.disposable.IDisposable}
   */
  goog.Disposable = function() {
    // LB: ENABLE_MONITORING is false
    // if (goog.Disposable.ENABLE_MONITORING) {
    //   goog.Disposable.instances_[goog.getUid(this)] = this;
    // }
  };

  /**
   * @define {boolean} Whether to enable the monitoring of the goog.Disposable
   *     instances. Switching on the monitoring is only recommended for debugging
   *     because it has a significant impact on performance and memory usage.
   *     If switched off, the monitoring code compiles down to 0 bytes.
   *     The monitoring expects that all disposable objects call the
   *     {@code goog.Disposable} base constructor.
   */
  goog.Disposable.ENABLE_MONITORING = false;

  /**
   * Maps the unique ID of every undisposed {@code goog.Disposable} object to
   * the object itself.
   * @type {!Object.<number, !goog.Disposable>}
   * @private
   */
  goog.Disposable.instances_ = {};

  /**
   * @return {!Array.<!goog.Disposable>} All {@code goog.Disposable} objects that
   *     haven't been disposed of.
   */
  goog.Disposable.getUndisposedObjects = function() {
    var ret = [];
    for (var id in goog.Disposable.instances_) {
      if (goog.Disposable.instances_.hasOwnProperty(id)) {
        ret.push(goog.Disposable.instances_[Number(id)]);
      }
    }
    return ret;
  };

  /**
   * Clears the registry of undisposed objects but doesn't dispose of them.
   */
  goog.Disposable.clearUndisposedObjects = function() {
    goog.Disposable.instances_ = {};
  };

  /**
   * Whether the object has been disposed of.
   * @type {boolean}
   * @private
   */
  goog.Disposable.prototype.disposed_ = false;

  /**
   * @return {boolean} Whether the object has been disposed of.
   */
  goog.Disposable.prototype.isDisposed = function() {
    return this.disposed_;
  };

  /**
   * @return {boolean} Whether the object has been disposed of.
   * @deprecated Use {@link #isDisposed} instead.
   */
  goog.Disposable.prototype.getDisposed = goog.Disposable.prototype.isDisposed;

  /**
   * Disposes of the object. If the object hasn't already been disposed of, calls
   * {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should
   * override {@link #disposeInternal} in order to delete references to COM
   * objects, DOM nodes, and other disposable objects.
   *
   * @return {void} Nothing.
   */
  goog.Disposable.prototype.dispose = function() {
    if (!this.disposed_) {
      // Set disposed_ to true first, in case during the chain of disposal this
      // gets disposed recursively.
      this.disposed_ = true;
      this.disposeInternal();
      // LB: ENABLE_MONITORING is false
      //if (goog.Disposable.ENABLE_MONITORING) {
      //  var uid = goog.getUid(this);
      //  if (!goog.Disposable.instances_.hasOwnProperty(uid)) {
      //    throw Error(this + ' did not call the goog.Disposable base ' +
      //        'constructor or was disposed of after a clearUndisposedObjects ' +
      //        'call');
      //  }
      //  delete goog.Disposable.instances_[uid];
      //}
    }
  };

  /**
   * Deletes or nulls out any references to COM objects, DOM nodes, or other
   * disposable objects. Classes that extend {@code goog.Disposable} should
   * override this method.  For example:
   *

   *   mypackage.MyClass = function() {
   *     goog.Disposable.call(this);
   *     // Constructor logic specific to MyClass.
   *     ...
   *   };
   *   goog.inherits(mypackage.MyClass, goog.Disposable);
   *
   *   mypackage.MyClass.prototype.disposeInternal = function() {
   *     mypackage.MyClass.superClass_.disposeInternal.call(this);
   *     // Dispose logic specific to MyClass.
   *     ...
   *   };
   *

   * @protected
   */
  goog.Disposable.prototype.disposeInternal = function() {
    // No-op in the base class.
  };

  /**
   * Calls {@code dispose} on the argument if it supports it. If obj is not an
   *     object with a dispose() method, this is a no-op.
   * @param {*} obj The object to dispose of.
   */
  goog.dispose = function(obj) {
    if (obj && typeof obj.dispose == 'function') {
      obj.dispose();
    }
  };

  return goog.Disposable;
});
<commit_msg>Fixed typo: replaced defien with define<commit_after>// Copyright 2005 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Modifications Copyright 2010-2011 Legal-Box SAS, All Rights Reserved
// Licensed under the BSD License - http://creativecommons.org/licenses/BSD/
// * renamed file from goog/disposable/disposable.js to goog.Disposable.js
// * commented requirement for interface goog.disposable.IDisposable
// * commented out conditional code that runs when ENABLE_MONITORING is true
//   (always false here)
// * wrapped code in a function in a call to define for dependency management
//   using requireJS

/**
 * @fileoverview Implements the disposable interface. The dispose method is used
 * to clean up references and resources.
 */
define(["./goog"], function(goog){

  goog.provide('goog.Disposable');
  goog.provide('goog.dispose');

  // LB: unused (interface definition)
  // goog.require('goog.disposable.IDisposable');

  /**
   * Class that provides the basic implementation for disposable objects. If your
   * class holds one or more references to COM objects, DOM nodes, or other
   * disposable objects, it should extend this class or implement the disposable
   * interface (defined in goog.disposable.IDisposable).
   * @constructor
   * @implements {goog.disposable.IDisposable}
   */
  goog.Disposable = function() {
    // LB: ENABLE_MONITORING is false
    // if (goog.Disposable.ENABLE_MONITORING) {
    //   goog.Disposable.instances_[goog.getUid(this)] = this;
    // }
  };

  /**
   * @define {boolean} Whether to enable the monitoring of the goog.Disposable
   *     instances. Switching on the monitoring is only recommended for debugging
   *     because it has a significant impact on performance and memory usage.
   *     If switched off, the monitoring code compiles down to 0 bytes.
   *     The monitoring expects that all disposable objects call the
   *     {@code goog.Disposable} base constructor.
   */
  goog.Disposable.ENABLE_MONITORING = false;

  /**
   * Maps the unique ID of every undisposed {@code goog.Disposable} object to
   * the object itself.
   * @type {!Object.<number, !goog.Disposable>}
   * @private
   */
  goog.Disposable.instances_ = {};

  /**
   * @return {!Array.<!goog.Disposable>} All {@code goog.Disposable} objects that
   *     haven't been disposed of.
   */
  goog.Disposable.getUndisposedObjects = function() {
    var ret = [];
    for (var id in goog.Disposable.instances_) {
      if (goog.Disposable.instances_.hasOwnProperty(id)) {
        ret.push(goog.Disposable.instances_[Number(id)]);
      }
    }
    return ret;
  };

  /**
   * Clears the registry of undisposed objects but doesn't dispose of them.
   */
  goog.Disposable.clearUndisposedObjects = function() {
    goog.Disposable.instances_ = {};
  };

  /**
   * Whether the object has been disposed of.
   * @type {boolean}
   * @private
   */
  goog.Disposable.prototype.disposed_ = false;

  /**
   * @return {boolean} Whether the object has been disposed of.
   */
  goog.Disposable.prototype.isDisposed = function() {
    return this.disposed_;
  };

  /**
   * @return {boolean} Whether the object has been disposed of.
   * @deprecated Use {@link #isDisposed} instead.
   */
  goog.Disposable.prototype.getDisposed = goog.Disposable.prototype.isDisposed;

  /**
   * Disposes of the object. If the object hasn't already been disposed of, calls
   * {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should
   * override {@link #disposeInternal} in order to delete references to COM
   * objects, DOM nodes, and other disposable objects.
   *
   * @return {void} Nothing.
   */
  goog.Disposable.prototype.dispose = function() {
    if (!this.disposed_) {
      // Set disposed_ to true first, in case during the chain of disposal this
      // gets disposed recursively.
      this.disposed_ = true;
      this.disposeInternal();
      // LB: ENABLE_MONITORING is false
      //if (goog.Disposable.ENABLE_MONITORING) {
      //  var uid = goog.getUid(this);
      //  if (!goog.Disposable.instances_.hasOwnProperty(uid)) {
      //    throw Error(this + ' did not call the goog.Disposable base ' +
      //        'constructor or was disposed of after a clearUndisposedObjects ' +
      //        'call');
      //  }
      //  delete goog.Disposable.instances_[uid];
      //}
    }
  };

  /**
   * Deletes or nulls out any references to COM objects, DOM nodes, or other
   * disposable objects. Classes that extend {@code goog.Disposable} should
   * override this method.  For example:
   *

   *   mypackage.MyClass = function() {
   *     goog.Disposable.call(this);
   *     // Constructor logic specific to MyClass.
   *     ...
   *   };
   *   goog.inherits(mypackage.MyClass, goog.Disposable);
   *
   *   mypackage.MyClass.prototype.disposeInternal = function() {
   *     mypackage.MyClass.superClass_.disposeInternal.call(this);
   *     // Dispose logic specific to MyClass.
   *     ...
   *   };
   *

   * @protected
   */
  goog.Disposable.prototype.disposeInternal = function() {
    // No-op in the base class.
  };

  /**
   * Calls {@code dispose} on the argument if it supports it. If obj is not an
   *     object with a dispose() method, this is a no-op.
   * @param {*} obj The object to dispose of.
   */
  goog.dispose = function(obj) {
    if (obj && typeof obj.dispose == 'function') {
      obj.dispose();
    }
  };

  return goog.Disposable;
});
<|endoftext|>


<commit_before>import React, {PropTypes} from 'react';
import {Motion, spring} from 'react-motion';

/*
  Higher-order component (HOC) that uses the PropsProxy pattern
  (https://medium.com/@franleplant/react-higher-order-components-in-depth-cf9032ee6c3e)
  to wrap the provided WrappedComponent to simplify animation using ReactMotion.

  This HOC provides the following to the WrappedComponent:
  - wraps it in a
 with class "animated-component-container"
  - applies the provided/default spring properties to all properties of the targetStyle
  - combines the initialStyle into the targetStyle so that unchanged properties
    don't have to be specified in the targetStyle
  - sets an 'isComplete' instance variable to true when the motion first completes
  - once the motion is complete, subsequent renders simply render the WrappedComponent
    in its target state without further animation. This allows animations at rest to
    respond immediately to window resize events, for instance.
 */
export default function animateSpring(stiffness=120, damping=25) {

  return function(WrappedComponent) {
    return class extends React.Component {

      static propTypes = {
        key: PropTypes.string,
        initialStyle: PropTypes.object.isRequired,
        targetStyle: PropTypes.object.isRequired,
        onRest: PropTypes.func
      }

      handleRest = (...args) => {
        if (this.props.onRest)
          this.props.onRest(...args);

        this.isComplete = true;
      }

      render() {
        const springConfig = { stiffness, damping },
              { key, initialStyle, targetStyle, ...otherProps } = this.props,
              // combine the styles with target properties overriding initial properties
              staticStyle = {...initialStyle, ...targetStyle};
        let style = {}, prop;
        // apply spring to every property in the targetStyle
        for (prop in targetStyle) {
          style[prop] = spring(targetStyle[prop], springConfig);
        }
        return (
          this.isComplete
            ? <div key={`static-${key}`} className="animated-component-container" style={staticStyle}>
                <WrappedComponent style={staticStyle} {...otherProps}/>

            : <Motion key={`motion-${key}`} defaultStyle={initialStyle} style={style} onRest={this.handleRest}>
                {
                  interpolatedStyle => {
                    const combinedStyle = {...initialStyle, ...interpolatedStyle};
                    return (

                        <WrappedComponent style={combinedStyle} {...otherProps}/>

                    );
                  }
                }
              </Motion>
        );
      }
    };
  };
}
<commit_msg>Limit animation duration to half a second - the tail end of a spring animation involves very slow movement that doesn’t count as “complete” until speed is zero.<commit_after>import React, {PropTypes} from 'react';
import {Motion, spring} from 'react-motion';

/*
  Higher-order component (HOC) that uses the PropsProxy pattern
  (https://medium.com/@franleplant/react-higher-order-components-in-depth-cf9032ee6c3e)
  to wrap the provided WrappedComponent to simplify animation using ReactMotion.

  This HOC provides the following to the WrappedComponent:
  - wraps it in a
 with class "animated-component-container"
  - applies the provided/default spring properties to all properties of the targetStyle
  - combines the initialStyle into the targetStyle so that unchanged properties
    don't have to be specified in the targetStyle
  - sets an 'isComplete' instance variable to true when the motion first completes
  - once the motion is complete, subsequent renders simply render the WrappedComponent
    in its target state without further animation. This allows animations at rest to
    respond immediately to window resize events, for instance.
 */
export default function animateSpring(stiffness=115, damping=18) {

  return function(WrappedComponent) {
    return class extends React.Component {
      componentDidMount() {
        this.fixedAnimationDuration = window.setInterval(() => {
          if (!this.isComplete) {
            this.handleRest();
          }
          window.clearInterval(this.fixedAnimationDuration);
        }, 500);
      }

      static propTypes = {
        key: PropTypes.string,
        initialStyle: PropTypes.object.isRequired,
        targetStyle: PropTypes.object.isRequired,
        onRest: PropTypes.func,
      }

      handleRest = (...args) => {
        if (this.props.onRest)
          this.props.onRest(...args);

        this.isComplete = true;
      }

      render() {
        const springConfig = { stiffness, damping },
              { key, initialStyle, targetStyle, ...otherProps } = this.props,
              // combine the styles with target properties overriding initial properties
              staticStyle = {...initialStyle, ...targetStyle};
        let style = {}, prop;
        // apply spring to every property in the targetStyle
        for (prop in targetStyle) {
          style[prop] = spring(targetStyle[prop], springConfig);
        }
        return (
          this.isComplete
            ? <div key={`static-${key}`} className="animated-component-container" style={staticStyle}>
                <WrappedComponent style={staticStyle} {...otherProps}/>

            : <Motion key={`motion-${key}`} defaultStyle={initialStyle} style={style} onRest={this.handleRest}>
                {
                  interpolatedStyle => {
                    const combinedStyle = {...initialStyle, ...interpolatedStyle};
                    return (

                        <WrappedComponent style={combinedStyle} {...otherProps}/>

                    );
                  }
                }
              </Motion>
        );
      }
    };
  };
}
<|endoftext|>


<commit_before>var fs = require('fs');

var App = function (httpServer, expressServer, sessionParser, request, response) {
	this._init(httpServer, expressServer, sessionParser, request, response);
};
App.prototype = {
	_allowedSessionIds: {},
	_httpServer: null,
	_expressServer: null,
	_init: function (httpServer, expressServer, sessionParser, request, response) {
		this._httpServer = httpServer;
		this._expressServer = expressServer;
		this._sessionParser = sessionParser;
	},
	httpRequestHandler: function (request, response, callback) {
		this._completeWholeRequestInfo(request, function (requestInfo) {

			var staticHtmlFileFullPath = __dirname + '/../static-content/index.html';
			fs.readFile(staticHtmlFileFullPath, 'utf8', function (err,data) {
				if (err) {
					console.log(err);
					return callback();
				}
				response.send(data.replace(/%requestPath/g, requestInfo.url));
				callback();
			});

		}.bind(this));
	},
	_completeWholeRequestInfo: function (request, callback) {
        var reqInfo = {
            url: request.url,
            method: request.method,
            headers: request.headers,
            statusCode: request.statusCode,
            textBody: ''
        };
        var bodyArr = [];
        request.on('error', function (err) {
            console.error(err);
        }).on('data', function (chunk) {
            bodyArr.push(chunk);
        }).on('end', function () {
            reqInfo.textBody = Buffer.concat(bodyArr).toString();
            reqInfo.request = request;
            callback(reqInfo);
        }.bind(this));
    }
};

module.exports = App;<commit_msg>Update index.js<commit_after>var fs = require('fs');

/**
 * @summary	Constructor, called only for first time, when there is default directory request with index.js
 		file inside and there is necessary to create instance of this `module.exports` content to call
		`instance.httpRequestHandler` method to dispatch http request. If there is detected any file change
		inside this file, `web-deb-server` module automaticly reload content of this file and it creates
		instance and call this constructor again automaticly, the same behaviour if there is any catched error
		in `httpRequestHandler` execution - this file and constructor is loaded and called again - to develop more comfortably.
 * @param {http}		http 		used node http module instance
 * @param {express}		express 	used node express module instance
 * @param {sessionParser}	sessionParser	used node sessionParser module instance
 * @param {request}		request		current http request object
 * @param {response}		response	current http response object
 * @return void
 */
var App = function (http, express, sessionParser, request, response) {
	this._httpServer = httpServer;
	this._expressServer = expressServer;
	this._sessionParser = sessionParser;
};
App.prototype = {
	/**
	 * @summary 	Method called each request to dispatch request for default directory content containing
	 *		`index,js` file (also for first time after constructor).
	 * @param {request}	request		current http request object
	 * @param {response}	response 	current http response object
	 * @param {function}	callback 	callback to do any other node.js operations
	 * @return void
	 */
	httpRequestHandler: function (request, response, callback) {
		this._completeWholeRequestInfo(request, function (requestInfo) {

			// some demo operation to say hallo world:
			var staticHtmlFileFullPath = __dirname + '/../static-content/index.html';
			fs.readFile(staticHtmlFileFullPath, 'utf8', function (err,data) {
				if (err) {
					console.log(err);
					return callback();
				}
				response.send(data.replace(/%requestPath/g, requestInfo.url));
				callback();
			});

		}.bind(this));
	},
	/**
	 * @summary	Complete whole request body to operate with it later properly (encode json data or anything else...)
	 * @param	{request}	request		current http request
	 * @param	{function}	callback	callback to execute after whole request body is loaded or request loading failed
	 * @return	void
	 */
	_completeWholeRequestInfo: function (request, callback) {
        	var reqInfo = {
            		url: request.url,
            		method: request.method,
            		headers: request.headers,
            		statusCode: request.statusCode,
            		textBody: ''
        	};
        	var bodyArr = [];
        	request.on('error', function (err) {
            		console.error(err);
        	}).on('data', function (chunk) {
            		bodyArr.push(chunk);
        	}).on('end', function () {
            		reqInfo.textBody = Buffer.concat(bodyArr).toString();
            		reqInfo.request = request;
            		callback(reqInfo);
        	}.bind(this));
	}
};

module.exports = App;
<|endoftext|>


<commit_before>(function () {

  var five = function() { return 5; };

  five.upHigh = function() { return '⁵'; };
  five.downLow = function() { return '₅'; };
  five.roman = function() { return 'V'; };

  five.arabic = function() { return 'خمسة' };
  five.croatian = function() { return 'pet' };
  five.czech = function() { return 'pět' };
  five.english = function() { return 'Five' };
  five.french = function() { return 'cinq' };
  five.german = function() { return 'fünf' };
  five.irish = function() { return 'cúig' };
  five.mongolian = function() { return 'таван' };
  five.polish = function() { return 'pięć' };
  five.slovenian = function() { return 'pet' };
  five.swedish = function() { return 'fem' };
  five.thai = function() { return 'ห้า' };
  five.choctaw = function() { return 'tahlapi' };
  five.piglatin = function() { return 'ivefay' };

  five.morseCode = function() { return 'di-di-di-di-dit' };
  five.binary = function() { return '101'; };
  five.octal = function() { return '5'; };

  five.tooSlow = function() {
    var returnIn = new Date(new Date().valueOf() + 555);

    do {} while(new Date() < returnIn);

    return five();
  };

  five.map = function(array) { return array.map(five); }
  five.reduce = function(array) { return array.reduce(five); }

  five.fab = function() {
    return
      ["Juwan Howard","Ray Jackson","Jimmy King","Jalen Rose","Chris Weber"];
  };

  if(typeof module !== 'undefined' && module.exports) {
    module.exports = five;
  } else if (window) {
    window.five = five;
  }
}());
<commit_msg>test spelling<commit_after>(function () {

  var five = function() { return 5; };

  five.upHigh = function() { return '⁵'; };
  five.downLow = function() { return '₅'; };
  five.roman = function() { return 'V'; };

  five.arabic = function() { return 'خمسة' };
  five.croatian = function() { return 'pet' };
  five.czech = function() { return 'pět' };
  five.english = function() { return 'Five' };
  five.french = function() { return 'cinq' };
  five.german = function() { return 'fünf' };
  five.irish = function() { return 'cúig' };
  five.mongolian = function() { return 'таван' };
  five.polish = function() { return 'pięć' };
  five.slovenian = function() { return 'pet' };
  five.swedish = function() { return 'fem' };
  five.thai = function() { return 'ห้า' };
  five.choctaw = function() { return 'tahlapi' };
  five.piglatin = function() { return 'ivefay' };

  five.morseCode = function() { return 'di-di-di-di-dit' };
  five.binary = function() { return '101'; };
  five.octal = function() { return '5'; };

  five.tooSlow = function() {
    var returnIn = new Date(new Date().valueOf() + 555);

    do {} while(new Date() < returnIn);

    return five();
  };

  five.map = function(array) { return array.map(five); }
  five.reduce = function(array) { return array.reduce(five); }

  five.fab = function() {
    return
      ["Juwan Howard","Ray Jackson","Jimmy King","Jalen Rose","Chris Weber"];
  };

  if(typeof module !== 'undefined' && module.exports) {
    module.exports = five;
  } else if (window) {
    window.five = five;
  }
}());
<|endoftext|>


<commit_before>(function () {

  var five = function() { return 5; };

  five.upHigh = function() { return '⁵'; };
  five.downLow = function() { return '₅'; };
  five.roman = function() { return 'V'; };

  five.convertTo = function(anotherNumber) {
    // If you need other numbers I'd strongly suggest you call
    // this function when your app starts up and cache the result.
    var oneFifthOfFive = five() / five();

    while(anotherNumber < oneFifthOfFive) {
      anotherNumber += oneFifthOfFive;
    }

    return anotherNumber;
  };

  five.arabic = function() { return 'خمسة'; };
  five.azerbaijani = function() { return 'beş'; };
  five.basque = function() { return 'bost'; };
  five.bosnian = function() { return 'pet'; };
  five.bulgarian = function() { return 'пет'; };
  five.catalan = function() { return 'cinc'; };
  five.chinese = function() { return '五'; };
  five.choctaw = function() { return 'tahlapi'; };
  five.croatian = function() { return 'pet'; };
  five.czech = function() { return 'pět'; };
  five.dovah = function() { return 'hen'; };
  five.dutch = function() { return 'vijf'; };
  five.elvish = function() { return 'lempe'; };
  five.english = function() { return 'five'; };
  five.finnish = function() { return 'viisi'; };
  five.french = function() { return 'cinq'; };
  five.german = function() { return 'fünf'; };
  five.hebrew = function() { return 'חמש'; };
  five.hindi = function() { return 'पांच'; };
  five.hungarian = function() { return 'öt'; };
  five.indonesian = function() { return 'lima'; };
  five.irish = function() { return 'cúig'; };
  five.italian = function() { return 'cinque'; };
  five.japanese = function() { return '五'; };
  five.kannada = function() { return 'ಐದು'; };
  five.klingon = function() { return 'vagh'; };
  five.korean = function() { return '오'; };
  five.latin = function() { return 'quinque'; };
  five.latvian = function() { return 'pieci'; };
  five.mongolian = function() { return 'таван'; };
  five.norwegian = function() { return 'fem'; };
  five.persian = function() { return 'پنج'; };
  five.piglatin = function() { return 'ivefay'; };
  five.polish = function() { return 'pięć'; };
  five.portuguese = function () { return 'cinco'; };
  five.romanian = function() { return 'cinci'; };
  five.russian = function() { return 'пять'; };
  five.serbian = function() { return 'pet'; };
  five.slovakian = function() { return 'päť'; };
  five.slovenian = function() { return 'pet'; };
  five.spanish = function() { return 'cinco'; };
  five.swedish = function() { return 'fem'; };
  five.tamil = function() { return 'ஐந்து'; };
  five.telugu = function() { return 'ఐదు'; };
  five.turkish = function() { return 'beş'; };
  five.thai = function() { return 'ห้า'; };
  five.ukrainian = function() { return 'п’ять'; };
  five.welsh = function() { return 'pump'; };

  five.morseCode = function() { return 'di-di-di-di-dit'; };
  five.binary = function() { return '101'; };
  five.octal = function() { return '5'; };
  five.hex = function() { return '5'; };

  five.negative = function() { return -5; };
  five.loud = function() { return 'FIVE'; };
  five.smooth = function() { return 'S'; };

  five.tooSlow = function() {
    var returnIn = new Date(new Date().valueOf() + 555);

    do {} while(new Date() < returnIn);

    return five();
  };

  five.map = function(array) { return array.map(five); };
  five.reduce = function(array) { return array.reduce(five); };

  five.fab = function() {
    return ['Juwan Howard','Ray Jackson','Jimmy King','Jalen Rose','Chris Webber'];
  };

  five.async = function(callback) {
    process.nextTick(function() {
      callback(null, 5);
    });
  };

  five.rot = function(word) {
    if(typeof(word) != 'string') {
      return word;
    }
    function replaceLetter(z) {
      if('0' <= z && z <= '9') {
        return ((parseInt(z)+5)%10).toString();
      }
      var aLetter = (z <= 'Z' ? 'A': 'a').charCodeAt(0);
      var x = 5 + z.charCodeAt(0) - aLetter;
      x %= 26;
      return String.fromCharCode(x+aLetter);
    }
    return word.replace(/[a-zA-Z0-9]/g, replaceLetter);
  };

  five.valueOf = five;

  if(typeof module !== 'undefined' && module.exports) {
    module.exports = five;
  } else if (window) {
    window.five = five;
  }
}());
<commit_msg>Ack! Used 5 instead of five()<commit_after>(function () {

  var five = function() { return 5; };

  five.upHigh = function() { return '⁵'; };
  five.downLow = function() { return '₅'; };
  five.roman = function() { return 'V'; };

  five.convertTo = function(anotherNumber) {
    // If you need other numbers I'd strongly suggest you call
    // this function when your app starts up and cache the result.
    var oneFifthOfFive = five() / five();

    while(anotherNumber < oneFifthOfFive) {
      anotherNumber += oneFifthOfFive;
    }

    return anotherNumber;
  };

  five.arabic = function() { return 'خمسة'; };
  five.azerbaijani = function() { return 'beş'; };
  five.basque = function() { return 'bost'; };
  five.bosnian = function() { return 'pet'; };
  five.bulgarian = function() { return 'пет'; };
  five.catalan = function() { return 'cinc'; };
  five.chinese = function() { return '五'; };
  five.choctaw = function() { return 'tahlapi'; };
  five.croatian = function() { return 'pet'; };
  five.czech = function() { return 'pět'; };
  five.dovah = function() { return 'hen'; };
  five.dutch = function() { return 'vijf'; };
  five.elvish = function() { return 'lempe'; };
  five.english = function() { return 'five'; };
  five.finnish = function() { return 'viisi'; };
  five.french = function() { return 'cinq'; };
  five.german = function() { return 'fünf'; };
  five.hebrew = function() { return 'חמש'; };
  five.hindi = function() { return 'पांच'; };
  five.hungarian = function() { return 'öt'; };
  five.indonesian = function() { return 'lima'; };
  five.irish = function() { return 'cúig'; };
  five.italian = function() { return 'cinque'; };
  five.japanese = function() { return '五'; };
  five.kannada = function() { return 'ಐದು'; };
  five.klingon = function() { return 'vagh'; };
  five.korean = function() { return '오'; };
  five.latin = function() { return 'quinque'; };
  five.latvian = function() { return 'pieci'; };
  five.mongolian = function() { return 'таван'; };
  five.norwegian = function() { return 'fem'; };
  five.persian = function() { return 'پنج'; };
  five.piglatin = function() { return 'ivefay'; };
  five.polish = function() { return 'pięć'; };
  five.portuguese = function () { return 'cinco'; };
  five.romanian = function() { return 'cinci'; };
  five.russian = function() { return 'пять'; };
  five.serbian = function() { return 'pet'; };
  five.slovakian = function() { return 'päť'; };
  five.slovenian = function() { return 'pet'; };
  five.spanish = function() { return 'cinco'; };
  five.swedish = function() { return 'fem'; };
  five.tamil = function() { return 'ஐந்து'; };
  five.telugu = function() { return 'ఐదు'; };
  five.turkish = function() { return 'beş'; };
  five.thai = function() { return 'ห้า'; };
  five.ukrainian = function() { return 'п’ять'; };
  five.welsh = function() { return 'pump'; };

  five.morseCode = function() { return 'di-di-di-di-dit'; };
  five.binary = function() { return '101'; };
  five.octal = function() { return '5'; };
  five.hex = function() { return '5'; };

  five.negative = function() { return -5; };
  five.loud = function() { return 'FIVE'; };
  five.smooth = function() { return 'S'; };

  five.tooSlow = function() {
    var returnIn = new Date(new Date().valueOf() + 555);

    do {} while(new Date() < returnIn);

    return five();
  };

  five.map = function(array) { return array.map(five); };
  five.reduce = function(array) { return array.reduce(five); };

  five.fab = function() {
    return ['Juwan Howard','Ray Jackson','Jimmy King','Jalen Rose','Chris Webber'];
  };

  five.async = function(callback) {
    process.nextTick(function() {
      callback(null, five());
    });
  };

  five.rot = function(word) {
    if(typeof(word) != 'string') {
      return word;
    }
    function replaceLetter(z) {
      if('0' <= z && z <= '9') {
        return ((parseInt(z)+5)%10).toString();
      }
      var aLetter = (z <= 'Z' ? 'A': 'a').charCodeAt(0);
      var x = 5 + z.charCodeAt(0) - aLetter;
      x %= 26;
      return String.fromCharCode(x+aLetter);
    }
    return word.replace(/[a-zA-Z0-9]/g, replaceLetter);
  };

  five.valueOf = five;

  if(typeof module !== 'undefined' && module.exports) {
    module.exports = five;
  } else if (window) {
    window.five = five;
  }
}());
<|endoftext|>


<commit_before>//      Basilisk 0.1
//      A simple library for immutable state.
//
//      (c) 2012 Moo Print Ltd. under an MIT license
//      see http://github.com/moodev/basilisk

(function (root, factory) {
    if (typeof exports === 'object') {
        // Node. Does not work with strict CommonJS, but
        // only CommonJS-like enviroments that support module.exports,
        // like Node.
        module.exports = factory(require('underscore'));
    } else if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(['underscore'], factory);
    } else {
        // Browser globals
        root.basilisk = factory(root._);
    }
}(this, function (_) {
    "use strict";
    // bind to window or global, depending on environment.

    var b, basilisk = b = {};

    if (!_) {
        throw "Basilisk depends on underscore: please ensure that underscore is loaded first.";
    }

    // TODO we log watcher-failure and a few other events - they are considered
    //      "broken" behaviours.

    var log = function () { };
    if (window && window.console && window.console.log) {
        log = function () { window.console.log.apply(window.console, arguments); }
    }

    // Definitions
    // -----------
    //
    // Helpers for class definition:

    // whether defineProperty is available and functions according to ES5.1
    var defineAvailable = false,
        defineProperty = Object.defineProperty,
        _eg = {};

    // IE8 has a badly implemented version of defineProperty, so function detection
    // is insufficient.
    try {
        Object.defineProperty(_eg, 'x', {value:13, writable:false});
        try { _eg.x = 14; } catch (e2) {}
        defineAvailable = (_eg.x === 13);
    } catch (e) {
        defineAvailable = false;
    }

    if (defineAvailable) {
        Object.defineProperty(basilisk, 'isStrict', {
            value: true,
            writable: false,
            enumerable: true
        });
    } else {
        basilisk.isStrict = false;
    }

    // Definitions module.
    b.definitions = {};

    // Create a struct construcot.
    b.struct = function (properties) {
        var constructor,
            propList = _.extend({}, properties);

        // cannot have a property called with_ in the list.

        if (properties['with_']) {
            throw "You cannot have a property called with_ in your list: this is used within the Basilisk defition system.";
        }

        // generate the actual contructor.
        if (!defineAvailable) {
            constructor =  function (sample) {
                var self = this,
                    sample = sample || {},
                    origValues = _.extend({}, sample);

                // microoptimisation
                if (sample instanceof constructor) {
                    return sample;
                }

                if (!self instanceof constructor) {
                    throw "Object must be instantiated with new.";
                }

                // we don't actually have any guarantee of immutability
                // in this scenario: we will have to rely on failure modes
                // being caught in modern browsers.
                _.each(propList, function (value, key) {
                    var valueFn = value.filter || _.identity;
                    self[key] = valueFn(sample[key] || undefined);
                });
            };
        } else {
            // create a fully immutable object chain.
            constructor = function (sample) {
                var self = this,
                    sample = sample || {};

                if (sample instanceof constructor) {
                    return sample;
                }

                if (!self instanceof constructor) {
                    throw "Object must be instantiated with new.";
                }

                _.each(propList, function (value, key) {
                    var valueFn = value.filter || _.identity;
                    Object.defineProperty(self, key, {
                        value: valueFn(sample[key] || undefined),
                        writable: false,
                        enumerable: true
                    });
                });
            };

        }

        // Create a new version of the object, with the specified "adjusted"
        // properties set to their specified values (and un-specified properties
        // set to their value in the current object.)
        constructor.prototype.with_ = function (adjustProperties) {
            // *we* are a perfect reference sample, since defineProperty
            // ensures immutability.
            var self = this,
                sample = {},
                changed = false;
            _.each(propList, function (value, key) {
                var valueFn = value.filter || undefined,
                    strictEqual = value.strictEqual || undefined,
                    rawValue,
                    value;

                if (Object.hasOwnProperty.call(adjustProperties, key)) {
                    rawValue = adjustProperties[key];

                    if (valueFn) {
                        value = valueFn(rawValue);
                    } else {
                        value = rawValue;
                    }

                    if (strictEqual) {
                        changed = changed || !strictEqual(value, self[key]);
                    } else {
                        changed = changed || (value !== self[key]);
                    }

                    sample[key] = value;
                } else {
                    sample[key] = self[key];
                }
            });

            if (!changed) { return self; }
            return new constructor(sample);
        }

        // add a properties object, with the original properties defined.
        constructor._properties = function () { return propList.slice(0, propList.length); };

        // TODO: handle definitions for complex objects.
        _.each(propList, function (value, key) {
            var withLabel = key;
            withLabel = withLabel[0].toUpperCase() + withLabel.slice(1, withLabel.length);
            withLabel = 'with' + withLabel;

            constructor.prototype[withLabel] = function (value) {
                var adjust = {};
                adjust[key] = value;
                return this.with_(adjust);
            }
        });

        return constructor;
    };

    basilisk.definitions.makeConstructor = b.struct;

    // some very simple property objects.  the float value is particularly useful.
    basilisk.properties = {
        float: {
            strictEquals: function (a, b) {
                return Math.abs(a - b) < 0.00001;
            }
        }
    }

    // Standard Watcher creation functions
    // ----
    //
    // A *lot* of watching boils down to some very simple patterns:
    //   - watch only when a specified property changes
    //   - watch only when a specified property (on a path) changes
    //   - watch for a change in a particular key in a dictionary.
    //
    // Rather than leave a lot of boilerplate lying around (and hopefully to allow
    // for optimisation and collapsing of functions), you can use the creation functions
    // below here to create new functions which can be used as watchers.

    b.watchers = {};

    // TODO these are very much first-pass implementations: replace with something
    // substantially more clever.

    // Watcher function for a dotted path inside a particular atom.
    // will call the "watcher" function with the "stemmed" properties
    // @return fn watching a particular path.
    b.watchers.path = function (path, watcher) {
        var parts = path.split('.'),
            // function to extract the specified path from the root.
            // WILL mutate the parts parameter.
            recur = function (parts, newVal, oldVal) {
                var first = parts.shift(),
                    newRest, oldRest;

                // if newval === oldval, there's no change so no chance of a watch.
                if (newVal === oldVal) {
                    return;
                }

                if (oldVal !== undefined && _.has(oldVal, first)) {
                    oldRest = oldVal[first];
                };

                if (newVal !== undefined && _.has(newVal, first)) {
                    newRest = newVal[first];
                }

                if (parts.length == 0) {
                    // this is the leaf: if we see a difference in value,
                    // apply it.

                    if (newRest !== oldRest) {
                        watcher(newRest, oldRest);
                    }
                } else {
                    recur(parts, newRest, oldRest);
                }
            };

        return function (newVal, oldVal) {
            recur(parts.slice(0, parts.length), newVal, oldVal);
        }
    }

    // Collections
    // -----------
    //
    // Very simple collection objects.  Not currently optimised for performance,
    // though that would not be exceptionally difficult to accomplish.

    b.collections = {};

    // we routinely have methods that are called once, with no arguments.
    // (eg. length, etc.). Since we're immutable, as long as we cache the result
    // on "this", we can easily make ourselves perpetually cached.

    var oncePerInstance = function (method, key) {
        // we store our value on "this", but with a long (probably unique) key...
        var storageKey = key || _.uniqueId('__basilisk-fn-oncePerInstance');

        return function () {
            var value;
            if (arguments.length > 0) {
                throw "Cannot supply any arguments to a once-per-instance function.";
            }
            if (!this.hasOwnProperty(storageKey)) {
                value = method.apply(this, []);
                if (defineAvailable) {
                    Object.defineProperty(this, storageKey, {
                        value: value,
                        writable: false,
                        enumerable: false
                    });
                } else {
                    this[storageKey] = value;
                }

            }
            return this[storageKey];
        }
    }

    // define basic datastructures for forward list (singly linked list)

    _.extend(b.collections, {
        ForwardListNode: basilisk.definitions.makeConstructor({
            rest: { noWith: true },
            value: {}
        }),
        // A simple list, with O(1) shift and unshift.  Suitable for simple stacks.
        ForwardList: basilisk.definitions.makeConstructor({
          head: {}
      })
    });

    b.collections.ForwardListNode.prototype.length = oncePerInstance(function () {
        if (this.rest === undefined) {
            return 1;
        } else {
            return 1 + this.rest.length();
        }
    }, '_length');

    // Instance methods on ForwardList.

    _.extend(b.collections.ForwardList.prototype, {
        // create a node with the specified value, and return a list with that as its head.
        // this is a little more expensive here, but it makes iteration in the empty case
        // simple.
        shift: function (value) {
            var self = this;
            return new b.collections.ForwardList({
                head: new b.collections.ForwardListNode({
                    rest: self.head,
                    value: value
                })
            });
        },

        length: oncePerInstance(function () {
            if (this.head === undefined) {
                return 0;
            } else {
                return this.head.length();
            }
        }, '_length'),

        // return a list without the head node,
        unshift: function () {
            var self = this,
            rest = undefined;

            if (self.head) {
                rest = self.head.rest;
            } else {
                return self;
            }

            return [this.head.value, new b.collections.ForwardList({
                head: rest
            })];
        },

        each: function (iterator, context) {
            var idx = 0,
            next = this.head;

            while (next !== undefined && next !== null) {
                iterator.apply(context, [next.value, idx, this, next]);
                idx += 1;
                next = next.rest;
            }
        },

        /**
         * Return a new ForwardList containing only those elements of this list for which
         * the iterator function returns a truthy value.
         *
         * @param filterFn a function taking (value, index, list, node) -> boolean
         * @return ForwardList
         */
         filter: function (filterFn, context)
         {
            var values = [],
            changedValue = false;

            this.each(function (value, idx, list, node) {
                if (filterFn.apply(this, arguments)) {
                    values.push(value);
                } else {
                    changedValue = true;
                }
            });

            if (!changedValue) {
                return this;
            } else {
                return b.collections.ForwardList.from(values);
            }
        },

        /**
         * Returns the first value that matches the specified filter function.
         */
         first: function (filterFn, context) {
            var idx = 0,
            filterFn = filterFn || function () { return true; },
            next = this.head;

            while (next !== undefined && next !== null) {
                if (filterFn.apply(context, [next.value, idx, this, next])) {
                    return next.value;
                }
                idx += 1;
                next = next.rest;
            }

            return undefined;
        }
    });

    // Factory method: given an array-like object or a forward list, return a forward list.
    b.collections.ForwardList.from = function (source) {
        if (source instanceof b.collections.ForwardList) {
            return source;
        } else {
            return _.reduceRight(source, function (memo, value) {
                return memo.shift(value);
            }, new b.collections.ForwardList({ head: null }));
        }
    }

    // Atoms provide a way to manage shared, synchronous, independent state.
    // http://clojure.org/atoms
    //
    // If supplied the validator must be a function (new, old) {} -> boolean,
    // returning true if the changed value is valid, and false if not.
    //
    // the value must be immutable.
    basilisk.Atom = function (initialValue, validator) {
        if (!this instanceof basilisk.Atom) { throw "Please instantiate each atom separately." }

        // Most state is held in closure, and thus can only be changed by these
        // privileged methods.

        var current,
            self = this,
            // TODO replace with a FixedVector.
            watchers = b.collections.ForwardList.from([]),
            // set the value if it passes the validator.
            _set = function (possible) {
                var old = current;
                if (possible !== current) {
                    if (!validator(possible, current)) {
                        throw "Value does not pass validator.";
                    }

                    current = possible;

                    watchers.each(function (watcher) {
                        try {
                            watcher(current, old);
                        } catch (e) {
                            // do nothing
                            log("Watcher threw exception: this behaviour is broken.");
                        }
                    });
                }

                return current;
            };

        validator = validator || function () { return true; };
        // we fail immediately if the initial value does not validate.

        _.extend(self, {
            // Retrieve the current value of the Atom.
            deref: function () { return current; },

            // Applies the given "change" function to the old state,
            // checks that the result passes the validator, and updates the current state.
            //
            // Will be called as swapFunction(old, *args);  The function should have no side-effects.
            //
            // Returns the new state or throws an exception.

            swap: function (swapFunction) {
                var possible, args = [current];

                if (arguments.length > 1) {
                    args.push.apply(args, _.rest(argument));
                }

                possible = swapFunction.apply(null, args);

                // update current, call watchers
                return this.compareAndSet(current, possible);
            },

            // If oldVal matches current, change to using newVal.
            // return true if changed, false if not changed.
            compareAndSet: function (oldVal, newVal) {
                if (oldVal === current) {
                    return (_set(newVal) === newVal);
                } else {
                    return false;
                }
            },

            // add a watcher.  Will be called if the value changes.
            addWatcher: function (watcher) {
                if (watchers.first(function (compare) { return compare === watcher; }) === undefined) {
                    watchers = watchers.shift(watcher);
                }
            },

            removeWatcher: function (watcher) {
                watchers = watchers.filter(function (compare) { return compare !== watcher; });
            },

            watchers: function () { return watchers },
        });

        // shorter alias for cas.
        this.cas = this.compareAndSet;

        // set the initial state.
        _set(initialValue);
    };

    return basilisk;
}));
<commit_msg>properly detect failed instantiation<commit_after>//      Basilisk 0.1
//      A simple library for immutable state.
//
//      (c) 2012 Moo Print Ltd. under an MIT license
//      see http://github.com/moodev/basilisk

(function (root, factory) {
    if (typeof exports === 'object') {
        // Node. Does not work with strict CommonJS, but
        // only CommonJS-like enviroments that support module.exports,
        // like Node.
        module.exports = factory(require('underscore'));
    } else if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(['underscore'], factory);
    } else {
        // Browser globals
        root.basilisk = factory(root._);
    }
}(this, function (_) {
    "use strict";
    // bind to window or global, depending on environment.

    var b, basilisk = b = {};

    if (!_) {
        throw "Basilisk depends on underscore: please ensure that underscore is loaded first.";
    }

    // TODO we log watcher-failure and a few other events - they are considered
    //      "broken" behaviours.

    var log = function () { };
    if (window && window.console && window.console.log) {
        log = function () { window.console.log.apply(window.console, arguments); }
    }

    // Definitions
    // -----------
    //
    // Helpers for class definition:

    // whether defineProperty is available and functions according to ES5.1
    var defineAvailable = false,
        defineProperty = Object.defineProperty,
        _eg = {};

    // IE8 has a badly implemented version of defineProperty, so function detection
    // is insufficient.
    try {
        Object.defineProperty(_eg, 'x', {value:13, writable:false});
        try { _eg.x = 14; } catch (e2) {}
        defineAvailable = (_eg.x === 13);
    } catch (e) {
        defineAvailable = false;
    }

    if (defineAvailable) {
        Object.defineProperty(basilisk, 'isStrict', {
            value: true,
            writable: false,
            enumerable: true
        });
    } else {
        basilisk.isStrict = false;
    }

    // Definitions module.
    b.definitions = {};

    // Create a struct construcot.
    b.struct = function (properties) {
        var constructor,
            propList = _.extend({}, properties);

        // cannot have a property called with_ in the list.

        if (properties['with_']) {
            throw "You cannot have a property called with_ in your list: this is used within the Basilisk defition system.";
        }

        // generate the actual contructor.
        if (!defineAvailable) {
            constructor =  function (sample) {
                var self = this,
                    sample = sample || {},
                    origValues = _.extend({}, sample);

                // microoptimisation
                if (sample instanceof constructor) {
                    return sample;
                }

                if (!(self instanceof constructor)) {
                    throw "Object must be instantiated with new.";
                }

                // we don't actually have any guarantee of immutability
                // in this scenario: we will have to rely on failure modes
                // being caught in modern browsers.
                _.each(propList, function (value, key) {
                    var valueFn = value.filter || _.identity;
                    self[key] = valueFn(sample[key] || undefined);
                });
            };
        } else {
            // create a fully immutable object chain.
            constructor = function (sample) {
                var self = this,
                    sample = sample || {};

                if (sample instanceof constructor) {
                    return sample;
                }

                if (!(self instanceof constructor)) {
                    throw "Object must be instantiated with new.";
                }

                _.each(propList, function (value, key) {
                    var valueFn = value.filter || _.identity;
                    Object.defineProperty(self, key, {
                        value: valueFn(sample[key] || undefined),
                        writable: false,
                        enumerable: true
                    });
                });
            };

        }

        // Create a new version of the object, with the specified "adjusted"
        // properties set to their specified values (and un-specified properties
        // set to their value in the current object.)
        constructor.prototype.with_ = function (adjustProperties) {
            // *we* are a perfect reference sample, since defineProperty
            // ensures immutability.
            var self = this,
                sample = {},
                changed = false;
            _.each(propList, function (value, key) {
                var valueFn = value.filter || undefined,
                    strictEqual = value.strictEqual || undefined,
                    rawValue,
                    value;

                if (Object.hasOwnProperty.call(adjustProperties, key)) {
                    rawValue = adjustProperties[key];

                    if (valueFn) {
                        value = valueFn(rawValue);
                    } else {
                        value = rawValue;
                    }

                    if (strictEqual) {
                        changed = changed || !strictEqual(value, self[key]);
                    } else {
                        changed = changed || (value !== self[key]);
                    }

                    sample[key] = value;
                } else {
                    sample[key] = self[key];
                }
            });

            if (!changed) { return self; }
            return new constructor(sample);
        }

        // add a properties object, with the original properties defined.
        constructor._properties = function () { return propList.slice(0, propList.length); };

        // TODO: handle definitions for complex objects.
        _.each(propList, function (value, key) {
            var withLabel = key;
            withLabel = withLabel[0].toUpperCase() + withLabel.slice(1, withLabel.length);
            withLabel = 'with' + withLabel;

            constructor.prototype[withLabel] = function (value) {
                var adjust = {};
                adjust[key] = value;
                return this.with_(adjust);
            }
        });

        return constructor;
    };

    basilisk.definitions.makeConstructor = b.struct;

    // some very simple property objects.  the float value is particularly useful.
    basilisk.properties = {
        float: {
            strictEquals: function (a, b) {
                return Math.abs(a - b) < 0.00001;
            }
        }
    }

    // Standard Watcher creation functions
    // ----
    //
    // A *lot* of watching boils down to some very simple patterns:
    //   - watch only when a specified property changes
    //   - watch only when a specified property (on a path) changes
    //   - watch for a change in a particular key in a dictionary.
    //
    // Rather than leave a lot of boilerplate lying around (and hopefully to allow
    // for optimisation and collapsing of functions), you can use the creation functions
    // below here to create new functions which can be used as watchers.

    b.watchers = {};

    // TODO these are very much first-pass implementations: replace with something
    // substantially more clever.

    // Watcher function for a dotted path inside a particular atom.
    // will call the "watcher" function with the "stemmed" properties
    // @return fn watching a particular path.
    b.watchers.path = function (path, watcher) {
        var parts = path.split('.'),
            // function to extract the specified path from the root.
            // WILL mutate the parts parameter.
            recur = function (parts, newVal, oldVal) {
                var first = parts.shift(),
                    newRest, oldRest;

                // if newval === oldval, there's no change so no chance of a watch.
                if (newVal === oldVal) {
                    return;
                }

                if (oldVal !== undefined && _.has(oldVal, first)) {
                    oldRest = oldVal[first];
                };

                if (newVal !== undefined && _.has(newVal, first)) {
                    newRest = newVal[first];
                }

                if (parts.length == 0) {
                    // this is the leaf: if we see a difference in value,
                    // apply it.

                    if (newRest !== oldRest) {
                        watcher(newRest, oldRest);
                    }
                } else {
                    recur(parts, newRest, oldRest);
                }
            };

        return function (newVal, oldVal) {
            recur(parts.slice(0, parts.length), newVal, oldVal);
        }
    }

    // Collections
    // -----------
    //
    // Very simple collection objects.  Not currently optimised for performance,
    // though that would not be exceptionally difficult to accomplish.

    b.collections = {};

    // we routinely have methods that are called once, with no arguments.
    // (eg. length, etc.). Since we're immutable, as long as we cache the result
    // on "this", we can easily make ourselves perpetually cached.

    var oncePerInstance = function (method, key) {
        // we store our value on "this", but with a long (probably unique) key...
        var storageKey = key || _.uniqueId('__basilisk-fn-oncePerInstance');

        return function () {
            var value;
            if (arguments.length > 0) {
                throw "Cannot supply any arguments to a once-per-instance function.";
            }
            if (!this.hasOwnProperty(storageKey)) {
                value = method.apply(this, []);
                if (defineAvailable) {
                    Object.defineProperty(this, storageKey, {
                        value: value,
                        writable: false,
                        enumerable: false
                    });
                } else {
                    this[storageKey] = value;
                }

            }
            return this[storageKey];
        }
    }

    // define basic datastructures for forward list (singly linked list)

    _.extend(b.collections, {
        ForwardListNode: basilisk.definitions.makeConstructor({
            rest: { noWith: true },
            value: {}
        }),
        // A simple list, with O(1) shift and unshift.  Suitable for simple stacks.
        ForwardList: basilisk.definitions.makeConstructor({
          head: {}
      })
    });

    b.collections.ForwardListNode.prototype.length = oncePerInstance(function () {
        if (this.rest === undefined) {
            return 1;
        } else {
            return 1 + this.rest.length();
        }
    }, '_length');

    // Instance methods on ForwardList.

    _.extend(b.collections.ForwardList.prototype, {
        // create a node with the specified value, and return a list with that as its head.
        // this is a little more expensive here, but it makes iteration in the empty case
        // simple.
        shift: function (value) {
            var self = this;
            return new b.collections.ForwardList({
                head: new b.collections.ForwardListNode({
                    rest: self.head,
                    value: value
                })
            });
        },

        length: oncePerInstance(function () {
            if (this.head === undefined) {
                return 0;
            } else {
                return this.head.length();
            }
        }, '_length'),

        // return a list without the head node,
        unshift: function () {
            var self = this,
            rest = undefined;

            if (self.head) {
                rest = self.head.rest;
            } else {
                return self;
            }

            return [this.head.value, new b.collections.ForwardList({
                head: rest
            })];
        },

        each: function (iterator, context) {
            var idx = 0,
            next = this.head;

            while (next !== undefined && next !== null) {
                iterator.apply(context, [next.value, idx, this, next]);
                idx += 1;
                next = next.rest;
            }
        },

        /**
         * Return a new ForwardList containing only those elements of this list for which
         * the iterator function returns a truthy value.
         *
         * @param filterFn a function taking (value, index, list, node) -> boolean
         * @return ForwardList
         */
         filter: function (filterFn, context)
         {
            var values = [],
            changedValue = false;

            this.each(function (value, idx, list, node) {
                if (filterFn.apply(this, arguments)) {
                    values.push(value);
                } else {
                    changedValue = true;
                }
            });

            if (!changedValue) {
                return this;
            } else {
                return b.collections.ForwardList.from(values);
            }
        },

        /**
         * Returns the first value that matches the specified filter function.
         */
         first: function (filterFn, context) {
            var idx = 0,
            filterFn = filterFn || function () { return true; },
            next = this.head;

            while (next !== undefined && next !== null) {
                if (filterFn.apply(context, [next.value, idx, this, next])) {
                    return next.value;
                }
                idx += 1;
                next = next.rest;
            }

            return undefined;
        }
    });

    // Factory method: given an array-like object or a forward list, return a forward list.
    b.collections.ForwardList.from = function (source) {
        if (source instanceof b.collections.ForwardList) {
            return source;
        } else {
            return _.reduceRight(source, function (memo, value) {
                return memo.shift(value);
            }, new b.collections.ForwardList({ head: null }));
        }
    }

    // Atoms provide a way to manage shared, synchronous, independent state.
    // http://clojure.org/atoms
    //
    // If supplied the validator must be a function (new, old) {} -> boolean,
    // returning true if the changed value is valid, and false if not.
    //
    // the value must be immutable.
    basilisk.Atom = function (initialValue, validator) {
        if (!(this instanceof basilisk.Atom)) { throw "Please instantiate each atom separately." }

        // Most state is held in closure, and thus can only be changed by these
        // privileged methods.

        var current,
            self = this,
            // TODO replace with a FixedVector.
            watchers = b.collections.ForwardList.from([]),
            // set the value if it passes the validator.
            _set = function (possible) {
                var old = current;
                if (possible !== current) {
                    if (!validator(possible, current)) {
                        throw "Value does not pass validator.";
                    }

                    current = possible;

                    watchers.each(function (watcher) {
                        try {
                            watcher(current, old);
                        } catch (e) {
                            // do nothing
                            log("Watcher threw exception: this behaviour is broken.");
                        }
                    });
                }

                return current;
            };

        validator = validator || function () { return true; };
        // we fail immediately if the initial value does not validate.

        _.extend(self, {
            // Retrieve the current value of the Atom.
            deref: function () { return current; },

            // Applies the given "change" function to the old state,
            // checks that the result passes the validator, and updates the current state.
            //
            // Will be called as swapFunction(old, *args);  The function should have no side-effects.
            //
            // Returns the new state or throws an exception.

            swap: function (swapFunction) {
                var possible, args = [current];

                if (arguments.length > 1) {
                    args.push.apply(args, _.rest(argument));
                }

                possible = swapFunction.apply(null, args);

                // update current, call watchers
                return this.compareAndSet(current, possible);
            },

            // If oldVal matches current, change to using newVal.
            // return true if changed, false if not changed.
            compareAndSet: function (oldVal, newVal) {
                if (oldVal === current) {
                    return (_set(newVal) === newVal);
                } else {
                    return false;
                }
            },

            // add a watcher.  Will be called if the value changes.
            addWatcher: function (watcher) {
                if (watchers.first(function (compare) { return compare === watcher; }) === undefined) {
                    watchers = watchers.shift(watcher);
                }
            },

            removeWatcher: function (watcher) {
                watchers = watchers.filter(function (compare) { return compare !== watcher; });
            },

            watchers: function () { return watchers },
        });

        // shorter alias for cas.
        this.cas = this.compareAndSet;

        // set the initial state.
        _set(initialValue);
    };

    return basilisk;
}));
<|endoftext|>


<commit_before>var Discord = require("discord.js");
var fs = require("fs");
var cron = require("node-cron");
var bot = new Discord.Client();
var readyCount = 0;
var watchlist = './watchlist.json';
const prefix = "~";
const friendList = {};

cron.schedule('*/25 * * * *', () => {
    console.log("Keeping SelfBot process alive");
});

bot.on("ready", () => {
    readyCount++;
    console.log("AFlaw is ready");
    console.log(`ID: ${bot.user.id}`);
    console.log(`Username: ${bot.user.username}`);
    // console.log(bot.presences);
    // console.log(bot.user.friends);
    checkFriendsStatuses(readyCount);
    // watchForFriendPresenceUpdate(readyCount);
});

process.on('SIGINT', () => {
    console.log("AFlaw is exiting");
});

bot.on("message", msg => {
    if (msg.author.id != bot.user.id || msg.content.substring(0, 1) != prefix) return;

    let messageContent = msg.content.split(" ");
    let command = messageContent[0].slice(prefix.length);
    let fromBotChannel = msg.channel.id == process.env.BOT_TEST_ID;

    if (command === "watch") {
        // console.log("Watch command");
        // console.log(`Is someone mentioned: ${msg.mentions.users.size!=0}`);
        // console.log(messageContent[1]);
        let user = msg.mentions.users.size!=0 ? msg.mentions.users.first() : messageContent[1];
        if (!fromBotChannel) msg.delete();
        watch(msg.mentions.users.size!=0 ? user.username : user);
        bot.channels.get(process.env.BOT_TEST_ID).sendMessage(`Watching ${msg.mentions.users.size!=0 ? user.username : user}`)
        .then(message => {
            // console.log(`Sent watch message: ${message.content}`);
            message.delete();
        })
        .catch(console.error);
    }

    if (command === "unwatch") {
        let user = msg.mentions.users.size!=0 ? msg.mentions.users.first() : messageContent[1];
        if (msg.channel.id != process.env.BOT_TEST_ID) msg.delete();
        unwatch(msg.mentions.users.size!=0 ? user.username : user);
        bot.channels.get(process.env.BOT_TEST_ID).sendMessage(`No longer watching ${msg.mentions.users.size!=0 ? user.username : user}`)
        .then(message => {
            // console.log(`Sent unwatch message: ${message.content}`);
            message.delete();
        })
        .catch(console.error);
    }

    if (command === "testDM") {
        bot.channels.get(process.env.BOT_TEST_ID).sendMessage("This is a test DM");
        // console.log(`Sending test message`);
    }
});

bot.on("presenceUpdate", (oldUser, newUser) => {
    try {
        // if (oldUser.client.user.id in bot.user.friends.keys) return;
        fs.readFile(watchlist, 'utf8', (err, data) => {
            if (err) throw err;
            var userObject = JSON.parse(data);
            if (userObject[oldUser.user.username.replace(/\s/g, '')]) {
                if ((oldUser.presence.status != "online") && (newUser.presence.status != "offline")) {
                    console.log(`presenceUpdate: ${oldUser.client.user.username}`);
                    sendStatusMessage(`${oldUser.user.username} is ${newUser.presence.status}`);
                }
            }
        });
    } catch (error) {
        console.error(error);
    }
});

bot.login(process.env.USER_TOKEN).catch(err => console.error(err));

function watch(user) {
    try {
        fs.readFile(watchlist, 'utf8', (err, data) => {
            if (err) throw err;
            let userObject = JSON.parse(data);
            userObject[user] = user;
            console.log(userObject);
            fs.writeFile(watchlist, JSON.stringify(userObject));
        });
    } catch (error) {
        console.error(error);
    }
}

function unwatch(user) {
    try {
        fs.readFile(watchlist, 'utf8', (err, data) => {
            if (err) throw err;
            let userObject = JSON.parse(data);
            delete userObject[user];
            console.log(userObject);
            fs.writeFile(watchlist, JSON.stringify(userObject));
        });
    } catch (error) {
        console.error(error);
    }
}

function checkFriendsStatuses(count) {
    if (count > 1) return;
    let friendPresences = bot.presences;
    // console.log(friendPresences.keyArray().toString());
    friendPresences.keyArray().forEach((val, index, presences) => {
        friendList[friendPresences.keyArray()[index]] = friendPresences.get(val)["status"];
    });
    console.log(friendList);
}

// function watchForFriendPresenceUpdate(count) {
//     if (count > 1) return;
//     while(true) {
//         // let friendPresences = bot.presences;
//         // let friends = bot.user.friends;
//         // let friendPresencesKeys = friendPresences.keys;
//         // let friendKeys = friends.keys;
//         // let guilds = bot.guilds;
//         for ()
//     }
// }

function sendStatusMessage(msg) {
     bot.channels.get(process.env.BOT_TEST_ID).sendMessage(msg)
    .then(message => {
        console.log(message.content);
         message.delete();
    })
    .catch(console.error);
}<commit_msg>let's try this again<commit_after>var Discord = require("discord.js");
var fs = require("fs");
var cron = require("node-cron");
var bot = new Discord.Client();
var readyCount = 0;
var watchlist = './watchlist.json';
const prefix = "~";
const friendList = {};

cron.schedule('*/25 * * * *', () => {
    console.log("Keeping SelfBot process alive");
});

bot.on("ready", () => {
    readyCount++;
    console.log("AFlaw is ready");
    console.log(`ID: ${bot.user.id}`);
    console.log(`Username: ${bot.user.username}`);
    // console.log(bot.presences);
    // console.log(bot.user.friends);
    checkFriendsStatuses(readyCount);
    // watchForFriendPresenceUpdate(readyCount);
});

process.on('SIGINT', () => {
    console.log("AFlaw is exiting");
});

bot.on("message", msg => {
    if (msg.author.id != bot.user.id || msg.content.substring(0, 1) != prefix) return;

    let messageContent = msg.content.split(" ");
    let command = messageContent[0].slice(prefix.length);
    let fromBotChannel = msg.channel.id == process.env.BOT_TEST_ID;

    if (command === "watch") {
        // console.log("Watch command");
        // console.log(`Is someone mentioned: ${msg.mentions.users.size!=0}`);
        // console.log(messageContent[1]);
        let user = msg.mentions.users.size!=0 ? msg.mentions.users.first() : messageContent[1];
        if (!fromBotChannel) msg.delete();
        watch(msg.mentions.users.size!=0 ? user.username : user);
        bot.channels.get(process.env.BOT_TEST_ID).sendMessage(`Watching ${msg.mentions.users.size!=0 ? user.username : user}`)
        .then(message => {
            // console.log(`Sent watch message: ${message.content}`);
            message.delete();
        })
        .catch(console.error);
    }

    if (command === "unwatch") {
        let user = msg.mentions.users.size!=0 ? msg.mentions.users.first() : messageContent[1];
        if (msg.channel.id != process.env.BOT_TEST_ID) msg.delete();
        unwatch(msg.mentions.users.size!=0 ? user.username : user);
        bot.channels.get(process.env.BOT_TEST_ID).sendMessage(`No longer watching ${msg.mentions.users.size!=0 ? user.username : user}`)
        .then(message => {
            // console.log(`Sent unwatch message: ${message.content}`);
            message.delete();
        })
        .catch(console.error);
    }

    if (command === "testDM") {
        bot.channels.get(process.env.BOT_TEST_ID).sendMessage("This is a test DM");
        // console.log(`Sending test message`);
    }
});

bot.on("presenceUpdate", (oldUser, newUser) => {
    try {
        // if (oldUser.client.user.id in bot.user.friends.keys) return;
        fs.readFile(watchlist, 'utf8', (err, data) => {
            if (err) throw err;
            var userObject = JSON.parse(data);
            if (userObject[oldUser.user.username.replace(/\s/g, '')]) {
                if ((oldUser.presence.status != "online") && (newUser.presence.status != "offline")) {
                    console.log(`presenceUpdate: ${oldUser.client.user.username}`);
                    sendStatusMessage(`${oldUser.user.username} is ${newUser.presence.status}`);
                }
            }
        });
    } catch (error) {
        console.error(error);
    }
});

bot.login(process.env.USER_TOKEN).catch(err => console.error(err));

function watch(user) {
    try {
        fs.readFile(watchlist, 'utf8', (err, data) => {
            if (err) throw err;
            let userObject = JSON.parse(data);
            userObject[user] = user;
            console.log(userObject);
            fs.writeFile(watchlist, JSON.stringify(userObject));
        });
    } catch (error) {
        console.error(error);
    }
}

function unwatch(user) {
    try {
        fs.readFile(watchlist, 'utf8', (err, data) => {
            if (err) throw err;
            let userObject = JSON.parse(data);
            delete userObject[user];
            console.log(userObject);
            fs.writeFile(watchlist, JSON.stringify(userObject));
        });
    } catch (error) {
        console.error(error);
    }
}

function checkFriendsStatuses(count) {
    if (count > 1) return;
    let friendPresences = bot.presences;
    // console.log(friendPresences.keyArray().toString());
    friendPresences.keyArray().forEach((val, index, presences) => {
        friendList[friendPresences.keyArray()[index]] = friendPresences.get(val)["status"];
    });
    console.log(friendPresences);
}

// function watchForFriendPresenceUpdate(count) {
//     if (count > 1) return;
//     while(true) {
//         // let friendPresences = bot.presences;
//         // let friends = bot.user.friends;
//         // let friendPresencesKeys = friendPresences.keys;
//         // let friendKeys = friends.keys;
//         // let guilds = bot.guilds;
//         for ()
//     }
// }

function sendStatusMessage(msg) {
     bot.channels.get(process.env.BOT_TEST_ID).sendMessage(msg)
    .then(message => {
        console.log(message.content);
         message.delete();
    })
    .catch(console.error);
}<|endoftext|>


<commit_before>[
{"id":"layer_new","title":"Nová vrstva"},
{"id":"layer_delete","title":"Odstrániť vrstvu"},
{"id":"layer_rename","title":"Premenovať vrstvu"},
{"id":"layer_up","title":"Presunúť vrstvu hore"},
{"id":"layer_down","title":"Presunúť vrstvu dole"},
{"id":"tool_clear","title":"Nový obrázok"},
{"id":"tool_open","title":"Otvoriť obrázok"},
{"id":"tool_save","title":"Uložiť obrázok"},
{"id":"tool_docprops","title":"Vlastnosti dokumentu"},
{"id":"tool_source","title":"Upraviť SVG kód"},
{"id":"tool_undo","title":"Späť"},
{"id":"tool_redo","title":"Opakovať"},
{"id":"tool_clone","title":"Klonovať element"},
{"id":"tool_delete","title":"Zmazať element"},
{"id":"tool_move_top","title":"Presunúť na vrch"},
{"id":"tool_move_bottom","title":"Presunúť spodok"},
{"id":"group_opacity","title":"Zmeniť prehľadnosť vybraných položiek"},
{"id":"angle","title":"Zmeniť uhol natočenia"},
{"id":"tool_clone_multi","title":"Klonovať elementy"},
{"id":"tool_delete_multi","title":"Vymazať vybrané prvky [Delete/Backspace]"},
{"id":"tool_alignleft","title":"Zarovnať doľava"},
{"id":"tool_aligncenter","title":"Zarovnať na stred"},
{"id":"tool_alignright","title":"Zarovnať doprava"},
{"id":"tool_aligntop","title":"Zarovnať hore"},
{"id":"tool_alignmiddle","title":"Zarovnať na stred"},
{"id":"tool_alignbottom","title":"Zarovnať dole"},
{"id":"align_relative_to","title":"Zarovnať relatívne k ..."},
{"id":"tool_group","title":"Zoskupiť elementy"},
{"id":"tool_ungroup","title":"Zrušiť skupinu"},
{"id":"rect_width","title":"Zmeniť šírku obdĺžnika"},
{"id":"rect_height","title":"Zmena výšku obdĺžnika"},
{"id":"rect_rx","title":"Zmeniť zaoblenie rohov obdĺžnika"},
{"id":"image_width","title":"Zmeniť šírku obrázka"},
{"id":"image_height","title":"Zmeniť výšku obrázka"},
{"id":"image_url","title":"Zmeniť URL"},
{"id":"circle_cx","title":"Zmeniť súradnicu X stredu kružnice"},
{"id":"circle_cy","title":"Zmeniť súradnicu Y stredu kružnice"},
{"id":"circle_r","title":"Zmeniť polomer kružnice"},
{"id":"ellipse_cx","title":"Zmeniť súradnicu X stredu elipsy"},
{"id":"ellipse_cy","title":"Zmeniť súradnicu Y stredu elipsy"},
{"id":"ellipse_rx","title":"Zmeniť polomer X elipsy"},
{"id":"ellipse_ry","title":"Zmeniť polomer Y elipsy"},
{"id":"line_x1","title":"Zmeniť počiatočnú súradnicu X čiary"},
{"id":"line_y1","title":"Zmeniť počiatočnú súradnicu Y čiary"},
{"id":"line_x2","title":"Zmeniť koncovú súradnicu X čiary"},
{"id":"line_y2","title":"Zmeniť koncovú súradnicu Y čiary"},
{"id":"tool_bold","title":"Tučne"},
{"id":"tool_italic","title":"Kurzíva"},
{"id":"font_family","title":"Zmeniť font"},
{"id":"font_size","title":"Zmeniť veľkosť písma"},
{"id":"text","title":"Změnit text"},
{"id":"tool_select","title":"Výber"},
{"id":"tool_fhpath","title":"Ceruzka"},
{"id":"tool_line","title":"Čiara"},
{"id":"tools_rect_show","title":"Štvorec / Obdĺžnik"},
{"id":"tools_ellipse_show","title":"Elipsa / Kružnica"},
{"id":"tool_text","title":"Text"},
{"id":"tool_path","title":"Path Tool"},
{"id":"tool_image","title":"Obrázok"},
{"id":"tool_zoom","title":"Priblíženie"},
{"id":"zoom","title":"Zmena priblíženia"},
{"id":"fill_color","title":"Zmeniť farbu výplne"},
{"id":"stroke_color","title":"Zmena farby obrysu"},
{"id":"stroke_width","title":"Zmeniť šírku obrysu"},
{"id":"stroke_style","title":"Zmeniť štýl obrysu"},
{"id":"palette","title":"Kliknutím zmeníte farbu výplne, so Shiftom zmeníte farbu obrysu"},
{"id":"tool_square","title":"Štvorec"},
{"id":"tool_rect","title":"Obdĺžnik"},
{"id":"tool_fhrect","title":"Obdĺžnik voľnou rukou"},
{"id":"tool_circle","title":"Kružnica"},
{"id":"tool_ellipse","title":"Elipsa"},
{"id":"tool_fhellipse","title":"Elipsa voľnou rukou"},
{"id":"bkgnd_color","title":"Zmeniť farbu a priehľadnosť pozadia"},
{"id":"rwidthLabel","textContent":"šírka:"},
{"id":"rheightLabel","textContent":"výška:"},
{"id":"cornerRadiusLabel","textContent":"Polomer zaoblenia:"},
{"id":"iwidthLabel","textContent":"šírka:"},
{"id":"iheightLabel","textContent":"výška:"},
{"id":"svginfo_width","textContent":"Šírka:"},
{"id":"svginfo_height","textContent":"Výška:"},
{"id":"angleLabel","textContent":"uhol:"},
{"id":"relativeToLabel","textContent":"vzhľadom k:"},
{"id":"zoomLabel","textContent":"priblíženie:"},
{"id":"layersLabel","textContent":"Vrstvy:"},
{"id":"selectedPredefined","textContent":"Vybrať preddefinovaný:"},
{"id":"fitToContent","textContent":"Prispôsobiť obsahu"},
{"id":"tool_source_save","textContent":"Uložiť"},
{"id":"tool_docprops_save","textContent":"Uložiť"},
{"id":"tool_docprops_cancel","textContent":"Zrušiť"},
{"id":"tool_source_cancel","textContent":"Zrušiť"},
{"id":"fit_to_all","textContent":"Prisposobiť celému obsahu"},
{"id":"fit_to_layer_content","textContent":"Prispôsobiť obsahu vrstvy"},
{"id":"fit_to_sel","textContent":"Prispôsobiť výberu"},
{"id":"fit_to_canvas","textContent":"Prispôsobiť stránke"},
{"id":"selected_objects","textContent":"zvoleným objektom"},
{"id":"largest_object","textContent":"najväčšiemu objektu"},
{"id":"smallest_object","textContent":"najmenšiemu objektu"},
{"id":"page","textContent":"stránke"},
{"id":"fill_tool_bottom","textContent":"výplň:"},
{"id":"stroke_tool_bottom","textContent":"obrys:"},
{"id":"path_node_x","title":"Change node's x coordinate"},
{"id":"path_node_y","title":"Change node's y coordinate"},
{"id":"seg_type","title":"Change Segment type"},
{"id":"straight_segments","textContent":"Straight"},
{"id":"curve_segments","textContent":"Curve"},
{"id":"tool_node_clone","title":"Clone Node"},
{"id":"tool_node_delete","title":"Delete Node"},
{"id":"selLayerLabel","textContent":"Move elements to:"},
{"id":"selLayerNames","title":"Move selected elements to a different layer"},
{"id":"sidepanel_handle","title":"Drag left/right to resize side panel","textContent":"L a y e r s"},
{"id":"tool_wireframe","title":"Wireframe Mode"},
{"id":"svginfo_image_props","textContent":"Image Properties"},
{"id":"svginfo_title","textContent":"Title"},
{"id":"svginfo_dim","textContent":"Canvas Dimensions"},
{"id":"includedImages","textContent":"Included Images"},
{"id":"image_opt_embed","textContent":"Embed data (local files)"},
{"id":"image_opt_ref","textContent":"Use file reference"},
{"id":"svginfo_editor_prefs","textContent":"Editor Preferences"},
{"id":"svginfo_lang","textContent":"Language"},
{"id":"svginfo_change_background","textContent":"Editor Background"},
{"id":"svginfo_bg_note","textContent":"Note: Background will not be saved with image."},
{"id":"svginfo_icons","textContent":"Icon size"},
{"id":"icon_small","textContent":"Small"},
{"id":"icon_medium","textContent":"Medium"},
{"id":"icon_large","textContent":"Large"},
{"id":"icon_xlarge","textContent":"Extra Large"},
{"id":"selected_x","title":"Change X coordinate"},
{"id":"selected_y","title":"Change Y coordinate"},
{"id":"tool_topath","title":"Convert to Path"},
{"id":"tool_reorient","title":"Reorient path"},
{"id":"tool_node_link","title":"Link Control Points"},
{"js_strings": {
	"invalidAttrValGiven":"Invalid value given",
	"noContentToFitTo":"No content to fit to",
	'layer':"Layer",
	"dupeLayerName":"There is already a layer named that!",
	"enterUniqueLayerName":"Please enter a unique layer name",
	"enterNewLayerName":"Please enter the new layer name",
	"layerHasThatName":"Layer already has that name",
	"QmoveElemsToLayer":"Move selected elements to layer '%s'?",
	"QwantToClear":"Do you want to clear the drawing?\nThis will also erase your undo history!",
	"QerrorsRevertToSource":"There were parsing errors in your SVG source.\nRevert back to original SVG source?",
	"QignoreSourceChanges":"Ignore changes made to SVG source?",
	"featNotSupported":"Feature not supported",
	"enterNewImgURL":"Enter the new image URL",
	"ok":"OK",
	"cancel":"Cancel",
	"pathNodeTooltip":"Drag node to move it. Double-click node to change segment type",
	"pathCtrlPtTooltip":"Drag control point to adjust curve properties",
	"key_up":"up",
	"key_down":"down",
	"key_backspace":"backspace",
	"key_del":"delete"
	}
}
]
<commit_msg>update SK translation<commit_after>[
{"id":"layer_new","title":"Nová vrstva"},
{"id":"layer_delete","title":"Odstrániť vrstvu"},
{"id":"layer_rename","title":"Premenovať vrstvu"},
{"id":"layer_up","title":"Presunúť vrstvu hore"},
{"id":"layer_down","title":"Presunúť vrstvu dole"},
{"id":"tool_clear","title":"Nový obrázok"},
{"id":"tool_open","title":"Otvoriť obrázok"},
{"id":"tool_save","title":"Uložiť obrázok"},
{"id":"tool_docprops","title":"Vlastnosti dokumentu"},
{"id":"tool_source","title":"Upraviť SVG kód"},
{"id":"tool_undo","title":"Späť"},
{"id":"tool_redo","title":"Opakovať"},
{"id":"tool_clone","title":"Klonovať element"},
{"id":"tool_delete","title":"Zmazať element"},
{"id":"tool_move_top","title":"Presunúť na vrch"},
{"id":"tool_move_bottom","title":"Presunúť spodok"},
{"id":"group_opacity","title":"Zmeniť prehľadnosť vybraných položiek"},
{"id":"angle","title":"Zmeniť uhol natočenia"},
{"id":"tool_clone_multi","title":"Klonovať elementy"},
{"id":"tool_delete_multi","title":"Vymazať vybrané prvky [Delete/Backspace]"},
{"id":"tool_alignleft","title":"Zarovnať doľava"},
{"id":"tool_aligncenter","title":"Zarovnať na stred"},
{"id":"tool_alignright","title":"Zarovnať doprava"},
{"id":"tool_aligntop","title":"Zarovnať hore"},
{"id":"tool_alignmiddle","title":"Zarovnať na stred"},
{"id":"tool_alignbottom","title":"Zarovnať dole"},
{"id":"align_relative_to","title":"Zarovnať relatívne k ..."},
{"id":"tool_group","title":"Zoskupiť elementy"},
{"id":"tool_ungroup","title":"Zrušiť skupinu"},
{"id":"rect_width","title":"Zmeniť šírku obdĺžnika"},
{"id":"rect_height","title":"Zmena výšku obdĺžnika"},
{"id":"rect_rx","title":"Zmeniť zaoblenie rohov obdĺžnika"},
{"id":"image_width","title":"Zmeniť šírku obrázka"},
{"id":"image_height","title":"Zmeniť výšku obrázka"},
{"id":"image_url","title":"Zmeniť URL"},
{"id":"circle_cx","title":"Zmeniť súradnicu X stredu kružnice"},
{"id":"circle_cy","title":"Zmeniť súradnicu Y stredu kružnice"},
{"id":"circle_r","title":"Zmeniť polomer kružnice"},
{"id":"ellipse_cx","title":"Zmeniť súradnicu X stredu elipsy"},
{"id":"ellipse_cy","title":"Zmeniť súradnicu Y stredu elipsy"},
{"id":"ellipse_rx","title":"Zmeniť polomer X elipsy"},
{"id":"ellipse_ry","title":"Zmeniť polomer Y elipsy"},
{"id":"line_x1","title":"Zmeniť počiatočnú súradnicu X čiary"},
{"id":"line_y1","title":"Zmeniť počiatočnú súradnicu Y čiary"},
{"id":"line_x2","title":"Zmeniť koncovú súradnicu X čiary"},
{"id":"line_y2","title":"Zmeniť koncovú súradnicu Y čiary"},
{"id":"tool_bold","title":"Tučne"},
{"id":"tool_italic","title":"Kurzíva"},
{"id":"font_family","title":"Zmeniť font"},
{"id":"font_size","title":"Zmeniť veľkosť písma"},
{"id":"text","title":"Změnit text"},
{"id":"tool_select","title":"Výber"},
{"id":"tool_fhpath","title":"Ceruzka"},
{"id":"tool_line","title":"Čiara"},
{"id":"tools_rect_show","title":"Štvorec / Obdĺžnik"},
{"id":"tools_ellipse_show","title":"Elipsa / Kružnica"},
{"id":"tool_text","title":"Text"},
{"id":"tool_path","title":"Path Tool"},
{"id":"tool_image","title":"Obrázok"},
{"id":"tool_zoom","title":"Priblíženie"},
{"id":"zoom","title":"Zmena priblíženia"},
{"id":"fill_color","title":"Zmeniť farbu výplne"},
{"id":"stroke_color","title":"Zmena farby obrysu"},
{"id":"stroke_width","title":"Zmeniť šírku obrysu"},
{"id":"stroke_style","title":"Zmeniť štýl obrysu"},
{"id":"palette","title":"Kliknutím zmeníte farbu výplne, so Shiftom zmeníte farbu obrysu"},
{"id":"tool_square","title":"Štvorec"},
{"id":"tool_rect","title":"Obdĺžnik"},
{"id":"tool_fhrect","title":"Obdĺžnik voľnou rukou"},
{"id":"tool_circle","title":"Kružnica"},
{"id":"tool_ellipse","title":"Elipsa"},
{"id":"tool_fhellipse","title":"Elipsa voľnou rukou"},
{"id":"bkgnd_color","title":"Zmeniť farbu a priehľadnosť pozadia"},
{"id":"rwidthLabel","textContent":"šírka:"},
{"id":"rheightLabel","textContent":"výška:"},
{"id":"cornerRadiusLabel","textContent":"Polomer zaoblenia:"},
{"id":"iwidthLabel","textContent":"šírka:"},
{"id":"iheightLabel","textContent":"výška:"},
{"id":"svginfo_width","textContent":"Šírka:"},
{"id":"svginfo_height","textContent":"Výška:"},
{"id":"angleLabel","textContent":"uhol:"},
{"id":"relativeToLabel","textContent":"vzhľadom k:"},
{"id":"zoomLabel","textContent":"priblíženie:"},
{"id":"layersLabel","textContent":"Vrstvy:"},
{"id":"selectedPredefined","textContent":"Vybrať preddefinovaný:"},
{"id":"fitToContent","textContent":"Prispôsobiť obsahu"},
{"id":"tool_source_save","textContent":"Uložiť"},
{"id":"tool_docprops_save","textContent":"Uložiť"},
{"id":"tool_docprops_cancel","textContent":"Zrušiť"},
{"id":"tool_source_cancel","textContent":"Zrušiť"},
{"id":"fit_to_all","textContent":"Prisposobiť celému obsahu"},
{"id":"fit_to_layer_content","textContent":"Prispôsobiť obsahu vrstvy"},
{"id":"fit_to_sel","textContent":"Prispôsobiť výberu"},
{"id":"fit_to_canvas","textContent":"Prispôsobiť stránke"},
{"id":"selected_objects","textContent":"zvoleným objektom"},
{"id":"largest_object","textContent":"najväčšiemu objektu"},
{"id":"smallest_object","textContent":"najmenšiemu objektu"},
{"id":"page","textContent":"stránke"},
{"id":"fill_tool_bottom","textContent":"výplň:"},
{"id":"stroke_tool_bottom","textContent":"obrys:"},
{"id":"path_node_x","title":"Zmeniť uzlu súradnicu X"},
{"id":"path_node_y","title":"Zmeniť uzlu súradnicu Y"},
{"id":"seg_type","title":"Zmeniť typ segmentu"},
{"id":"straight_segments","textContent":"Rovný"},
{"id":"curve_segments","textContent":"Krivka"},
{"id":"tool_node_clone","title":"Klonovať uzol"},
{"id":"tool_node_delete","title":"Zmazať uzol"},
{"id":"selLayerLabel","textContent":"Presunút elementy do:"},
{"id":"selLayerNames","title":"Presunúť vybrané elementy do inej vrstvy"},
{"id":"sidepanel_handle","title":"Ťahajte vľavo/vpravo na zmenu veľkosti","textContent":"V r s t v y"},
{"id":"tool_wireframe","title":"Drôtový model"},
{"id":"svginfo_image_props","textContent":"Vlastnosti obrázka"},
{"id":"svginfo_title","textContent":"Titulok"},
{"id":"svginfo_dim","textContent":"Rozmery plátna"},
{"id":"includedImages","textContent":"Vložené obrázky"},
{"id":"image_opt_embed","textContent":"Vložiť data (lokálne súbory)"},
{"id":"image_opt_ref","textContent":"Použiť referenciu na súbor"},
{"id":"svginfo_editor_prefs","textContent":"Vlastnosti editora"},
{"id":"svginfo_lang","textContent":"Jazyk"},
{"id":"svginfo_change_background","textContent":"Zmeniť pozadie"},
{"id":"svginfo_bg_note","textContent":"Poznámka: Pozadie nebude uložené spolu s obrázkom."},
{"id":"svginfo_icons","textContent":"Veľkosť ikon"},
{"id":"icon_small","textContent":"Malá"},
{"id":"icon_medium","textContent":"Stredná"},
{"id":"icon_large","textContent":"Veľká"},
{"id":"icon_xlarge","textContent":"Extra veľká"},
{"id":"selected_x","title":"Zmeniť súradnicu X"},
{"id":"selected_y","title":"Zmeniť súradnicu Y"},
{"id":"tool_topath","title":"Previesť na krivku"},
{"id":"tool_reorient","title":"Zmeniť orientáciu krivky"},
{"id":"tool_node_link","title":"Prepojiť kontrolné body"},
{"js_strings": {
	"invalidAttrValGiven":"Neplatná hodnota",
	"noContentToFitTo":"Žiaden obsah na prispôsobenie",
	'layer':"Vrstva",
	"dupeLayerName":"Vrstva s daným názvom už existuje!",
	"enterUniqueLayerName":"Zadajte unikátny názov vrstvy",
	"enterNewLayerName":"Zadajte názov vrstvy",
	"layerHasThatName":"Vrstva už má zadaný názov",
	"QmoveElemsToLayer":"Presunúť elementy do vrstvy '%s'?",
	"QwantToClear":"Naozaj chcete vymazať kresbu?\n(História bude taktiež vymazaná!)!",
	"QerrorsRevertToSource":"Chyba pri načítaní SVG dokumentu.\nVrátiť povodný SVG dokument?",
	"QignoreSourceChanges":"Ignorovať zmeny v SVG dokumente?",
	"featNotSupported":"Vlastnosť nie je podporovaná",
	"enterNewImgURL":"Zadajte nové URL obrázka",
	"ok":"OK",
	"cancel":"Zrušiť",
	"pathNodeTooltip":"Ťahajte bod na presunutie. Dvojklik na zmenu typu segmentu",
	"pathCtrlPtTooltip":"Ťahajte kontrolné body pre upravnie vlastnosti krivky",
	"key_up":"Hore",
	"key_down":"Dole",
	"key_backspace":"Backspace",
	"key_del":"Delete"
	}
}
]
<|endoftext|>