UNPKG

910 BJavaScriptView Raw
1// Generated by CoffeeScript 1.6.3
2(function() {
3 exports.replaceProperties = function(obj, newProps) {
4 var props;
5 props = Object.getOwnPropertyNames(obj);
6 props.forEach(function(prop) {
7 return delete obj[prop];
8 });
9 return Object.getOwnPropertyNames(newProps).forEach(function(prop) {
10 return obj[prop] = newProps[prop];
11 });
12 };
13
14 exports.strToNumericEntity = function(str) {
15 var symbols, _i, _ref, _results;
16 symbols = (function() {
17 _results = [];
18 for (var _i = 0, _ref = str.length; 0 <= _ref ? _i < _ref : _i > _ref; 0 <= _ref ? _i++ : _i--){ _results.push(_i); }
19 return _results;
20 }).apply(this).map(function(i) {
21 var charCode;
22 charCode = str.charCodeAt(i);
23 if (charCode < 128) {
24 return str[i];
25 } else {
26 return '&#' + charCode + ';';
27 }
28 });
29 return symbols.join('');
30 };
31
32}).call(this);