This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3982 lines
119 KiB
3982 lines
119 KiB
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.plist = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ |
|
(function (Buffer){ |
|
|
|
/** |
|
* Module dependencies. |
|
*/ |
|
|
|
var base64 = require('base64-js'); |
|
var xmlbuilder = require('xmlbuilder'); |
|
|
|
/** |
|
* Module exports. |
|
*/ |
|
|
|
exports.build = build; |
|
|
|
/** |
|
* Accepts a `Date` instance and returns an ISO date string. |
|
* |
|
* @param {Date} d - Date instance to serialize |
|
* @returns {String} ISO date string representation of `d` |
|
* @api private |
|
*/ |
|
|
|
function ISODateString(d){ |
|
function pad(n){ |
|
return n < 10 ? '0' + n : n; |
|
} |
|
return d.getUTCFullYear()+'-' |
|
+ pad(d.getUTCMonth()+1)+'-' |
|
+ pad(d.getUTCDate())+'T' |
|
+ pad(d.getUTCHours())+':' |
|
+ pad(d.getUTCMinutes())+':' |
|
+ pad(d.getUTCSeconds())+'Z'; |
|
} |
|
|
|
/** |
|
* Returns the internal "type" of `obj` via the |
|
* `Object.prototype.toString()` trick. |
|
* |
|
* @param {Mixed} obj - any value |
|
* @returns {String} the internal "type" name |
|
* @api private |
|
*/ |
|
|
|
var toString = Object.prototype.toString; |
|
function type (obj) { |
|
var m = toString.call(obj).match(/\[object (.*)\]/); |
|
return m ? m[1] : m; |
|
} |
|
|
|
/** |
|
* Generate an XML plist string from the input object `obj`. |
|
* |
|
* @param {Object} obj - the object to convert |
|
* @param {Object} [opts] - optional options object |
|
* @returns {String} converted plist XML string |
|
* @api public |
|
*/ |
|
|
|
function build (obj, opts) { |
|
var XMLHDR = { |
|
version: '1.0', |
|
encoding: 'UTF-8' |
|
}; |
|
|
|
var XMLDTD = { |
|
pubid: '-//Apple//DTD PLIST 1.0//EN', |
|
sysid: 'http://www.apple.com/DTDs/PropertyList-1.0.dtd' |
|
}; |
|
|
|
var doc = xmlbuilder.create('plist'); |
|
|
|
doc.dec(XMLHDR.version, XMLHDR.encoding, XMLHDR.standalone); |
|
doc.dtd(XMLDTD.pubid, XMLDTD.sysid); |
|
doc.att('version', '1.0'); |
|
|
|
walk_obj(obj, doc); |
|
|
|
if (!opts) opts = {}; |
|
// default `pretty` to `true` |
|
opts.pretty = opts.pretty !== false; |
|
return doc.end(opts); |
|
} |
|
|
|
/** |
|
* depth first, recursive traversal of a javascript object. when complete, |
|
* next_child contains a reference to the build XML object. |
|
* |
|
* @api private |
|
*/ |
|
|
|
function walk_obj(next, next_child) { |
|
var tag_type, i, prop; |
|
var name = type(next); |
|
|
|
if ('Undefined' == name) { |
|
return; |
|
} else if (Array.isArray(next)) { |
|
next_child = next_child.ele('array'); |
|
for (i = 0; i < next.length; i++) { |
|
walk_obj(next[i], next_child); |
|
} |
|
|
|
} else if (Buffer.isBuffer(next)) { |
|
next_child.ele('data').raw(next.toString('base64')); |
|
|
|
} else if ('Object' == name) { |
|
next_child = next_child.ele('dict'); |
|
for (prop in next) { |
|
if (next.hasOwnProperty(prop)) { |
|
next_child.ele('key').txt(prop); |
|
walk_obj(next[prop], next_child); |
|
} |
|
} |
|
|
|
} else if ('Number' == name) { |
|
// detect if this is an integer or real |
|
// TODO: add an ability to force one way or another via a "cast" |
|
tag_type = (next % 1 === 0) ? 'integer' : 'real'; |
|
next_child.ele(tag_type).txt(next.toString()); |
|
|
|
} else if ('Date' == name) { |
|
next_child.ele('date').txt(ISODateString(new Date(next))); |
|
|
|
} else if ('Boolean' == name) { |
|
next_child.ele(next ? 'true' : 'false'); |
|
|
|
} else if ('String' == name) { |
|
next_child.ele('string').txt(next); |
|
|
|
} else if ('ArrayBuffer' == name) { |
|
next_child.ele('data').raw(base64.fromByteArray(next)); |
|
|
|
} else if (next && next.buffer && 'ArrayBuffer' == type(next.buffer)) { |
|
// a typed array |
|
next_child.ele('data').raw(base64.fromByteArray(new Uint8Array(next.buffer), next_child)); |
|
|
|
} |
|
} |
|
|
|
}).call(this,{"isBuffer":require("../node_modules/is-buffer/index.js")}) |
|
},{"../node_modules/is-buffer/index.js":3,"base64-js":2,"xmlbuilder":79}],2:[function(require,module,exports){ |
|
var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; |
|
|
|
;(function (exports) { |
|
'use strict'; |
|
|
|
var Arr = (typeof Uint8Array !== 'undefined') |
|
? Uint8Array |
|
: Array |
|
|
|
var PLUS = '+'.charCodeAt(0) |
|
var SLASH = '/'.charCodeAt(0) |
|
var NUMBER = '0'.charCodeAt(0) |
|
var LOWER = 'a'.charCodeAt(0) |
|
var UPPER = 'A'.charCodeAt(0) |
|
var PLUS_URL_SAFE = '-'.charCodeAt(0) |
|
var SLASH_URL_SAFE = '_'.charCodeAt(0) |
|
|
|
function decode (elt) { |
|
var code = elt.charCodeAt(0) |
|
if (code === PLUS || |
|
code === PLUS_URL_SAFE) |
|
return 62 // '+' |
|
if (code === SLASH || |
|
code === SLASH_URL_SAFE) |
|
return 63 // '/' |
|
if (code < NUMBER) |
|
return -1 //no match |
|
if (code < NUMBER + 10) |
|
return code - NUMBER + 26 + 26 |
|
if (code < UPPER + 26) |
|
return code - UPPER |
|
if (code < LOWER + 26) |
|
return code - LOWER + 26 |
|
} |
|
|
|
function b64ToByteArray (b64) { |
|
var i, j, l, tmp, placeHolders, arr |
|
|
|
if (b64.length % 4 > 0) { |
|
throw new Error('Invalid string. Length must be a multiple of 4') |
|
} |
|
|
|
// the number of equal signs (place holders) |
|
// if there are two placeholders, than the two characters before it |
|
// represent one byte |
|
// if there is only one, then the three characters before it represent 2 bytes |
|
// this is just a cheap hack to not do indexOf twice |
|
var len = b64.length |
|
placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0 |
|
|
|
// base64 is 4/3 + up to two characters of the original data |
|
arr = new Arr(b64.length * 3 / 4 - placeHolders) |
|
|
|
// if there are placeholders, only get up to the last complete 4 chars |
|
l = placeHolders > 0 ? b64.length - 4 : b64.length |
|
|
|
var L = 0 |
|
|
|
function push (v) { |
|
arr[L++] = v |
|
} |
|
|
|
for (i = 0, j = 0; i < l; i += 4, j += 3) { |
|
tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3)) |
|
push((tmp & 0xFF0000) >> 16) |
|
push((tmp & 0xFF00) >> 8) |
|
push(tmp & 0xFF) |
|
} |
|
|
|
if (placeHolders === 2) { |
|
tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4) |
|
push(tmp & 0xFF) |
|
} else if (placeHolders === 1) { |
|
tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2) |
|
push((tmp >> 8) & 0xFF) |
|
push(tmp & 0xFF) |
|
} |
|
|
|
return arr |
|
} |
|
|
|
function uint8ToBase64 (uint8) { |
|
var i, |
|
extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes |
|
output = "", |
|
temp, length |
|
|
|
function encode (num) { |
|
return lookup.charAt(num) |
|
} |
|
|
|
function tripletToBase64 (num) { |
|
return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F) |
|
} |
|
|
|
// go through the array every three bytes, we'll deal with trailing stuff later |
|
for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) { |
|
temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) |
|
output += tripletToBase64(temp) |
|
} |
|
|
|
// pad the end with zeros, but make sure to not forget the extra bytes |
|
switch (extraBytes) { |
|
case 1: |
|
temp = uint8[uint8.length - 1] |
|
output += encode(temp >> 2) |
|
output += encode((temp << 4) & 0x3F) |
|
output += '==' |
|
break |
|
case 2: |
|
temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]) |
|
output += encode(temp >> 10) |
|
output += encode((temp >> 4) & 0x3F) |
|
output += encode((temp << 2) & 0x3F) |
|
output += '=' |
|
break |
|
} |
|
|
|
return output |
|
} |
|
|
|
exports.toByteArray = b64ToByteArray |
|
exports.fromByteArray = uint8ToBase64 |
|
}(typeof exports === 'undefined' ? (this.base64js = {}) : exports)) |
|
|
|
},{}],3:[function(require,module,exports){ |
|
/** |
|
* Determine if an object is Buffer |
|
* |
|
* Author: Feross Aboukhadijeh <feross@feross.org> <http://feross.org> |
|
* License: MIT |
|
* |
|
* `npm install is-buffer` |
|
*/ |
|
|
|
module.exports = function (obj) { |
|
return !!(obj != null && |
|
(obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) |
|
(obj.constructor && |
|
typeof obj.constructor.isBuffer === 'function' && |
|
obj.constructor.isBuffer(obj)) |
|
)) |
|
} |
|
|
|
},{}],4:[function(require,module,exports){ |
|
/** |
|
* Gets the last element of `array`. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Array |
|
* @param {Array} array The array to query. |
|
* @returns {*} Returns the last element of `array`. |
|
* @example |
|
* |
|
* _.last([1, 2, 3]); |
|
* // => 3 |
|
*/ |
|
function last(array) { |
|
var length = array ? array.length : 0; |
|
return length ? array[length - 1] : undefined; |
|
} |
|
|
|
module.exports = last; |
|
|
|
},{}],5:[function(require,module,exports){ |
|
var arrayEvery = require('../internal/arrayEvery'), |
|
baseCallback = require('../internal/baseCallback'), |
|
baseEvery = require('../internal/baseEvery'), |
|
isArray = require('../lang/isArray'), |
|
isIterateeCall = require('../internal/isIterateeCall'); |
|
|
|
/** |
|
* Checks if `predicate` returns truthy for **all** elements of `collection`. |
|
* The predicate is bound to `thisArg` and invoked with three arguments: |
|
* (value, index|key, collection). |
|
* |
|
* If a property name is provided for `predicate` the created `_.property` |
|
* style callback returns the property value of the given element. |
|
* |
|
* If a value is also provided for `thisArg` the created `_.matchesProperty` |
|
* style callback returns `true` for elements that have a matching property |
|
* value, else `false`. |
|
* |
|
* If an object is provided for `predicate` the created `_.matches` style |
|
* callback returns `true` for elements that have the properties of the given |
|
* object, else `false`. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @alias all |
|
* @category Collection |
|
* @param {Array|Object|string} collection The collection to iterate over. |
|
* @param {Function|Object|string} [predicate=_.identity] The function invoked |
|
* per iteration. |
|
* @param {*} [thisArg] The `this` binding of `predicate`. |
|
* @returns {boolean} Returns `true` if all elements pass the predicate check, |
|
* else `false`. |
|
* @example |
|
* |
|
* _.every([true, 1, null, 'yes'], Boolean); |
|
* // => false |
|
* |
|
* var users = [ |
|
* { 'user': 'barney', 'active': false }, |
|
* { 'user': 'fred', 'active': false } |
|
* ]; |
|
* |
|
* // using the `_.matches` callback shorthand |
|
* _.every(users, { 'user': 'barney', 'active': false }); |
|
* // => false |
|
* |
|
* // using the `_.matchesProperty` callback shorthand |
|
* _.every(users, 'active', false); |
|
* // => true |
|
* |
|
* // using the `_.property` callback shorthand |
|
* _.every(users, 'active'); |
|
* // => false |
|
*/ |
|
function every(collection, predicate, thisArg) { |
|
var func = isArray(collection) ? arrayEvery : baseEvery; |
|
if (thisArg && isIterateeCall(collection, predicate, thisArg)) { |
|
predicate = undefined; |
|
} |
|
if (typeof predicate != 'function' || thisArg !== undefined) { |
|
predicate = baseCallback(predicate, thisArg, 3); |
|
} |
|
return func(collection, predicate); |
|
} |
|
|
|
module.exports = every; |
|
|
|
},{"../internal/arrayEvery":7,"../internal/baseCallback":11,"../internal/baseEvery":15,"../internal/isIterateeCall":40,"../lang/isArray":49}],6:[function(require,module,exports){ |
|
/** Used as the `TypeError` message for "Functions" methods. */ |
|
var FUNC_ERROR_TEXT = 'Expected a function'; |
|
|
|
/* Native method references for those with the same name as other `lodash` methods. */ |
|
var nativeMax = Math.max; |
|
|
|
/** |
|
* Creates a function that invokes `func` with the `this` binding of the |
|
* created function and arguments from `start` and beyond provided as an array. |
|
* |
|
* **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters). |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Function |
|
* @param {Function} func The function to apply a rest parameter to. |
|
* @param {number} [start=func.length-1] The start position of the rest parameter. |
|
* @returns {Function} Returns the new function. |
|
* @example |
|
* |
|
* var say = _.restParam(function(what, names) { |
|
* return what + ' ' + _.initial(names).join(', ') + |
|
* (_.size(names) > 1 ? ', & ' : '') + _.last(names); |
|
* }); |
|
* |
|
* say('hello', 'fred', 'barney', 'pebbles'); |
|
* // => 'hello fred, barney, & pebbles' |
|
*/ |
|
function restParam(func, start) { |
|
if (typeof func != 'function') { |
|
throw new TypeError(FUNC_ERROR_TEXT); |
|
} |
|
start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); |
|
return function() { |
|
var args = arguments, |
|
index = -1, |
|
length = nativeMax(args.length - start, 0), |
|
rest = Array(length); |
|
|
|
while (++index < length) { |
|
rest[index] = args[start + index]; |
|
} |
|
switch (start) { |
|
case 0: return func.call(this, rest); |
|
case 1: return func.call(this, args[0], rest); |
|
case 2: return func.call(this, args[0], args[1], rest); |
|
} |
|
var otherArgs = Array(start + 1); |
|
index = -1; |
|
while (++index < start) { |
|
otherArgs[index] = args[index]; |
|
} |
|
otherArgs[start] = rest; |
|
return func.apply(this, otherArgs); |
|
}; |
|
} |
|
|
|
module.exports = restParam; |
|
|
|
},{}],7:[function(require,module,exports){ |
|
/** |
|
* A specialized version of `_.every` for arrays without support for callback |
|
* shorthands and `this` binding. |
|
* |
|
* @private |
|
* @param {Array} array The array to iterate over. |
|
* @param {Function} predicate The function invoked per iteration. |
|
* @returns {boolean} Returns `true` if all elements pass the predicate check, |
|
* else `false`. |
|
*/ |
|
function arrayEvery(array, predicate) { |
|
var index = -1, |
|
length = array.length; |
|
|
|
while (++index < length) { |
|
if (!predicate(array[index], index, array)) { |
|
return false; |
|
} |
|
} |
|
return true; |
|
} |
|
|
|
module.exports = arrayEvery; |
|
|
|
},{}],8:[function(require,module,exports){ |
|
/** |
|
* A specialized version of `_.some` for arrays without support for callback |
|
* shorthands and `this` binding. |
|
* |
|
* @private |
|
* @param {Array} array The array to iterate over. |
|
* @param {Function} predicate The function invoked per iteration. |
|
* @returns {boolean} Returns `true` if any element passes the predicate check, |
|
* else `false`. |
|
*/ |
|
function arraySome(array, predicate) { |
|
var index = -1, |
|
length = array.length; |
|
|
|
while (++index < length) { |
|
if (predicate(array[index], index, array)) { |
|
return true; |
|
} |
|
} |
|
return false; |
|
} |
|
|
|
module.exports = arraySome; |
|
|
|
},{}],9:[function(require,module,exports){ |
|
var keys = require('../object/keys'); |
|
|
|
/** |
|
* A specialized version of `_.assign` for customizing assigned values without |
|
* support for argument juggling, multiple sources, and `this` binding `customizer` |
|
* functions. |
|
* |
|
* @private |
|
* @param {Object} object The destination object. |
|
* @param {Object} source The source object. |
|
* @param {Function} customizer The function to customize assigned values. |
|
* @returns {Object} Returns `object`. |
|
*/ |
|
function assignWith(object, source, customizer) { |
|
var index = -1, |
|
props = keys(source), |
|
length = props.length; |
|
|
|
while (++index < length) { |
|
var key = props[index], |
|
value = object[key], |
|
result = customizer(value, source[key], key, object, source); |
|
|
|
if ((result === result ? (result !== value) : (value === value)) || |
|
(value === undefined && !(key in object))) { |
|
object[key] = result; |
|
} |
|
} |
|
return object; |
|
} |
|
|
|
module.exports = assignWith; |
|
|
|
},{"../object/keys":58}],10:[function(require,module,exports){ |
|
var baseCopy = require('./baseCopy'), |
|
keys = require('../object/keys'); |
|
|
|
/** |
|
* The base implementation of `_.assign` without support for argument juggling, |
|
* multiple sources, and `customizer` functions. |
|
* |
|
* @private |
|
* @param {Object} object The destination object. |
|
* @param {Object} source The source object. |
|
* @returns {Object} Returns `object`. |
|
*/ |
|
function baseAssign(object, source) { |
|
return source == null |
|
? object |
|
: baseCopy(source, keys(source), object); |
|
} |
|
|
|
module.exports = baseAssign; |
|
|
|
},{"../object/keys":58,"./baseCopy":12}],11:[function(require,module,exports){ |
|
var baseMatches = require('./baseMatches'), |
|
baseMatchesProperty = require('./baseMatchesProperty'), |
|
bindCallback = require('./bindCallback'), |
|
identity = require('../utility/identity'), |
|
property = require('../utility/property'); |
|
|
|
/** |
|
* The base implementation of `_.callback` which supports specifying the |
|
* number of arguments to provide to `func`. |
|
* |
|
* @private |
|
* @param {*} [func=_.identity] The value to convert to a callback. |
|
* @param {*} [thisArg] The `this` binding of `func`. |
|
* @param {number} [argCount] The number of arguments to provide to `func`. |
|
* @returns {Function} Returns the callback. |
|
*/ |
|
function baseCallback(func, thisArg, argCount) { |
|
var type = typeof func; |
|
if (type == 'function') { |
|
return thisArg === undefined |
|
? func |
|
: bindCallback(func, thisArg, argCount); |
|
} |
|
if (func == null) { |
|
return identity; |
|
} |
|
if (type == 'object') { |
|
return baseMatches(func); |
|
} |
|
return thisArg === undefined |
|
? property(func) |
|
: baseMatchesProperty(func, thisArg); |
|
} |
|
|
|
module.exports = baseCallback; |
|
|
|
},{"../utility/identity":61,"../utility/property":62,"./baseMatches":22,"./baseMatchesProperty":23,"./bindCallback":28}],12:[function(require,module,exports){ |
|
/** |
|
* Copies properties of `source` to `object`. |
|
* |
|
* @private |
|
* @param {Object} source The object to copy properties from. |
|
* @param {Array} props The property names to copy. |
|
* @param {Object} [object={}] The object to copy properties to. |
|
* @returns {Object} Returns `object`. |
|
*/ |
|
function baseCopy(source, props, object) { |
|
object || (object = {}); |
|
|
|
var index = -1, |
|
length = props.length; |
|
|
|
while (++index < length) { |
|
var key = props[index]; |
|
object[key] = source[key]; |
|
} |
|
return object; |
|
} |
|
|
|
module.exports = baseCopy; |
|
|
|
},{}],13:[function(require,module,exports){ |
|
var isObject = require('../lang/isObject'); |
|
|
|
/** |
|
* The base implementation of `_.create` without support for assigning |
|
* properties to the created object. |
|
* |
|
* @private |
|
* @param {Object} prototype The object to inherit from. |
|
* @returns {Object} Returns the new object. |
|
*/ |
|
var baseCreate = (function() { |
|
function object() {} |
|
return function(prototype) { |
|
if (isObject(prototype)) { |
|
object.prototype = prototype; |
|
var result = new object; |
|
object.prototype = undefined; |
|
} |
|
return result || {}; |
|
}; |
|
}()); |
|
|
|
module.exports = baseCreate; |
|
|
|
},{"../lang/isObject":53}],14:[function(require,module,exports){ |
|
var baseForOwn = require('./baseForOwn'), |
|
createBaseEach = require('./createBaseEach'); |
|
|
|
/** |
|
* The base implementation of `_.forEach` without support for callback |
|
* shorthands and `this` binding. |
|
* |
|
* @private |
|
* @param {Array|Object|string} collection The collection to iterate over. |
|
* @param {Function} iteratee The function invoked per iteration. |
|
* @returns {Array|Object|string} Returns `collection`. |
|
*/ |
|
var baseEach = createBaseEach(baseForOwn); |
|
|
|
module.exports = baseEach; |
|
|
|
},{"./baseForOwn":17,"./createBaseEach":30}],15:[function(require,module,exports){ |
|
var baseEach = require('./baseEach'); |
|
|
|
/** |
|
* The base implementation of `_.every` without support for callback |
|
* shorthands and `this` binding. |
|
* |
|
* @private |
|
* @param {Array|Object|string} collection The collection to iterate over. |
|
* @param {Function} predicate The function invoked per iteration. |
|
* @returns {boolean} Returns `true` if all elements pass the predicate check, |
|
* else `false` |
|
*/ |
|
function baseEvery(collection, predicate) { |
|
var result = true; |
|
baseEach(collection, function(value, index, collection) { |
|
result = !!predicate(value, index, collection); |
|
return result; |
|
}); |
|
return result; |
|
} |
|
|
|
module.exports = baseEvery; |
|
|
|
},{"./baseEach":14}],16:[function(require,module,exports){ |
|
var createBaseFor = require('./createBaseFor'); |
|
|
|
/** |
|
* The base implementation of `baseForIn` and `baseForOwn` which iterates |
|
* over `object` properties returned by `keysFunc` invoking `iteratee` for |
|
* each property. Iteratee functions may exit iteration early by explicitly |
|
* returning `false`. |
|
* |
|
* @private |
|
* @param {Object} object The object to iterate over. |
|
* @param {Function} iteratee The function invoked per iteration. |
|
* @param {Function} keysFunc The function to get the keys of `object`. |
|
* @returns {Object} Returns `object`. |
|
*/ |
|
var baseFor = createBaseFor(); |
|
|
|
module.exports = baseFor; |
|
|
|
},{"./createBaseFor":31}],17:[function(require,module,exports){ |
|
var baseFor = require('./baseFor'), |
|
keys = require('../object/keys'); |
|
|
|
/** |
|
* The base implementation of `_.forOwn` without support for callback |
|
* shorthands and `this` binding. |
|
* |
|
* @private |
|
* @param {Object} object The object to iterate over. |
|
* @param {Function} iteratee The function invoked per iteration. |
|
* @returns {Object} Returns `object`. |
|
*/ |
|
function baseForOwn(object, iteratee) { |
|
return baseFor(object, iteratee, keys); |
|
} |
|
|
|
module.exports = baseForOwn; |
|
|
|
},{"../object/keys":58,"./baseFor":16}],18:[function(require,module,exports){ |
|
var toObject = require('./toObject'); |
|
|
|
/** |
|
* The base implementation of `get` without support for string paths |
|
* and default values. |
|
* |
|
* @private |
|
* @param {Object} object The object to query. |
|
* @param {Array} path The path of the property to get. |
|
* @param {string} [pathKey] The key representation of path. |
|
* @returns {*} Returns the resolved value. |
|
*/ |
|
function baseGet(object, path, pathKey) { |
|
if (object == null) { |
|
return; |
|
} |
|
if (pathKey !== undefined && pathKey in toObject(object)) { |
|
path = [pathKey]; |
|
} |
|
var index = 0, |
|
length = path.length; |
|
|
|
while (object != null && index < length) { |
|
object = object[path[index++]]; |
|
} |
|
return (index && index == length) ? object : undefined; |
|
} |
|
|
|
module.exports = baseGet; |
|
|
|
},{"./toObject":46}],19:[function(require,module,exports){ |
|
var baseIsEqualDeep = require('./baseIsEqualDeep'), |
|
isObject = require('../lang/isObject'), |
|
isObjectLike = require('./isObjectLike'); |
|
|
|
/** |
|
* The base implementation of `_.isEqual` without support for `this` binding |
|
* `customizer` functions. |
|
* |
|
* @private |
|
* @param {*} value The value to compare. |
|
* @param {*} other The other value to compare. |
|
* @param {Function} [customizer] The function to customize comparing values. |
|
* @param {boolean} [isLoose] Specify performing partial comparisons. |
|
* @param {Array} [stackA] Tracks traversed `value` objects. |
|
* @param {Array} [stackB] Tracks traversed `other` objects. |
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`. |
|
*/ |
|
function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { |
|
if (value === other) { |
|
return true; |
|
} |
|
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { |
|
return value !== value && other !== other; |
|
} |
|
return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB); |
|
} |
|
|
|
module.exports = baseIsEqual; |
|
|
|
},{"../lang/isObject":53,"./baseIsEqualDeep":20,"./isObjectLike":43}],20:[function(require,module,exports){ |
|
var equalArrays = require('./equalArrays'), |
|
equalByTag = require('./equalByTag'), |
|
equalObjects = require('./equalObjects'), |
|
isArray = require('../lang/isArray'), |
|
isTypedArray = require('../lang/isTypedArray'); |
|
|
|
/** `Object#toString` result references. */ |
|
var argsTag = '[object Arguments]', |
|
arrayTag = '[object Array]', |
|
objectTag = '[object Object]'; |
|
|
|
/** Used for native method references. */ |
|
var objectProto = Object.prototype; |
|
|
|
/** Used to check objects for own properties. */ |
|
var hasOwnProperty = objectProto.hasOwnProperty; |
|
|
|
/** |
|
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) |
|
* of values. |
|
*/ |
|
var objToString = objectProto.toString; |
|
|
|
/** |
|
* A specialized version of `baseIsEqual` for arrays and objects which performs |
|
* deep comparisons and tracks traversed objects enabling objects with circular |
|
* references to be compared. |
|
* |
|
* @private |
|
* @param {Object} object The object to compare. |
|
* @param {Object} other The other object to compare. |
|
* @param {Function} equalFunc The function to determine equivalents of values. |
|
* @param {Function} [customizer] The function to customize comparing objects. |
|
* @param {boolean} [isLoose] Specify performing partial comparisons. |
|
* @param {Array} [stackA=[]] Tracks traversed `value` objects. |
|
* @param {Array} [stackB=[]] Tracks traversed `other` objects. |
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`. |
|
*/ |
|
function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) { |
|
var objIsArr = isArray(object), |
|
othIsArr = isArray(other), |
|
objTag = arrayTag, |
|
othTag = arrayTag; |
|
|
|
if (!objIsArr) { |
|
objTag = objToString.call(object); |
|
if (objTag == argsTag) { |
|
objTag = objectTag; |
|
} else if (objTag != objectTag) { |
|
objIsArr = isTypedArray(object); |
|
} |
|
} |
|
if (!othIsArr) { |
|
othTag = objToString.call(other); |
|
if (othTag == argsTag) { |
|
othTag = objectTag; |
|
} else if (othTag != objectTag) { |
|
othIsArr = isTypedArray(other); |
|
} |
|
} |
|
var objIsObj = objTag == objectTag, |
|
othIsObj = othTag == objectTag, |
|
isSameTag = objTag == othTag; |
|
|
|
if (isSameTag && !(objIsArr || objIsObj)) { |
|
return equalByTag(object, other, objTag); |
|
} |
|
if (!isLoose) { |
|
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), |
|
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); |
|
|
|
if (objIsWrapped || othIsWrapped) { |
|
return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); |
|
} |
|
} |
|
if (!isSameTag) { |
|
return false; |
|
} |
|
// Assume cyclic values are equal. |
|
// For more information on detecting circular references see https://es5.github.io/#JO. |
|
stackA || (stackA = []); |
|
stackB || (stackB = []); |
|
|
|
var length = stackA.length; |
|
while (length--) { |
|
if (stackA[length] == object) { |
|
return stackB[length] == other; |
|
} |
|
} |
|
// Add `object` and `other` to the stack of traversed objects. |
|
stackA.push(object); |
|
stackB.push(other); |
|
|
|
var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB); |
|
|
|
stackA.pop(); |
|
stackB.pop(); |
|
|
|
return result; |
|
} |
|
|
|
module.exports = baseIsEqualDeep; |
|
|
|
},{"../lang/isArray":49,"../lang/isTypedArray":55,"./equalArrays":32,"./equalByTag":33,"./equalObjects":34}],21:[function(require,module,exports){ |
|
var baseIsEqual = require('./baseIsEqual'), |
|
toObject = require('./toObject'); |
|
|
|
/** |
|
* The base implementation of `_.isMatch` without support for callback |
|
* shorthands and `this` binding. |
|
* |
|
* @private |
|
* @param {Object} object The object to inspect. |
|
* @param {Array} matchData The propery names, values, and compare flags to match. |
|
* @param {Function} [customizer] The function to customize comparing objects. |
|
* @returns {boolean} Returns `true` if `object` is a match, else `false`. |
|
*/ |
|
function baseIsMatch(object, matchData, customizer) { |
|
var index = matchData.length, |
|
length = index, |
|
noCustomizer = !customizer; |
|
|
|
if (object == null) { |
|
return !length; |
|
} |
|
object = toObject(object); |
|
while (index--) { |
|
var data = matchData[index]; |
|
if ((noCustomizer && data[2]) |
|
? data[1] !== object[data[0]] |
|
: !(data[0] in object) |
|
) { |
|
return false; |
|
} |
|
} |
|
while (++index < length) { |
|
data = matchData[index]; |
|
var key = data[0], |
|
objValue = object[key], |
|
srcValue = data[1]; |
|
|
|
if (noCustomizer && data[2]) { |
|
if (objValue === undefined && !(key in object)) { |
|
return false; |
|
} |
|
} else { |
|
var result = customizer ? customizer(objValue, srcValue, key) : undefined; |
|
if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) { |
|
return false; |
|
} |
|
} |
|
} |
|
return true; |
|
} |
|
|
|
module.exports = baseIsMatch; |
|
|
|
},{"./baseIsEqual":19,"./toObject":46}],22:[function(require,module,exports){ |
|
var baseIsMatch = require('./baseIsMatch'), |
|
getMatchData = require('./getMatchData'), |
|
toObject = require('./toObject'); |
|
|
|
/** |
|
* The base implementation of `_.matches` which does not clone `source`. |
|
* |
|
* @private |
|
* @param {Object} source The object of property values to match. |
|
* @returns {Function} Returns the new function. |
|
*/ |
|
function baseMatches(source) { |
|
var matchData = getMatchData(source); |
|
if (matchData.length == 1 && matchData[0][2]) { |
|
var key = matchData[0][0], |
|
value = matchData[0][1]; |
|
|
|
return function(object) { |
|
if (object == null) { |
|
return false; |
|
} |
|
return object[key] === value && (value !== undefined || (key in toObject(object))); |
|
}; |
|
} |
|
return function(object) { |
|
return baseIsMatch(object, matchData); |
|
}; |
|
} |
|
|
|
module.exports = baseMatches; |
|
|
|
},{"./baseIsMatch":21,"./getMatchData":36,"./toObject":46}],23:[function(require,module,exports){ |
|
var baseGet = require('./baseGet'), |
|
baseIsEqual = require('./baseIsEqual'), |
|
baseSlice = require('./baseSlice'), |
|
isArray = require('../lang/isArray'), |
|
isKey = require('./isKey'), |
|
isStrictComparable = require('./isStrictComparable'), |
|
last = require('../array/last'), |
|
toObject = require('./toObject'), |
|
toPath = require('./toPath'); |
|
|
|
/** |
|
* The base implementation of `_.matchesProperty` which does not clone `srcValue`. |
|
* |
|
* @private |
|
* @param {string} path The path of the property to get. |
|
* @param {*} srcValue The value to compare. |
|
* @returns {Function} Returns the new function. |
|
*/ |
|
function baseMatchesProperty(path, srcValue) { |
|
var isArr = isArray(path), |
|
isCommon = isKey(path) && isStrictComparable(srcValue), |
|
pathKey = (path + ''); |
|
|
|
path = toPath(path); |
|
return function(object) { |
|
if (object == null) { |
|
return false; |
|
} |
|
var key = pathKey; |
|
object = toObject(object); |
|
if ((isArr || !isCommon) && !(key in object)) { |
|
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); |
|
if (object == null) { |
|
return false; |
|
} |
|
key = last(path); |
|
object = toObject(object); |
|
} |
|
return object[key] === srcValue |
|
? (srcValue !== undefined || (key in object)) |
|
: baseIsEqual(srcValue, object[key], undefined, true); |
|
}; |
|
} |
|
|
|
module.exports = baseMatchesProperty; |
|
|
|
},{"../array/last":4,"../lang/isArray":49,"./baseGet":18,"./baseIsEqual":19,"./baseSlice":26,"./isKey":41,"./isStrictComparable":44,"./toObject":46,"./toPath":47}],24:[function(require,module,exports){ |
|
/** |
|
* The base implementation of `_.property` without support for deep paths. |
|
* |
|
* @private |
|
* @param {string} key The key of the property to get. |
|
* @returns {Function} Returns the new function. |
|
*/ |
|
function baseProperty(key) { |
|
return function(object) { |
|
return object == null ? undefined : object[key]; |
|
}; |
|
} |
|
|
|
module.exports = baseProperty; |
|
|
|
},{}],25:[function(require,module,exports){ |
|
var baseGet = require('./baseGet'), |
|
toPath = require('./toPath'); |
|
|
|
/** |
|
* A specialized version of `baseProperty` which supports deep paths. |
|
* |
|
* @private |
|
* @param {Array|string} path The path of the property to get. |
|
* @returns {Function} Returns the new function. |
|
*/ |
|
function basePropertyDeep(path) { |
|
var pathKey = (path + ''); |
|
path = toPath(path); |
|
return function(object) { |
|
return baseGet(object, path, pathKey); |
|
}; |
|
} |
|
|
|
module.exports = basePropertyDeep; |
|
|
|
},{"./baseGet":18,"./toPath":47}],26:[function(require,module,exports){ |
|
/** |
|
* The base implementation of `_.slice` without an iteratee call guard. |
|
* |
|
* @private |
|
* @param {Array} array The array to slice. |
|
* @param {number} [start=0] The start position. |
|
* @param {number} [end=array.length] The end position. |
|
* @returns {Array} Returns the slice of `array`. |
|
*/ |
|
function baseSlice(array, start, end) { |
|
var index = -1, |
|
length = array.length; |
|
|
|
start = start == null ? 0 : (+start || 0); |
|
if (start < 0) { |
|
start = -start > length ? 0 : (length + start); |
|
} |
|
end = (end === undefined || end > length) ? length : (+end || 0); |
|
if (end < 0) { |
|
end += length; |
|
} |
|
length = start > end ? 0 : ((end - start) >>> 0); |
|
start >>>= 0; |
|
|
|
var result = Array(length); |
|
while (++index < length) { |
|
result[index] = array[index + start]; |
|
} |
|
return result; |
|
} |
|
|
|
module.exports = baseSlice; |
|
|
|
},{}],27:[function(require,module,exports){ |
|
/** |
|
* Converts `value` to a string if it's not one. An empty string is returned |
|
* for `null` or `undefined` values. |
|
* |
|
* @private |
|
* @param {*} value The value to process. |
|
* @returns {string} Returns the string. |
|
*/ |
|
function baseToString(value) { |
|
return value == null ? '' : (value + ''); |
|
} |
|
|
|
module.exports = baseToString; |
|
|
|
},{}],28:[function(require,module,exports){ |
|
var identity = require('../utility/identity'); |
|
|
|
/** |
|
* A specialized version of `baseCallback` which only supports `this` binding |
|
* and specifying the number of arguments to provide to `func`. |
|
* |
|
* @private |
|
* @param {Function} func The function to bind. |
|
* @param {*} thisArg The `this` binding of `func`. |
|
* @param {number} [argCount] The number of arguments to provide to `func`. |
|
* @returns {Function} Returns the callback. |
|
*/ |
|
function bindCallback(func, thisArg, argCount) { |
|
if (typeof func != 'function') { |
|
return identity; |
|
} |
|
if (thisArg === undefined) { |
|
return func; |
|
} |
|
switch (argCount) { |
|
case 1: return function(value) { |
|
return func.call(thisArg, value); |
|
}; |
|
case 3: return function(value, index, collection) { |
|
return func.call(thisArg, value, index, collection); |
|
}; |
|
case 4: return function(accumulator, value, index, collection) { |
|
return func.call(thisArg, accumulator, value, index, collection); |
|
}; |
|
case 5: return function(value, other, key, object, source) { |
|
return func.call(thisArg, value, other, key, object, source); |
|
}; |
|
} |
|
return function() { |
|
return func.apply(thisArg, arguments); |
|
}; |
|
} |
|
|
|
module.exports = bindCallback; |
|
|
|
},{"../utility/identity":61}],29:[function(require,module,exports){ |
|
var bindCallback = require('./bindCallback'), |
|
isIterateeCall = require('./isIterateeCall'), |
|
restParam = require('../function/restParam'); |
|
|
|
/** |
|
* Creates a `_.assign`, `_.defaults`, or `_.merge` function. |
|
* |
|
* @private |
|
* @param {Function} assigner The function to assign values. |
|
* @returns {Function} Returns the new assigner function. |
|
*/ |
|
function createAssigner(assigner) { |
|
return restParam(function(object, sources) { |
|
var index = -1, |
|
length = object == null ? 0 : sources.length, |
|
customizer = length > 2 ? sources[length - 2] : undefined, |
|
guard = length > 2 ? sources[2] : undefined, |
|
thisArg = length > 1 ? sources[length - 1] : undefined; |
|
|
|
if (typeof customizer == 'function') { |
|
customizer = bindCallback(customizer, thisArg, 5); |
|
length -= 2; |
|
} else { |
|
customizer = typeof thisArg == 'function' ? thisArg : undefined; |
|
length -= (customizer ? 1 : 0); |
|
} |
|
if (guard && isIterateeCall(sources[0], sources[1], guard)) { |
|
customizer = length < 3 ? undefined : customizer; |
|
length = 1; |
|
} |
|
while (++index < length) { |
|
var source = sources[index]; |
|
if (source) { |
|
assigner(object, source, customizer); |
|
} |
|
} |
|
return object; |
|
}); |
|
} |
|
|
|
module.exports = createAssigner; |
|
|
|
},{"../function/restParam":6,"./bindCallback":28,"./isIterateeCall":40}],30:[function(require,module,exports){ |
|
var getLength = require('./getLength'), |
|
isLength = require('./isLength'), |
|
toObject = require('./toObject'); |
|
|
|
/** |
|
* Creates a `baseEach` or `baseEachRight` function. |
|
* |
|
* @private |
|
* @param {Function} eachFunc The function to iterate over a collection. |
|
* @param {boolean} [fromRight] Specify iterating from right to left. |
|
* @returns {Function} Returns the new base function. |
|
*/ |
|
function createBaseEach(eachFunc, fromRight) { |
|
return function(collection, iteratee) { |
|
var length = collection ? getLength(collection) : 0; |
|
if (!isLength(length)) { |
|
return eachFunc(collection, iteratee); |
|
} |
|
var index = fromRight ? length : -1, |
|
iterable = toObject(collection); |
|
|
|
while ((fromRight ? index-- : ++index < length)) { |
|
if (iteratee(iterable[index], index, iterable) === false) { |
|
break; |
|
} |
|
} |
|
return collection; |
|
}; |
|
} |
|
|
|
module.exports = createBaseEach; |
|
|
|
},{"./getLength":35,"./isLength":42,"./toObject":46}],31:[function(require,module,exports){ |
|
var toObject = require('./toObject'); |
|
|
|
/** |
|
* Creates a base function for `_.forIn` or `_.forInRight`. |
|
* |
|
* @private |
|
* @param {boolean} [fromRight] Specify iterating from right to left. |
|
* @returns {Function} Returns the new base function. |
|
*/ |
|
function createBaseFor(fromRight) { |
|
return function(object, iteratee, keysFunc) { |
|
var iterable = toObject(object), |
|
props = keysFunc(object), |
|
length = props.length, |
|
index = fromRight ? length : -1; |
|
|
|
while ((fromRight ? index-- : ++index < length)) { |
|
var key = props[index]; |
|
if (iteratee(iterable[key], key, iterable) === false) { |
|
break; |
|
} |
|
} |
|
return object; |
|
}; |
|
} |
|
|
|
module.exports = createBaseFor; |
|
|
|
},{"./toObject":46}],32:[function(require,module,exports){ |
|
var arraySome = require('./arraySome'); |
|
|
|
/** |
|
* A specialized version of `baseIsEqualDeep` for arrays with support for |
|
* partial deep comparisons. |
|
* |
|
* @private |
|
* @param {Array} array The array to compare. |
|
* @param {Array} other The other array to compare. |
|
* @param {Function} equalFunc The function to determine equivalents of values. |
|
* @param {Function} [customizer] The function to customize comparing arrays. |
|
* @param {boolean} [isLoose] Specify performing partial comparisons. |
|
* @param {Array} [stackA] Tracks traversed `value` objects. |
|
* @param {Array} [stackB] Tracks traversed `other` objects. |
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. |
|
*/ |
|
function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { |
|
var index = -1, |
|
arrLength = array.length, |
|
othLength = other.length; |
|
|
|
if (arrLength != othLength && !(isLoose && othLength > arrLength)) { |
|
return false; |
|
} |
|
// Ignore non-index properties. |
|
while (++index < arrLength) { |
|
var arrValue = array[index], |
|
othValue = other[index], |
|
result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined; |
|
|
|
if (result !== undefined) { |
|
if (result) { |
|
continue; |
|
} |
|
return false; |
|
} |
|
// Recursively compare arrays (susceptible to call stack limits). |
|
if (isLoose) { |
|
if (!arraySome(other, function(othValue) { |
|
return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); |
|
})) { |
|
return false; |
|
} |
|
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) { |
|
return false; |
|
} |
|
} |
|
return true; |
|
} |
|
|
|
module.exports = equalArrays; |
|
|
|
},{"./arraySome":8}],33:[function(require,module,exports){ |
|
/** `Object#toString` result references. */ |
|
var boolTag = '[object Boolean]', |
|
dateTag = '[object Date]', |
|
errorTag = '[object Error]', |
|
numberTag = '[object Number]', |
|
regexpTag = '[object RegExp]', |
|
stringTag = '[object String]'; |
|
|
|
/** |
|
* A specialized version of `baseIsEqualDeep` for comparing objects of |
|
* the same `toStringTag`. |
|
* |
|
* **Note:** This function only supports comparing values with tags of |
|
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. |
|
* |
|
* @private |
|
* @param {Object} object The object to compare. |
|
* @param {Object} other The other object to compare. |
|
* @param {string} tag The `toStringTag` of the objects to compare. |
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`. |
|
*/ |
|
function equalByTag(object, other, tag) { |
|
switch (tag) { |
|
case boolTag: |
|
case dateTag: |
|
// Coerce dates and booleans to numbers, dates to milliseconds and booleans |
|
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal. |
|
return +object == +other; |
|
|
|
case errorTag: |
|
return object.name == other.name && object.message == other.message; |
|
|
|
case numberTag: |
|
// Treat `NaN` vs. `NaN` as equal. |
|
return (object != +object) |
|
? other != +other |
|
: object == +other; |
|
|
|
case regexpTag: |
|
case stringTag: |
|
// Coerce regexes to strings and treat strings primitives and string |
|
// objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. |
|
return object == (other + ''); |
|
} |
|
return false; |
|
} |
|
|
|
module.exports = equalByTag; |
|
|
|
},{}],34:[function(require,module,exports){ |
|
var keys = require('../object/keys'); |
|
|
|
/** Used for native method references. */ |
|
var objectProto = Object.prototype; |
|
|
|
/** Used to check objects for own properties. */ |
|
var hasOwnProperty = objectProto.hasOwnProperty; |
|
|
|
/** |
|
* A specialized version of `baseIsEqualDeep` for objects with support for |
|
* partial deep comparisons. |
|
* |
|
* @private |
|
* @param {Object} object The object to compare. |
|
* @param {Object} other The other object to compare. |
|
* @param {Function} equalFunc The function to determine equivalents of values. |
|
* @param {Function} [customizer] The function to customize comparing values. |
|
* @param {boolean} [isLoose] Specify performing partial comparisons. |
|
* @param {Array} [stackA] Tracks traversed `value` objects. |
|
* @param {Array} [stackB] Tracks traversed `other` objects. |
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`. |
|
*/ |
|
function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) { |
|
var objProps = keys(object), |
|
objLength = objProps.length, |
|
othProps = keys(other), |
|
othLength = othProps.length; |
|
|
|
if (objLength != othLength && !isLoose) { |
|
return false; |
|
} |
|
var index = objLength; |
|
while (index--) { |
|
var key = objProps[index]; |
|
if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) { |
|
return false; |
|
} |
|
} |
|
var skipCtor = isLoose; |
|
while (++index < objLength) { |
|
key = objProps[index]; |
|
var objValue = object[key], |
|
othValue = other[key], |
|
result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined; |
|
|
|
// Recursively compare objects (susceptible to call stack limits). |
|
if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) { |
|
return false; |
|
} |
|
skipCtor || (skipCtor = key == 'constructor'); |
|
} |
|
if (!skipCtor) { |
|
var objCtor = object.constructor, |
|
othCtor = other.constructor; |
|
|
|
// Non `Object` object instances with different constructors are not equal. |
|
if (objCtor != othCtor && |
|
('constructor' in object && 'constructor' in other) && |
|
!(typeof objCtor == 'function' && objCtor instanceof objCtor && |
|
typeof othCtor == 'function' && othCtor instanceof othCtor)) { |
|
return false; |
|
} |
|
} |
|
return true; |
|
} |
|
|
|
module.exports = equalObjects; |
|
|
|
},{"../object/keys":58}],35:[function(require,module,exports){ |
|
var baseProperty = require('./baseProperty'); |
|
|
|
/** |
|
* Gets the "length" property value of `object`. |
|
* |
|
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) |
|
* that affects Safari on at least iOS 8.1-8.3 ARM64. |
|
* |
|
* @private |
|
* @param {Object} object The object to query. |
|
* @returns {*} Returns the "length" value. |
|
*/ |
|
var getLength = baseProperty('length'); |
|
|
|
module.exports = getLength; |
|
|
|
},{"./baseProperty":24}],36:[function(require,module,exports){ |
|
var isStrictComparable = require('./isStrictComparable'), |
|
pairs = require('../object/pairs'); |
|
|
|
/** |
|
* Gets the propery names, values, and compare flags of `object`. |
|
* |
|
* @private |
|
* @param {Object} object The object to query. |
|
* @returns {Array} Returns the match data of `object`. |
|
*/ |
|
function getMatchData(object) { |
|
var result = pairs(object), |
|
length = result.length; |
|
|
|
while (length--) { |
|
result[length][2] = isStrictComparable(result[length][1]); |
|
} |
|
return result; |
|
} |
|
|
|
module.exports = getMatchData; |
|
|
|
},{"../object/pairs":60,"./isStrictComparable":44}],37:[function(require,module,exports){ |
|
var isNative = require('../lang/isNative'); |
|
|
|
/** |
|
* Gets the native function at `key` of `object`. |
|
* |
|
* @private |
|
* @param {Object} object The object to query. |
|
* @param {string} key The key of the method to get. |
|
* @returns {*} Returns the function if it's native, else `undefined`. |
|
*/ |
|
function getNative(object, key) { |
|
var value = object == null ? undefined : object[key]; |
|
return isNative(value) ? value : undefined; |
|
} |
|
|
|
module.exports = getNative; |
|
|
|
},{"../lang/isNative":52}],38:[function(require,module,exports){ |
|
var getLength = require('./getLength'), |
|
isLength = require('./isLength'); |
|
|
|
/** |
|
* Checks if `value` is array-like. |
|
* |
|
* @private |
|
* @param {*} value The value to check. |
|
* @returns {boolean} Returns `true` if `value` is array-like, else `false`. |
|
*/ |
|
function isArrayLike(value) { |
|
return value != null && isLength(getLength(value)); |
|
} |
|
|
|
module.exports = isArrayLike; |
|
|
|
},{"./getLength":35,"./isLength":42}],39:[function(require,module,exports){ |
|
/** Used to detect unsigned integer values. */ |
|
var reIsUint = /^\d+$/; |
|
|
|
/** |
|
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) |
|
* of an array-like value. |
|
*/ |
|
var MAX_SAFE_INTEGER = 9007199254740991; |
|
|
|
/** |
|
* Checks if `value` is a valid array-like index. |
|
* |
|
* @private |
|
* @param {*} value The value to check. |
|
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. |
|
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`. |
|
*/ |
|
function isIndex(value, length) { |
|
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; |
|
length = length == null ? MAX_SAFE_INTEGER : length; |
|
return value > -1 && value % 1 == 0 && value < length; |
|
} |
|
|
|
module.exports = isIndex; |
|
|
|
},{}],40:[function(require,module,exports){ |
|
var isArrayLike = require('./isArrayLike'), |
|
isIndex = require('./isIndex'), |
|
isObject = require('../lang/isObject'); |
|
|
|
/** |
|
* Checks if the provided arguments are from an iteratee call. |
|
* |
|
* @private |
|
* @param {*} value The potential iteratee value argument. |
|
* @param {*} index The potential iteratee index or key argument. |
|
* @param {*} object The potential iteratee object argument. |
|
* @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. |
|
*/ |
|
function isIterateeCall(value, index, object) { |
|
if (!isObject(object)) { |
|
return false; |
|
} |
|
var type = typeof index; |
|
if (type == 'number' |
|
? (isArrayLike(object) && isIndex(index, object.length)) |
|
: (type == 'string' && index in object)) { |
|
var other = object[index]; |
|
return value === value ? (value === other) : (other !== other); |
|
} |
|
return false; |
|
} |
|
|
|
module.exports = isIterateeCall; |
|
|
|
},{"../lang/isObject":53,"./isArrayLike":38,"./isIndex":39}],41:[function(require,module,exports){ |
|
var isArray = require('../lang/isArray'), |
|
toObject = require('./toObject'); |
|
|
|
/** Used to match property names within property paths. */ |
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, |
|
reIsPlainProp = /^\w*$/; |
|
|
|
/** |
|
* Checks if `value` is a property name and not a property path. |
|
* |
|
* @private |
|
* @param {*} value The value to check. |
|
* @param {Object} [object] The object to query keys on. |
|
* @returns {boolean} Returns `true` if `value` is a property name, else `false`. |
|
*/ |
|
function isKey(value, object) { |
|
var type = typeof value; |
|
if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { |
|
return true; |
|
} |
|
if (isArray(value)) { |
|
return false; |
|
} |
|
var result = !reIsDeepProp.test(value); |
|
return result || (object != null && value in toObject(object)); |
|
} |
|
|
|
module.exports = isKey; |
|
|
|
},{"../lang/isArray":49,"./toObject":46}],42:[function(require,module,exports){ |
|
/** |
|
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) |
|
* of an array-like value. |
|
*/ |
|
var MAX_SAFE_INTEGER = 9007199254740991; |
|
|
|
/** |
|
* Checks if `value` is a valid array-like length. |
|
* |
|
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). |
|
* |
|
* @private |
|
* @param {*} value The value to check. |
|
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`. |
|
*/ |
|
function isLength(value) { |
|
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; |
|
} |
|
|
|
module.exports = isLength; |
|
|
|
},{}],43:[function(require,module,exports){ |
|
/** |
|
* Checks if `value` is object-like. |
|
* |
|
* @private |
|
* @param {*} value The value to check. |
|
* @returns {boolean} Returns `true` if `value` is object-like, else `false`. |
|
*/ |
|
function isObjectLike(value) { |
|
return !!value && typeof value == 'object'; |
|
} |
|
|
|
module.exports = isObjectLike; |
|
|
|
},{}],44:[function(require,module,exports){ |
|
var isObject = require('../lang/isObject'); |
|
|
|
/** |
|
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`. |
|
* |
|
* @private |
|
* @param {*} value The value to check. |
|
* @returns {boolean} Returns `true` if `value` if suitable for strict |
|
* equality comparisons, else `false`. |
|
*/ |
|
function isStrictComparable(value) { |
|
return value === value && !isObject(value); |
|
} |
|
|
|
module.exports = isStrictComparable; |
|
|
|
},{"../lang/isObject":53}],45:[function(require,module,exports){ |
|
var isArguments = require('../lang/isArguments'), |
|
isArray = require('../lang/isArray'), |
|
isIndex = require('./isIndex'), |
|
isLength = require('./isLength'), |
|
keysIn = require('../object/keysIn'); |
|
|
|
/** Used for native method references. */ |
|
var objectProto = Object.prototype; |
|
|
|
/** Used to check objects for own properties. */ |
|
var hasOwnProperty = objectProto.hasOwnProperty; |
|
|
|
/** |
|
* A fallback implementation of `Object.keys` which creates an array of the |
|
* own enumerable property names of `object`. |
|
* |
|
* @private |
|
* @param {Object} object The object to query. |
|
* @returns {Array} Returns the array of property names. |
|
*/ |
|
function shimKeys(object) { |
|
var props = keysIn(object), |
|
propsLength = props.length, |
|
length = propsLength && object.length; |
|
|
|
var allowIndexes = !!length && isLength(length) && |
|
(isArray(object) || isArguments(object)); |
|
|
|
var index = -1, |
|
result = []; |
|
|
|
while (++index < propsLength) { |
|
var key = props[index]; |
|
if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { |
|
result.push(key); |
|
} |
|
} |
|
return result; |
|
} |
|
|
|
module.exports = shimKeys; |
|
|
|
},{"../lang/isArguments":48,"../lang/isArray":49,"../object/keysIn":59,"./isIndex":39,"./isLength":42}],46:[function(require,module,exports){ |
|
var isObject = require('../lang/isObject'); |
|
|
|
/** |
|
* Converts `value` to an object if it's not one. |
|
* |
|
* @private |
|
* @param {*} value The value to process. |
|
* @returns {Object} Returns the object. |
|
*/ |
|
function toObject(value) { |
|
return isObject(value) ? value : Object(value); |
|
} |
|
|
|
module.exports = toObject; |
|
|
|
},{"../lang/isObject":53}],47:[function(require,module,exports){ |
|
var baseToString = require('./baseToString'), |
|
isArray = require('../lang/isArray'); |
|
|
|
/** Used to match property names within property paths. */ |
|
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; |
|
|
|
/** Used to match backslashes in property paths. */ |
|
var reEscapeChar = /\\(\\)?/g; |
|
|
|
/** |
|
* Converts `value` to property path array if it's not one. |
|
* |
|
* @private |
|
* @param {*} value The value to process. |
|
* @returns {Array} Returns the property path array. |
|
*/ |
|
function toPath(value) { |
|
if (isArray(value)) { |
|
return value; |
|
} |
|
var result = []; |
|
baseToString(value).replace(rePropName, function(match, number, quote, string) { |
|
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); |
|
}); |
|
return result; |
|
} |
|
|
|
module.exports = toPath; |
|
|
|
},{"../lang/isArray":49,"./baseToString":27}],48:[function(require,module,exports){ |
|
var isArrayLike = require('../internal/isArrayLike'), |
|
isObjectLike = require('../internal/isObjectLike'); |
|
|
|
/** Used for native method references. */ |
|
var objectProto = Object.prototype; |
|
|
|
/** Used to check objects for own properties. */ |
|
var hasOwnProperty = objectProto.hasOwnProperty; |
|
|
|
/** Native method references. */ |
|
var propertyIsEnumerable = objectProto.propertyIsEnumerable; |
|
|
|
/** |
|
* Checks if `value` is classified as an `arguments` object. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Lang |
|
* @param {*} value The value to check. |
|
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. |
|
* @example |
|
* |
|
* _.isArguments(function() { return arguments; }()); |
|
* // => true |
|
* |
|
* _.isArguments([1, 2, 3]); |
|
* // => false |
|
*/ |
|
function isArguments(value) { |
|
return isObjectLike(value) && isArrayLike(value) && |
|
hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); |
|
} |
|
|
|
module.exports = isArguments; |
|
|
|
},{"../internal/isArrayLike":38,"../internal/isObjectLike":43}],49:[function(require,module,exports){ |
|
var getNative = require('../internal/getNative'), |
|
isLength = require('../internal/isLength'), |
|
isObjectLike = require('../internal/isObjectLike'); |
|
|
|
/** `Object#toString` result references. */ |
|
var arrayTag = '[object Array]'; |
|
|
|
/** Used for native method references. */ |
|
var objectProto = Object.prototype; |
|
|
|
/** |
|
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) |
|
* of values. |
|
*/ |
|
var objToString = objectProto.toString; |
|
|
|
/* Native method references for those with the same name as other `lodash` methods. */ |
|
var nativeIsArray = getNative(Array, 'isArray'); |
|
|
|
/** |
|
* Checks if `value` is classified as an `Array` object. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Lang |
|
* @param {*} value The value to check. |
|
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. |
|
* @example |
|
* |
|
* _.isArray([1, 2, 3]); |
|
* // => true |
|
* |
|
* _.isArray(function() { return arguments; }()); |
|
* // => false |
|
*/ |
|
var isArray = nativeIsArray || function(value) { |
|
return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; |
|
}; |
|
|
|
module.exports = isArray; |
|
|
|
},{"../internal/getNative":37,"../internal/isLength":42,"../internal/isObjectLike":43}],50:[function(require,module,exports){ |
|
var isArguments = require('./isArguments'), |
|
isArray = require('./isArray'), |
|
isArrayLike = require('../internal/isArrayLike'), |
|
isFunction = require('./isFunction'), |
|
isObjectLike = require('../internal/isObjectLike'), |
|
isString = require('./isString'), |
|
keys = require('../object/keys'); |
|
|
|
/** |
|
* Checks if `value` is empty. A value is considered empty unless it's an |
|
* `arguments` object, array, string, or jQuery-like collection with a length |
|
* greater than `0` or an object with own enumerable properties. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Lang |
|
* @param {Array|Object|string} value The value to inspect. |
|
* @returns {boolean} Returns `true` if `value` is empty, else `false`. |
|
* @example |
|
* |
|
* _.isEmpty(null); |
|
* // => true |
|
* |
|
* _.isEmpty(true); |
|
* // => true |
|
* |
|
* _.isEmpty(1); |
|
* // => true |
|
* |
|
* _.isEmpty([1, 2, 3]); |
|
* // => false |
|
* |
|
* _.isEmpty({ 'a': 1 }); |
|
* // => false |
|
*/ |
|
function isEmpty(value) { |
|
if (value == null) { |
|
return true; |
|
} |
|
if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) || |
|
(isObjectLike(value) && isFunction(value.splice)))) { |
|
return !value.length; |
|
} |
|
return !keys(value).length; |
|
} |
|
|
|
module.exports = isEmpty; |
|
|
|
},{"../internal/isArrayLike":38,"../internal/isObjectLike":43,"../object/keys":58,"./isArguments":48,"./isArray":49,"./isFunction":51,"./isString":54}],51:[function(require,module,exports){ |
|
var isObject = require('./isObject'); |
|
|
|
/** `Object#toString` result references. */ |
|
var funcTag = '[object Function]'; |
|
|
|
/** Used for native method references. */ |
|
var objectProto = Object.prototype; |
|
|
|
/** |
|
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) |
|
* of values. |
|
*/ |
|
var objToString = objectProto.toString; |
|
|
|
/** |
|
* Checks if `value` is classified as a `Function` object. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Lang |
|
* @param {*} value The value to check. |
|
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. |
|
* @example |
|
* |
|
* _.isFunction(_); |
|
* // => true |
|
* |
|
* _.isFunction(/abc/); |
|
* // => false |
|
*/ |
|
function isFunction(value) { |
|
// The use of `Object#toString` avoids issues with the `typeof` operator |
|
// in older versions of Chrome and Safari which return 'function' for regexes |
|
// and Safari 8 which returns 'object' for typed array constructors. |
|
return isObject(value) && objToString.call(value) == funcTag; |
|
} |
|
|
|
module.exports = isFunction; |
|
|
|
},{"./isObject":53}],52:[function(require,module,exports){ |
|
var isFunction = require('./isFunction'), |
|
isObjectLike = require('../internal/isObjectLike'); |
|
|
|
/** Used to detect host constructors (Safari > 5). */ |
|
var reIsHostCtor = /^\[object .+?Constructor\]$/; |
|
|
|
/** Used for native method references. */ |
|
var objectProto = Object.prototype; |
|
|
|
/** Used to resolve the decompiled source of functions. */ |
|
var fnToString = Function.prototype.toString; |
|
|
|
/** Used to check objects for own properties. */ |
|
var hasOwnProperty = objectProto.hasOwnProperty; |
|
|
|
/** Used to detect if a method is native. */ |
|
var reIsNative = RegExp('^' + |
|
fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') |
|
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' |
|
); |
|
|
|
/** |
|
* Checks if `value` is a native function. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Lang |
|
* @param {*} value The value to check. |
|
* @returns {boolean} Returns `true` if `value` is a native function, else `false`. |
|
* @example |
|
* |
|
* _.isNative(Array.prototype.push); |
|
* // => true |
|
* |
|
* _.isNative(_); |
|
* // => false |
|
*/ |
|
function isNative(value) { |
|
if (value == null) { |
|
return false; |
|
} |
|
if (isFunction(value)) { |
|
return reIsNative.test(fnToString.call(value)); |
|
} |
|
return isObjectLike(value) && reIsHostCtor.test(value); |
|
} |
|
|
|
module.exports = isNative; |
|
|
|
},{"../internal/isObjectLike":43,"./isFunction":51}],53:[function(require,module,exports){ |
|
/** |
|
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. |
|
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Lang |
|
* @param {*} value The value to check. |
|
* @returns {boolean} Returns `true` if `value` is an object, else `false`. |
|
* @example |
|
* |
|
* _.isObject({}); |
|
* // => true |
|
* |
|
* _.isObject([1, 2, 3]); |
|
* // => true |
|
* |
|
* _.isObject(1); |
|
* // => false |
|
*/ |
|
function isObject(value) { |
|
// Avoid a V8 JIT bug in Chrome 19-20. |
|
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details. |
|
var type = typeof value; |
|
return !!value && (type == 'object' || type == 'function'); |
|
} |
|
|
|
module.exports = isObject; |
|
|
|
},{}],54:[function(require,module,exports){ |
|
var isObjectLike = require('../internal/isObjectLike'); |
|
|
|
/** `Object#toString` result references. */ |
|
var stringTag = '[object String]'; |
|
|
|
/** Used for native method references. */ |
|
var objectProto = Object.prototype; |
|
|
|
/** |
|
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) |
|
* of values. |
|
*/ |
|
var objToString = objectProto.toString; |
|
|
|
/** |
|
* Checks if `value` is classified as a `String` primitive or object. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Lang |
|
* @param {*} value The value to check. |
|
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. |
|
* @example |
|
* |
|
* _.isString('abc'); |
|
* // => true |
|
* |
|
* _.isString(1); |
|
* // => false |
|
*/ |
|
function isString(value) { |
|
return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag); |
|
} |
|
|
|
module.exports = isString; |
|
|
|
},{"../internal/isObjectLike":43}],55:[function(require,module,exports){ |
|
var isLength = require('../internal/isLength'), |
|
isObjectLike = require('../internal/isObjectLike'); |
|
|
|
/** `Object#toString` result references. */ |
|
var argsTag = '[object Arguments]', |
|
arrayTag = '[object Array]', |
|
boolTag = '[object Boolean]', |
|
dateTag = '[object Date]', |
|
errorTag = '[object Error]', |
|
funcTag = '[object Function]', |
|
mapTag = '[object Map]', |
|
numberTag = '[object Number]', |
|
objectTag = '[object Object]', |
|
regexpTag = '[object RegExp]', |
|
setTag = '[object Set]', |
|
stringTag = '[object String]', |
|
weakMapTag = '[object WeakMap]'; |
|
|
|
var arrayBufferTag = '[object ArrayBuffer]', |
|
float32Tag = '[object Float32Array]', |
|
float64Tag = '[object Float64Array]', |
|
int8Tag = '[object Int8Array]', |
|
int16Tag = '[object Int16Array]', |
|
int32Tag = '[object Int32Array]', |
|
uint8Tag = '[object Uint8Array]', |
|
uint8ClampedTag = '[object Uint8ClampedArray]', |
|
uint16Tag = '[object Uint16Array]', |
|
uint32Tag = '[object Uint32Array]'; |
|
|
|
/** Used to identify `toStringTag` values of typed arrays. */ |
|
var typedArrayTags = {}; |
|
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = |
|
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = |
|
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = |
|
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = |
|
typedArrayTags[uint32Tag] = true; |
|
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = |
|
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = |
|
typedArrayTags[dateTag] = typedArrayTags[errorTag] = |
|
typedArrayTags[funcTag] = typedArrayTags[mapTag] = |
|
typedArrayTags[numberTag] = typedArrayTags[objectTag] = |
|
typedArrayTags[regexpTag] = typedArrayTags[setTag] = |
|
typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; |
|
|
|
/** Used for native method references. */ |
|
var objectProto = Object.prototype; |
|
|
|
/** |
|
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) |
|
* of values. |
|
*/ |
|
var objToString = objectProto.toString; |
|
|
|
/** |
|
* Checks if `value` is classified as a typed array. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Lang |
|
* @param {*} value The value to check. |
|
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. |
|
* @example |
|
* |
|
* _.isTypedArray(new Uint8Array); |
|
* // => true |
|
* |
|
* _.isTypedArray([]); |
|
* // => false |
|
*/ |
|
function isTypedArray(value) { |
|
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)]; |
|
} |
|
|
|
module.exports = isTypedArray; |
|
|
|
},{"../internal/isLength":42,"../internal/isObjectLike":43}],56:[function(require,module,exports){ |
|
var assignWith = require('../internal/assignWith'), |
|
baseAssign = require('../internal/baseAssign'), |
|
createAssigner = require('../internal/createAssigner'); |
|
|
|
/** |
|
* Assigns own enumerable properties of source object(s) to the destination |
|
* object. Subsequent sources overwrite property assignments of previous sources. |
|
* If `customizer` is provided it's invoked to produce the assigned values. |
|
* The `customizer` is bound to `thisArg` and invoked with five arguments: |
|
* (objectValue, sourceValue, key, object, source). |
|
* |
|
* **Note:** This method mutates `object` and is based on |
|
* [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign). |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @alias extend |
|
* @category Object |
|
* @param {Object} object The destination object. |
|
* @param {...Object} [sources] The source objects. |
|
* @param {Function} [customizer] The function to customize assigned values. |
|
* @param {*} [thisArg] The `this` binding of `customizer`. |
|
* @returns {Object} Returns `object`. |
|
* @example |
|
* |
|
* _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' }); |
|
* // => { 'user': 'fred', 'age': 40 } |
|
* |
|
* // using a customizer callback |
|
* var defaults = _.partialRight(_.assign, function(value, other) { |
|
* return _.isUndefined(value) ? other : value; |
|
* }); |
|
* |
|
* defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); |
|
* // => { 'user': 'barney', 'age': 36 } |
|
*/ |
|
var assign = createAssigner(function(object, source, customizer) { |
|
return customizer |
|
? assignWith(object, source, customizer) |
|
: baseAssign(object, source); |
|
}); |
|
|
|
module.exports = assign; |
|
|
|
},{"../internal/assignWith":9,"../internal/baseAssign":10,"../internal/createAssigner":29}],57:[function(require,module,exports){ |
|
var baseAssign = require('../internal/baseAssign'), |
|
baseCreate = require('../internal/baseCreate'), |
|
isIterateeCall = require('../internal/isIterateeCall'); |
|
|
|
/** |
|
* Creates an object that inherits from the given `prototype` object. If a |
|
* `properties` object is provided its own enumerable properties are assigned |
|
* to the created object. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Object |
|
* @param {Object} prototype The object to inherit from. |
|
* @param {Object} [properties] The properties to assign to the object. |
|
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`. |
|
* @returns {Object} Returns the new object. |
|
* @example |
|
* |
|
* function Shape() { |
|
* this.x = 0; |
|
* this.y = 0; |
|
* } |
|
* |
|
* function Circle() { |
|
* Shape.call(this); |
|
* } |
|
* |
|
* Circle.prototype = _.create(Shape.prototype, { |
|
* 'constructor': Circle |
|
* }); |
|
* |
|
* var circle = new Circle; |
|
* circle instanceof Circle; |
|
* // => true |
|
* |
|
* circle instanceof Shape; |
|
* // => true |
|
*/ |
|
function create(prototype, properties, guard) { |
|
var result = baseCreate(prototype); |
|
if (guard && isIterateeCall(prototype, properties, guard)) { |
|
properties = undefined; |
|
} |
|
return properties ? baseAssign(result, properties) : result; |
|
} |
|
|
|
module.exports = create; |
|
|
|
},{"../internal/baseAssign":10,"../internal/baseCreate":13,"../internal/isIterateeCall":40}],58:[function(require,module,exports){ |
|
var getNative = require('../internal/getNative'), |
|
isArrayLike = require('../internal/isArrayLike'), |
|
isObject = require('../lang/isObject'), |
|
shimKeys = require('../internal/shimKeys'); |
|
|
|
/* Native method references for those with the same name as other `lodash` methods. */ |
|
var nativeKeys = getNative(Object, 'keys'); |
|
|
|
/** |
|
* Creates an array of the own enumerable property names of `object`. |
|
* |
|
* **Note:** Non-object values are coerced to objects. See the |
|
* [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) |
|
* for more details. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Object |
|
* @param {Object} object The object to query. |
|
* @returns {Array} Returns the array of property names. |
|
* @example |
|
* |
|
* function Foo() { |
|
* this.a = 1; |
|
* this.b = 2; |
|
* } |
|
* |
|
* Foo.prototype.c = 3; |
|
* |
|
* _.keys(new Foo); |
|
* // => ['a', 'b'] (iteration order is not guaranteed) |
|
* |
|
* _.keys('hi'); |
|
* // => ['0', '1'] |
|
*/ |
|
var keys = !nativeKeys ? shimKeys : function(object) { |
|
var Ctor = object == null ? undefined : object.constructor; |
|
if ((typeof Ctor == 'function' && Ctor.prototype === object) || |
|
(typeof object != 'function' && isArrayLike(object))) { |
|
return shimKeys(object); |
|
} |
|
return isObject(object) ? nativeKeys(object) : []; |
|
}; |
|
|
|
module.exports = keys; |
|
|
|
},{"../internal/getNative":37,"../internal/isArrayLike":38,"../internal/shimKeys":45,"../lang/isObject":53}],59:[function(require,module,exports){ |
|
var isArguments = require('../lang/isArguments'), |
|
isArray = require('../lang/isArray'), |
|
isIndex = require('../internal/isIndex'), |
|
isLength = require('../internal/isLength'), |
|
isObject = require('../lang/isObject'); |
|
|
|
/** Used for native method references. */ |
|
var objectProto = Object.prototype; |
|
|
|
/** Used to check objects for own properties. */ |
|
var hasOwnProperty = objectProto.hasOwnProperty; |
|
|
|
/** |
|
* Creates an array of the own and inherited enumerable property names of `object`. |
|
* |
|
* **Note:** Non-object values are coerced to objects. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Object |
|
* @param {Object} object The object to query. |
|
* @returns {Array} Returns the array of property names. |
|
* @example |
|
* |
|
* function Foo() { |
|
* this.a = 1; |
|
* this.b = 2; |
|
* } |
|
* |
|
* Foo.prototype.c = 3; |
|
* |
|
* _.keysIn(new Foo); |
|
* // => ['a', 'b', 'c'] (iteration order is not guaranteed) |
|
*/ |
|
function keysIn(object) { |
|
if (object == null) { |
|
return []; |
|
} |
|
if (!isObject(object)) { |
|
object = Object(object); |
|
} |
|
var length = object.length; |
|
length = (length && isLength(length) && |
|
(isArray(object) || isArguments(object)) && length) || 0; |
|
|
|
var Ctor = object.constructor, |
|
index = -1, |
|
isProto = typeof Ctor == 'function' && Ctor.prototype === object, |
|
result = Array(length), |
|
skipIndexes = length > 0; |
|
|
|
while (++index < length) { |
|
result[index] = (index + ''); |
|
} |
|
for (var key in object) { |
|
if (!(skipIndexes && isIndex(key, length)) && |
|
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { |
|
result.push(key); |
|
} |
|
} |
|
return result; |
|
} |
|
|
|
module.exports = keysIn; |
|
|
|
},{"../internal/isIndex":39,"../internal/isLength":42,"../lang/isArguments":48,"../lang/isArray":49,"../lang/isObject":53}],60:[function(require,module,exports){ |
|
var keys = require('./keys'), |
|
toObject = require('../internal/toObject'); |
|
|
|
/** |
|
* Creates a two dimensional array of the key-value pairs for `object`, |
|
* e.g. `[[key1, value1], [key2, value2]]`. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Object |
|
* @param {Object} object The object to query. |
|
* @returns {Array} Returns the new array of key-value pairs. |
|
* @example |
|
* |
|
* _.pairs({ 'barney': 36, 'fred': 40 }); |
|
* // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed) |
|
*/ |
|
function pairs(object) { |
|
object = toObject(object); |
|
|
|
var index = -1, |
|
props = keys(object), |
|
length = props.length, |
|
result = Array(length); |
|
|
|
while (++index < length) { |
|
var key = props[index]; |
|
result[index] = [key, object[key]]; |
|
} |
|
return result; |
|
} |
|
|
|
module.exports = pairs; |
|
|
|
},{"../internal/toObject":46,"./keys":58}],61:[function(require,module,exports){ |
|
/** |
|
* This method returns the first argument provided to it. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Utility |
|
* @param {*} value Any value. |
|
* @returns {*} Returns `value`. |
|
* @example |
|
* |
|
* var object = { 'user': 'fred' }; |
|
* |
|
* _.identity(object) === object; |
|
* // => true |
|
*/ |
|
function identity(value) { |
|
return value; |
|
} |
|
|
|
module.exports = identity; |
|
|
|
},{}],62:[function(require,module,exports){ |
|
var baseProperty = require('../internal/baseProperty'), |
|
basePropertyDeep = require('../internal/basePropertyDeep'), |
|
isKey = require('../internal/isKey'); |
|
|
|
/** |
|
* Creates a function that returns the property value at `path` on a |
|
* given object. |
|
* |
|
* @static |
|
* @memberOf _ |
|
* @category Utility |
|
* @param {Array|string} path The path of the property to get. |
|
* @returns {Function} Returns the new function. |
|
* @example |
|
* |
|
* var objects = [ |
|
* { 'a': { 'b': { 'c': 2 } } }, |
|
* { 'a': { 'b': { 'c': 1 } } } |
|
* ]; |
|
* |
|
* _.map(objects, _.property('a.b.c')); |
|
* // => [2, 1] |
|
* |
|
* _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); |
|
* // => [1, 2] |
|
*/ |
|
function property(path) { |
|
return isKey(path) ? baseProperty(path) : basePropertyDeep(path); |
|
} |
|
|
|
module.exports = property; |
|
|
|
},{"../internal/baseProperty":24,"../internal/basePropertyDeep":25,"../internal/isKey":41}],63:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLAttribute, create; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
module.exports = XMLAttribute = (function() { |
|
function XMLAttribute(parent, name, value) { |
|
this.stringify = parent.stringify; |
|
if (name == null) { |
|
throw new Error("Missing attribute name of element " + parent.name); |
|
} |
|
if (value == null) { |
|
throw new Error("Missing attribute value for attribute " + name + " of element " + parent.name); |
|
} |
|
this.name = this.stringify.attName(name); |
|
this.value = this.stringify.attValue(value); |
|
} |
|
|
|
XMLAttribute.prototype.clone = function() { |
|
return create(XMLAttribute.prototype, this); |
|
}; |
|
|
|
XMLAttribute.prototype.toString = function(options, level) { |
|
return ' ' + this.name + '="' + this.value + '"'; |
|
}; |
|
|
|
return XMLAttribute; |
|
|
|
})(); |
|
|
|
}).call(this); |
|
|
|
},{"lodash/object/create":57}],64:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLBuilder, XMLDeclaration, XMLDocType, XMLElement, XMLStringifier; |
|
|
|
XMLStringifier = require('./XMLStringifier'); |
|
|
|
XMLDeclaration = require('./XMLDeclaration'); |
|
|
|
XMLDocType = require('./XMLDocType'); |
|
|
|
XMLElement = require('./XMLElement'); |
|
|
|
module.exports = XMLBuilder = (function() { |
|
function XMLBuilder(name, options) { |
|
var root, temp; |
|
if (name == null) { |
|
throw new Error("Root element needs a name"); |
|
} |
|
if (options == null) { |
|
options = {}; |
|
} |
|
this.options = options; |
|
this.stringify = new XMLStringifier(options); |
|
temp = new XMLElement(this, 'doc'); |
|
root = temp.element(name); |
|
root.isRoot = true; |
|
root.documentObject = this; |
|
this.rootObject = root; |
|
if (!options.headless) { |
|
root.declaration(options); |
|
if ((options.pubID != null) || (options.sysID != null)) { |
|
root.doctype(options); |
|
} |
|
} |
|
} |
|
|
|
XMLBuilder.prototype.root = function() { |
|
return this.rootObject; |
|
}; |
|
|
|
XMLBuilder.prototype.end = function(options) { |
|
return this.toString(options); |
|
}; |
|
|
|
XMLBuilder.prototype.toString = function(options) { |
|
var indent, newline, offset, pretty, r, ref, ref1, ref2; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
r = ''; |
|
if (this.xmldec != null) { |
|
r += this.xmldec.toString(options); |
|
} |
|
if (this.doctype != null) { |
|
r += this.doctype.toString(options); |
|
} |
|
r += this.rootObject.toString(options); |
|
if (pretty && r.slice(-newline.length) === newline) { |
|
r = r.slice(0, -newline.length); |
|
} |
|
return r; |
|
}; |
|
|
|
return XMLBuilder; |
|
|
|
})(); |
|
|
|
}).call(this); |
|
|
|
},{"./XMLDeclaration":71,"./XMLDocType":72,"./XMLElement":73,"./XMLStringifier":77}],65:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLCData, XMLNode, create, |
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, |
|
hasProp = {}.hasOwnProperty; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
XMLNode = require('./XMLNode'); |
|
|
|
module.exports = XMLCData = (function(superClass) { |
|
extend(XMLCData, superClass); |
|
|
|
function XMLCData(parent, text) { |
|
XMLCData.__super__.constructor.call(this, parent); |
|
if (text == null) { |
|
throw new Error("Missing CDATA text"); |
|
} |
|
this.text = this.stringify.cdata(text); |
|
} |
|
|
|
XMLCData.prototype.clone = function() { |
|
return create(XMLCData.prototype, this); |
|
}; |
|
|
|
XMLCData.prototype.toString = function(options, level) { |
|
var indent, newline, offset, pretty, r, ref, ref1, ref2, space; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
level || (level = 0); |
|
space = new Array(level + offset + 1).join(indent); |
|
r = ''; |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += '<![CDATA[' + this.text + ']]>'; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
return r; |
|
}; |
|
|
|
return XMLCData; |
|
|
|
})(XMLNode); |
|
|
|
}).call(this); |
|
|
|
},{"./XMLNode":74,"lodash/object/create":57}],66:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLComment, XMLNode, create, |
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, |
|
hasProp = {}.hasOwnProperty; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
XMLNode = require('./XMLNode'); |
|
|
|
module.exports = XMLComment = (function(superClass) { |
|
extend(XMLComment, superClass); |
|
|
|
function XMLComment(parent, text) { |
|
XMLComment.__super__.constructor.call(this, parent); |
|
if (text == null) { |
|
throw new Error("Missing comment text"); |
|
} |
|
this.text = this.stringify.comment(text); |
|
} |
|
|
|
XMLComment.prototype.clone = function() { |
|
return create(XMLComment.prototype, this); |
|
}; |
|
|
|
XMLComment.prototype.toString = function(options, level) { |
|
var indent, newline, offset, pretty, r, ref, ref1, ref2, space; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
level || (level = 0); |
|
space = new Array(level + offset + 1).join(indent); |
|
r = ''; |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += '<!-- ' + this.text + ' -->'; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
return r; |
|
}; |
|
|
|
return XMLComment; |
|
|
|
})(XMLNode); |
|
|
|
}).call(this); |
|
|
|
},{"./XMLNode":74,"lodash/object/create":57}],67:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLDTDAttList, create; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
module.exports = XMLDTDAttList = (function() { |
|
function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) { |
|
this.stringify = parent.stringify; |
|
if (elementName == null) { |
|
throw new Error("Missing DTD element name"); |
|
} |
|
if (attributeName == null) { |
|
throw new Error("Missing DTD attribute name"); |
|
} |
|
if (!attributeType) { |
|
throw new Error("Missing DTD attribute type"); |
|
} |
|
if (!defaultValueType) { |
|
throw new Error("Missing DTD attribute default"); |
|
} |
|
if (defaultValueType.indexOf('#') !== 0) { |
|
defaultValueType = '#' + defaultValueType; |
|
} |
|
if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) { |
|
throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT"); |
|
} |
|
if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) { |
|
throw new Error("Default value only applies to #FIXED or #DEFAULT"); |
|
} |
|
this.elementName = this.stringify.eleName(elementName); |
|
this.attributeName = this.stringify.attName(attributeName); |
|
this.attributeType = this.stringify.dtdAttType(attributeType); |
|
this.defaultValue = this.stringify.dtdAttDefault(defaultValue); |
|
this.defaultValueType = defaultValueType; |
|
} |
|
|
|
XMLDTDAttList.prototype.toString = function(options, level) { |
|
var indent, newline, offset, pretty, r, ref, ref1, ref2, space; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
level || (level = 0); |
|
space = new Array(level + offset + 1).join(indent); |
|
r = ''; |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += '<!ATTLIST ' + this.elementName + ' ' + this.attributeName + ' ' + this.attributeType; |
|
if (this.defaultValueType !== '#DEFAULT') { |
|
r += ' ' + this.defaultValueType; |
|
} |
|
if (this.defaultValue) { |
|
r += ' "' + this.defaultValue + '"'; |
|
} |
|
r += '>'; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
return r; |
|
}; |
|
|
|
return XMLDTDAttList; |
|
|
|
})(); |
|
|
|
}).call(this); |
|
|
|
},{"lodash/object/create":57}],68:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLDTDElement, create; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
module.exports = XMLDTDElement = (function() { |
|
function XMLDTDElement(parent, name, value) { |
|
this.stringify = parent.stringify; |
|
if (name == null) { |
|
throw new Error("Missing DTD element name"); |
|
} |
|
if (!value) { |
|
value = '(#PCDATA)'; |
|
} |
|
if (Array.isArray(value)) { |
|
value = '(' + value.join(',') + ')'; |
|
} |
|
this.name = this.stringify.eleName(name); |
|
this.value = this.stringify.dtdElementValue(value); |
|
} |
|
|
|
XMLDTDElement.prototype.toString = function(options, level) { |
|
var indent, newline, offset, pretty, r, ref, ref1, ref2, space; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
level || (level = 0); |
|
space = new Array(level + offset + 1).join(indent); |
|
r = ''; |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += '<!ELEMENT ' + this.name + ' ' + this.value + '>'; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
return r; |
|
}; |
|
|
|
return XMLDTDElement; |
|
|
|
})(); |
|
|
|
}).call(this); |
|
|
|
},{"lodash/object/create":57}],69:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLDTDEntity, create, isObject; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
isObject = require('lodash/lang/isObject'); |
|
|
|
module.exports = XMLDTDEntity = (function() { |
|
function XMLDTDEntity(parent, pe, name, value) { |
|
this.stringify = parent.stringify; |
|
if (name == null) { |
|
throw new Error("Missing entity name"); |
|
} |
|
if (value == null) { |
|
throw new Error("Missing entity value"); |
|
} |
|
this.pe = !!pe; |
|
this.name = this.stringify.eleName(name); |
|
if (!isObject(value)) { |
|
this.value = this.stringify.dtdEntityValue(value); |
|
} else { |
|
if (!value.pubID && !value.sysID) { |
|
throw new Error("Public and/or system identifiers are required for an external entity"); |
|
} |
|
if (value.pubID && !value.sysID) { |
|
throw new Error("System identifier is required for a public external entity"); |
|
} |
|
if (value.pubID != null) { |
|
this.pubID = this.stringify.dtdPubID(value.pubID); |
|
} |
|
if (value.sysID != null) { |
|
this.sysID = this.stringify.dtdSysID(value.sysID); |
|
} |
|
if (value.nData != null) { |
|
this.nData = this.stringify.dtdNData(value.nData); |
|
} |
|
if (this.pe && this.nData) { |
|
throw new Error("Notation declaration is not allowed in a parameter entity"); |
|
} |
|
} |
|
} |
|
|
|
XMLDTDEntity.prototype.toString = function(options, level) { |
|
var indent, newline, offset, pretty, r, ref, ref1, ref2, space; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
level || (level = 0); |
|
space = new Array(level + offset + 1).join(indent); |
|
r = ''; |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += '<!ENTITY'; |
|
if (this.pe) { |
|
r += ' %'; |
|
} |
|
r += ' ' + this.name; |
|
if (this.value) { |
|
r += ' "' + this.value + '"'; |
|
} else { |
|
if (this.pubID && this.sysID) { |
|
r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"'; |
|
} else if (this.sysID) { |
|
r += ' SYSTEM "' + this.sysID + '"'; |
|
} |
|
if (this.nData) { |
|
r += ' NDATA ' + this.nData; |
|
} |
|
} |
|
r += '>'; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
return r; |
|
}; |
|
|
|
return XMLDTDEntity; |
|
|
|
})(); |
|
|
|
}).call(this); |
|
|
|
},{"lodash/lang/isObject":53,"lodash/object/create":57}],70:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLDTDNotation, create; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
module.exports = XMLDTDNotation = (function() { |
|
function XMLDTDNotation(parent, name, value) { |
|
this.stringify = parent.stringify; |
|
if (name == null) { |
|
throw new Error("Missing notation name"); |
|
} |
|
if (!value.pubID && !value.sysID) { |
|
throw new Error("Public or system identifiers are required for an external entity"); |
|
} |
|
this.name = this.stringify.eleName(name); |
|
if (value.pubID != null) { |
|
this.pubID = this.stringify.dtdPubID(value.pubID); |
|
} |
|
if (value.sysID != null) { |
|
this.sysID = this.stringify.dtdSysID(value.sysID); |
|
} |
|
} |
|
|
|
XMLDTDNotation.prototype.toString = function(options, level) { |
|
var indent, newline, offset, pretty, r, ref, ref1, ref2, space; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
level || (level = 0); |
|
space = new Array(level + offset + 1).join(indent); |
|
r = ''; |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += '<!NOTATION ' + this.name; |
|
if (this.pubID && this.sysID) { |
|
r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"'; |
|
} else if (this.pubID) { |
|
r += ' PUBLIC "' + this.pubID + '"'; |
|
} else if (this.sysID) { |
|
r += ' SYSTEM "' + this.sysID + '"'; |
|
} |
|
r += '>'; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
return r; |
|
}; |
|
|
|
return XMLDTDNotation; |
|
|
|
})(); |
|
|
|
}).call(this); |
|
|
|
},{"lodash/object/create":57}],71:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLDeclaration, XMLNode, create, isObject, |
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, |
|
hasProp = {}.hasOwnProperty; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
isObject = require('lodash/lang/isObject'); |
|
|
|
XMLNode = require('./XMLNode'); |
|
|
|
module.exports = XMLDeclaration = (function(superClass) { |
|
extend(XMLDeclaration, superClass); |
|
|
|
function XMLDeclaration(parent, version, encoding, standalone) { |
|
var ref; |
|
XMLDeclaration.__super__.constructor.call(this, parent); |
|
if (isObject(version)) { |
|
ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone; |
|
} |
|
if (!version) { |
|
version = '1.0'; |
|
} |
|
this.version = this.stringify.xmlVersion(version); |
|
if (encoding != null) { |
|
this.encoding = this.stringify.xmlEncoding(encoding); |
|
} |
|
if (standalone != null) { |
|
this.standalone = this.stringify.xmlStandalone(standalone); |
|
} |
|
} |
|
|
|
XMLDeclaration.prototype.toString = function(options, level) { |
|
var indent, newline, offset, pretty, r, ref, ref1, ref2, space; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
level || (level = 0); |
|
space = new Array(level + offset + 1).join(indent); |
|
r = ''; |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += '<?xml'; |
|
r += ' version="' + this.version + '"'; |
|
if (this.encoding != null) { |
|
r += ' encoding="' + this.encoding + '"'; |
|
} |
|
if (this.standalone != null) { |
|
r += ' standalone="' + this.standalone + '"'; |
|
} |
|
r += '?>'; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
return r; |
|
}; |
|
|
|
return XMLDeclaration; |
|
|
|
})(XMLNode); |
|
|
|
}).call(this); |
|
|
|
},{"./XMLNode":74,"lodash/lang/isObject":53,"lodash/object/create":57}],72:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLProcessingInstruction, create, isObject; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
isObject = require('lodash/lang/isObject'); |
|
|
|
XMLCData = require('./XMLCData'); |
|
|
|
XMLComment = require('./XMLComment'); |
|
|
|
XMLDTDAttList = require('./XMLDTDAttList'); |
|
|
|
XMLDTDEntity = require('./XMLDTDEntity'); |
|
|
|
XMLDTDElement = require('./XMLDTDElement'); |
|
|
|
XMLDTDNotation = require('./XMLDTDNotation'); |
|
|
|
XMLProcessingInstruction = require('./XMLProcessingInstruction'); |
|
|
|
module.exports = XMLDocType = (function() { |
|
function XMLDocType(parent, pubID, sysID) { |
|
var ref, ref1; |
|
this.documentObject = parent; |
|
this.stringify = this.documentObject.stringify; |
|
this.children = []; |
|
if (isObject(pubID)) { |
|
ref = pubID, pubID = ref.pubID, sysID = ref.sysID; |
|
} |
|
if (sysID == null) { |
|
ref1 = [pubID, sysID], sysID = ref1[0], pubID = ref1[1]; |
|
} |
|
if (pubID != null) { |
|
this.pubID = this.stringify.dtdPubID(pubID); |
|
} |
|
if (sysID != null) { |
|
this.sysID = this.stringify.dtdSysID(sysID); |
|
} |
|
} |
|
|
|
XMLDocType.prototype.element = function(name, value) { |
|
var child; |
|
child = new XMLDTDElement(this, name, value); |
|
this.children.push(child); |
|
return this; |
|
}; |
|
|
|
XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { |
|
var child; |
|
child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); |
|
this.children.push(child); |
|
return this; |
|
}; |
|
|
|
XMLDocType.prototype.entity = function(name, value) { |
|
var child; |
|
child = new XMLDTDEntity(this, false, name, value); |
|
this.children.push(child); |
|
return this; |
|
}; |
|
|
|
XMLDocType.prototype.pEntity = function(name, value) { |
|
var child; |
|
child = new XMLDTDEntity(this, true, name, value); |
|
this.children.push(child); |
|
return this; |
|
}; |
|
|
|
XMLDocType.prototype.notation = function(name, value) { |
|
var child; |
|
child = new XMLDTDNotation(this, name, value); |
|
this.children.push(child); |
|
return this; |
|
}; |
|
|
|
XMLDocType.prototype.cdata = function(value) { |
|
var child; |
|
child = new XMLCData(this, value); |
|
this.children.push(child); |
|
return this; |
|
}; |
|
|
|
XMLDocType.prototype.comment = function(value) { |
|
var child; |
|
child = new XMLComment(this, value); |
|
this.children.push(child); |
|
return this; |
|
}; |
|
|
|
XMLDocType.prototype.instruction = function(target, value) { |
|
var child; |
|
child = new XMLProcessingInstruction(this, target, value); |
|
this.children.push(child); |
|
return this; |
|
}; |
|
|
|
XMLDocType.prototype.root = function() { |
|
return this.documentObject.root(); |
|
}; |
|
|
|
XMLDocType.prototype.document = function() { |
|
return this.documentObject; |
|
}; |
|
|
|
XMLDocType.prototype.toString = function(options, level) { |
|
var child, i, indent, len, newline, offset, pretty, r, ref, ref1, ref2, ref3, space; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
level || (level = 0); |
|
space = new Array(level + offset + 1).join(indent); |
|
r = ''; |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += '<!DOCTYPE ' + this.root().name; |
|
if (this.pubID && this.sysID) { |
|
r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"'; |
|
} else if (this.sysID) { |
|
r += ' SYSTEM "' + this.sysID + '"'; |
|
} |
|
if (this.children.length > 0) { |
|
r += ' ['; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
ref3 = this.children; |
|
for (i = 0, len = ref3.length; i < len; i++) { |
|
child = ref3[i]; |
|
r += child.toString(options, level + 1); |
|
} |
|
r += ']'; |
|
} |
|
r += '>'; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
return r; |
|
}; |
|
|
|
XMLDocType.prototype.ele = function(name, value) { |
|
return this.element(name, value); |
|
}; |
|
|
|
XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { |
|
return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue); |
|
}; |
|
|
|
XMLDocType.prototype.ent = function(name, value) { |
|
return this.entity(name, value); |
|
}; |
|
|
|
XMLDocType.prototype.pent = function(name, value) { |
|
return this.pEntity(name, value); |
|
}; |
|
|
|
XMLDocType.prototype.not = function(name, value) { |
|
return this.notation(name, value); |
|
}; |
|
|
|
XMLDocType.prototype.dat = function(value) { |
|
return this.cdata(value); |
|
}; |
|
|
|
XMLDocType.prototype.com = function(value) { |
|
return this.comment(value); |
|
}; |
|
|
|
XMLDocType.prototype.ins = function(target, value) { |
|
return this.instruction(target, value); |
|
}; |
|
|
|
XMLDocType.prototype.up = function() { |
|
return this.root(); |
|
}; |
|
|
|
XMLDocType.prototype.doc = function() { |
|
return this.document(); |
|
}; |
|
|
|
return XMLDocType; |
|
|
|
})(); |
|
|
|
}).call(this); |
|
|
|
},{"./XMLCData":65,"./XMLComment":66,"./XMLDTDAttList":67,"./XMLDTDElement":68,"./XMLDTDEntity":69,"./XMLDTDNotation":70,"./XMLProcessingInstruction":75,"lodash/lang/isObject":53,"lodash/object/create":57}],73:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLAttribute, XMLElement, XMLNode, XMLProcessingInstruction, create, every, isFunction, isObject, |
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, |
|
hasProp = {}.hasOwnProperty; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
isObject = require('lodash/lang/isObject'); |
|
|
|
isFunction = require('lodash/lang/isFunction'); |
|
|
|
every = require('lodash/collection/every'); |
|
|
|
XMLNode = require('./XMLNode'); |
|
|
|
XMLAttribute = require('./XMLAttribute'); |
|
|
|
XMLProcessingInstruction = require('./XMLProcessingInstruction'); |
|
|
|
module.exports = XMLElement = (function(superClass) { |
|
extend(XMLElement, superClass); |
|
|
|
function XMLElement(parent, name, attributes) { |
|
XMLElement.__super__.constructor.call(this, parent); |
|
if (name == null) { |
|
throw new Error("Missing element name"); |
|
} |
|
this.name = this.stringify.eleName(name); |
|
this.children = []; |
|
this.instructions = []; |
|
this.attributes = {}; |
|
if (attributes != null) { |
|
this.attribute(attributes); |
|
} |
|
} |
|
|
|
XMLElement.prototype.clone = function() { |
|
var att, attName, clonedSelf, i, len, pi, ref, ref1; |
|
clonedSelf = create(XMLElement.prototype, this); |
|
if (clonedSelf.isRoot) { |
|
clonedSelf.documentObject = null; |
|
} |
|
clonedSelf.attributes = {}; |
|
ref = this.attributes; |
|
for (attName in ref) { |
|
if (!hasProp.call(ref, attName)) continue; |
|
att = ref[attName]; |
|
clonedSelf.attributes[attName] = att.clone(); |
|
} |
|
clonedSelf.instructions = []; |
|
ref1 = this.instructions; |
|
for (i = 0, len = ref1.length; i < len; i++) { |
|
pi = ref1[i]; |
|
clonedSelf.instructions.push(pi.clone()); |
|
} |
|
clonedSelf.children = []; |
|
this.children.forEach(function(child) { |
|
var clonedChild; |
|
clonedChild = child.clone(); |
|
clonedChild.parent = clonedSelf; |
|
return clonedSelf.children.push(clonedChild); |
|
}); |
|
return clonedSelf; |
|
}; |
|
|
|
XMLElement.prototype.attribute = function(name, value) { |
|
var attName, attValue; |
|
if (name != null) { |
|
name = name.valueOf(); |
|
} |
|
if (isObject(name)) { |
|
for (attName in name) { |
|
if (!hasProp.call(name, attName)) continue; |
|
attValue = name[attName]; |
|
this.attribute(attName, attValue); |
|
} |
|
} else { |
|
if (isFunction(value)) { |
|
value = value.apply(); |
|
} |
|
if (!this.options.skipNullAttributes || (value != null)) { |
|
this.attributes[name] = new XMLAttribute(this, name, value); |
|
} |
|
} |
|
return this; |
|
}; |
|
|
|
XMLElement.prototype.removeAttribute = function(name) { |
|
var attName, i, len; |
|
if (name == null) { |
|
throw new Error("Missing attribute name"); |
|
} |
|
name = name.valueOf(); |
|
if (Array.isArray(name)) { |
|
for (i = 0, len = name.length; i < len; i++) { |
|
attName = name[i]; |
|
delete this.attributes[attName]; |
|
} |
|
} else { |
|
delete this.attributes[name]; |
|
} |
|
return this; |
|
}; |
|
|
|
XMLElement.prototype.instruction = function(target, value) { |
|
var i, insTarget, insValue, instruction, len; |
|
if (target != null) { |
|
target = target.valueOf(); |
|
} |
|
if (value != null) { |
|
value = value.valueOf(); |
|
} |
|
if (Array.isArray(target)) { |
|
for (i = 0, len = target.length; i < len; i++) { |
|
insTarget = target[i]; |
|
this.instruction(insTarget); |
|
} |
|
} else if (isObject(target)) { |
|
for (insTarget in target) { |
|
if (!hasProp.call(target, insTarget)) continue; |
|
insValue = target[insTarget]; |
|
this.instruction(insTarget, insValue); |
|
} |
|
} else { |
|
if (isFunction(value)) { |
|
value = value.apply(); |
|
} |
|
instruction = new XMLProcessingInstruction(this, target, value); |
|
this.instructions.push(instruction); |
|
} |
|
return this; |
|
}; |
|
|
|
XMLElement.prototype.toString = function(options, level) { |
|
var att, child, i, indent, instruction, j, len, len1, name, newline, offset, pretty, r, ref, ref1, ref2, ref3, ref4, ref5, space; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
level || (level = 0); |
|
space = new Array(level + offset + 1).join(indent); |
|
r = ''; |
|
ref3 = this.instructions; |
|
for (i = 0, len = ref3.length; i < len; i++) { |
|
instruction = ref3[i]; |
|
r += instruction.toString(options, level); |
|
} |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += '<' + this.name; |
|
ref4 = this.attributes; |
|
for (name in ref4) { |
|
if (!hasProp.call(ref4, name)) continue; |
|
att = ref4[name]; |
|
r += att.toString(options); |
|
} |
|
if (this.children.length === 0 || every(this.children, function(e) { |
|
return e.value === ''; |
|
})) { |
|
r += '/>'; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
} else if (pretty && this.children.length === 1 && (this.children[0].value != null)) { |
|
r += '>'; |
|
r += this.children[0].value; |
|
r += '</' + this.name + '>'; |
|
r += newline; |
|
} else { |
|
r += '>'; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
ref5 = this.children; |
|
for (j = 0, len1 = ref5.length; j < len1; j++) { |
|
child = ref5[j]; |
|
r += child.toString(options, level + 1); |
|
} |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += '</' + this.name + '>'; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
} |
|
return r; |
|
}; |
|
|
|
XMLElement.prototype.att = function(name, value) { |
|
return this.attribute(name, value); |
|
}; |
|
|
|
XMLElement.prototype.ins = function(target, value) { |
|
return this.instruction(target, value); |
|
}; |
|
|
|
XMLElement.prototype.a = function(name, value) { |
|
return this.attribute(name, value); |
|
}; |
|
|
|
XMLElement.prototype.i = function(target, value) { |
|
return this.instruction(target, value); |
|
}; |
|
|
|
return XMLElement; |
|
|
|
})(XMLNode); |
|
|
|
}).call(this); |
|
|
|
},{"./XMLAttribute":63,"./XMLNode":74,"./XMLProcessingInstruction":75,"lodash/collection/every":5,"lodash/lang/isFunction":51,"lodash/lang/isObject":53,"lodash/object/create":57}],74:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLRaw, XMLText, isEmpty, isFunction, isObject, |
|
hasProp = {}.hasOwnProperty; |
|
|
|
isObject = require('lodash/lang/isObject'); |
|
|
|
isFunction = require('lodash/lang/isFunction'); |
|
|
|
isEmpty = require('lodash/lang/isEmpty'); |
|
|
|
XMLElement = null; |
|
|
|
XMLCData = null; |
|
|
|
XMLComment = null; |
|
|
|
XMLDeclaration = null; |
|
|
|
XMLDocType = null; |
|
|
|
XMLRaw = null; |
|
|
|
XMLText = null; |
|
|
|
module.exports = XMLNode = (function() { |
|
function XMLNode(parent) { |
|
this.parent = parent; |
|
this.options = this.parent.options; |
|
this.stringify = this.parent.stringify; |
|
if (XMLElement === null) { |
|
XMLElement = require('./XMLElement'); |
|
XMLCData = require('./XMLCData'); |
|
XMLComment = require('./XMLComment'); |
|
XMLDeclaration = require('./XMLDeclaration'); |
|
XMLDocType = require('./XMLDocType'); |
|
XMLRaw = require('./XMLRaw'); |
|
XMLText = require('./XMLText'); |
|
} |
|
} |
|
|
|
XMLNode.prototype.element = function(name, attributes, text) { |
|
var childNode, item, j, k, key, lastChild, len, len1, ref, val; |
|
lastChild = null; |
|
if (attributes == null) { |
|
attributes = {}; |
|
} |
|
attributes = attributes.valueOf(); |
|
if (!isObject(attributes)) { |
|
ref = [attributes, text], text = ref[0], attributes = ref[1]; |
|
} |
|
if (name != null) { |
|
name = name.valueOf(); |
|
} |
|
if (Array.isArray(name)) { |
|
for (j = 0, len = name.length; j < len; j++) { |
|
item = name[j]; |
|
lastChild = this.element(item); |
|
} |
|
} else if (isFunction(name)) { |
|
lastChild = this.element(name.apply()); |
|
} else if (isObject(name)) { |
|
for (key in name) { |
|
if (!hasProp.call(name, key)) continue; |
|
val = name[key]; |
|
if (isFunction(val)) { |
|
val = val.apply(); |
|
} |
|
if ((isObject(val)) && (isEmpty(val))) { |
|
val = null; |
|
} |
|
if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) { |
|
lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val); |
|
} else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && key.indexOf(this.stringify.convertPIKey) === 0) { |
|
lastChild = this.instruction(key.substr(this.stringify.convertPIKey.length), val); |
|
} else if (Array.isArray(val)) { |
|
for (k = 0, len1 = val.length; k < len1; k++) { |
|
item = val[k]; |
|
childNode = {}; |
|
childNode[key] = item; |
|
lastChild = this.element(childNode); |
|
} |
|
} else if (isObject(val)) { |
|
lastChild = this.element(key); |
|
lastChild.element(val); |
|
} else { |
|
lastChild = this.element(key, val); |
|
} |
|
} |
|
} else { |
|
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) { |
|
lastChild = this.text(text); |
|
} else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) { |
|
lastChild = this.cdata(text); |
|
} else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) { |
|
lastChild = this.comment(text); |
|
} else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) { |
|
lastChild = this.raw(text); |
|
} else { |
|
lastChild = this.node(name, attributes, text); |
|
} |
|
} |
|
if (lastChild == null) { |
|
throw new Error("Could not create any elements with: " + name); |
|
} |
|
return lastChild; |
|
}; |
|
|
|
XMLNode.prototype.insertBefore = function(name, attributes, text) { |
|
var child, i, removed; |
|
if (this.isRoot) { |
|
throw new Error("Cannot insert elements at root level"); |
|
} |
|
i = this.parent.children.indexOf(this); |
|
removed = this.parent.children.splice(i); |
|
child = this.parent.element(name, attributes, text); |
|
Array.prototype.push.apply(this.parent.children, removed); |
|
return child; |
|
}; |
|
|
|
XMLNode.prototype.insertAfter = function(name, attributes, text) { |
|
var child, i, removed; |
|
if (this.isRoot) { |
|
throw new Error("Cannot insert elements at root level"); |
|
} |
|
i = this.parent.children.indexOf(this); |
|
removed = this.parent.children.splice(i + 1); |
|
child = this.parent.element(name, attributes, text); |
|
Array.prototype.push.apply(this.parent.children, removed); |
|
return child; |
|
}; |
|
|
|
XMLNode.prototype.remove = function() { |
|
var i, ref; |
|
if (this.isRoot) { |
|
throw new Error("Cannot remove the root element"); |
|
} |
|
i = this.parent.children.indexOf(this); |
|
[].splice.apply(this.parent.children, [i, i - i + 1].concat(ref = [])), ref; |
|
return this.parent; |
|
}; |
|
|
|
XMLNode.prototype.node = function(name, attributes, text) { |
|
var child, ref; |
|
if (name != null) { |
|
name = name.valueOf(); |
|
} |
|
if (attributes == null) { |
|
attributes = {}; |
|
} |
|
attributes = attributes.valueOf(); |
|
if (!isObject(attributes)) { |
|
ref = [attributes, text], text = ref[0], attributes = ref[1]; |
|
} |
|
child = new XMLElement(this, name, attributes); |
|
if (text != null) { |
|
child.text(text); |
|
} |
|
this.children.push(child); |
|
return child; |
|
}; |
|
|
|
XMLNode.prototype.text = function(value) { |
|
var child; |
|
child = new XMLText(this, value); |
|
this.children.push(child); |
|
return this; |
|
}; |
|
|
|
XMLNode.prototype.cdata = function(value) { |
|
var child; |
|
child = new XMLCData(this, value); |
|
this.children.push(child); |
|
return this; |
|
}; |
|
|
|
XMLNode.prototype.comment = function(value) { |
|
var child; |
|
child = new XMLComment(this, value); |
|
this.children.push(child); |
|
return this; |
|
}; |
|
|
|
XMLNode.prototype.raw = function(value) { |
|
var child; |
|
child = new XMLRaw(this, value); |
|
this.children.push(child); |
|
return this; |
|
}; |
|
|
|
XMLNode.prototype.declaration = function(version, encoding, standalone) { |
|
var doc, xmldec; |
|
doc = this.document(); |
|
xmldec = new XMLDeclaration(doc, version, encoding, standalone); |
|
doc.xmldec = xmldec; |
|
return doc.root(); |
|
}; |
|
|
|
XMLNode.prototype.doctype = function(pubID, sysID) { |
|
var doc, doctype; |
|
doc = this.document(); |
|
doctype = new XMLDocType(doc, pubID, sysID); |
|
doc.doctype = doctype; |
|
return doctype; |
|
}; |
|
|
|
XMLNode.prototype.up = function() { |
|
if (this.isRoot) { |
|
throw new Error("The root node has no parent. Use doc() if you need to get the document object."); |
|
} |
|
return this.parent; |
|
}; |
|
|
|
XMLNode.prototype.root = function() { |
|
var child; |
|
if (this.isRoot) { |
|
return this; |
|
} |
|
child = this.parent; |
|
while (!child.isRoot) { |
|
child = child.parent; |
|
} |
|
return child; |
|
}; |
|
|
|
XMLNode.prototype.document = function() { |
|
return this.root().documentObject; |
|
}; |
|
|
|
XMLNode.prototype.end = function(options) { |
|
return this.document().toString(options); |
|
}; |
|
|
|
XMLNode.prototype.prev = function() { |
|
var i; |
|
if (this.isRoot) { |
|
throw new Error("Root node has no siblings"); |
|
} |
|
i = this.parent.children.indexOf(this); |
|
if (i < 1) { |
|
throw new Error("Already at the first node"); |
|
} |
|
return this.parent.children[i - 1]; |
|
}; |
|
|
|
XMLNode.prototype.next = function() { |
|
var i; |
|
if (this.isRoot) { |
|
throw new Error("Root node has no siblings"); |
|
} |
|
i = this.parent.children.indexOf(this); |
|
if (i === -1 || i === this.parent.children.length - 1) { |
|
throw new Error("Already at the last node"); |
|
} |
|
return this.parent.children[i + 1]; |
|
}; |
|
|
|
XMLNode.prototype.importXMLBuilder = function(xmlbuilder) { |
|
var clonedRoot; |
|
clonedRoot = xmlbuilder.root().clone(); |
|
clonedRoot.parent = this; |
|
clonedRoot.isRoot = false; |
|
this.children.push(clonedRoot); |
|
return this; |
|
}; |
|
|
|
XMLNode.prototype.ele = function(name, attributes, text) { |
|
return this.element(name, attributes, text); |
|
}; |
|
|
|
XMLNode.prototype.nod = function(name, attributes, text) { |
|
return this.node(name, attributes, text); |
|
}; |
|
|
|
XMLNode.prototype.txt = function(value) { |
|
return this.text(value); |
|
}; |
|
|
|
XMLNode.prototype.dat = function(value) { |
|
return this.cdata(value); |
|
}; |
|
|
|
XMLNode.prototype.com = function(value) { |
|
return this.comment(value); |
|
}; |
|
|
|
XMLNode.prototype.doc = function() { |
|
return this.document(); |
|
}; |
|
|
|
XMLNode.prototype.dec = function(version, encoding, standalone) { |
|
return this.declaration(version, encoding, standalone); |
|
}; |
|
|
|
XMLNode.prototype.dtd = function(pubID, sysID) { |
|
return this.doctype(pubID, sysID); |
|
}; |
|
|
|
XMLNode.prototype.e = function(name, attributes, text) { |
|
return this.element(name, attributes, text); |
|
}; |
|
|
|
XMLNode.prototype.n = function(name, attributes, text) { |
|
return this.node(name, attributes, text); |
|
}; |
|
|
|
XMLNode.prototype.t = function(value) { |
|
return this.text(value); |
|
}; |
|
|
|
XMLNode.prototype.d = function(value) { |
|
return this.cdata(value); |
|
}; |
|
|
|
XMLNode.prototype.c = function(value) { |
|
return this.comment(value); |
|
}; |
|
|
|
XMLNode.prototype.r = function(value) { |
|
return this.raw(value); |
|
}; |
|
|
|
XMLNode.prototype.u = function() { |
|
return this.up(); |
|
}; |
|
|
|
return XMLNode; |
|
|
|
})(); |
|
|
|
}).call(this); |
|
|
|
},{"./XMLCData":65,"./XMLComment":66,"./XMLDeclaration":71,"./XMLDocType":72,"./XMLElement":73,"./XMLRaw":76,"./XMLText":78,"lodash/lang/isEmpty":50,"lodash/lang/isFunction":51,"lodash/lang/isObject":53}],75:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLProcessingInstruction, create; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
module.exports = XMLProcessingInstruction = (function() { |
|
function XMLProcessingInstruction(parent, target, value) { |
|
this.stringify = parent.stringify; |
|
if (target == null) { |
|
throw new Error("Missing instruction target"); |
|
} |
|
this.target = this.stringify.insTarget(target); |
|
if (value) { |
|
this.value = this.stringify.insValue(value); |
|
} |
|
} |
|
|
|
XMLProcessingInstruction.prototype.clone = function() { |
|
return create(XMLProcessingInstruction.prototype, this); |
|
}; |
|
|
|
XMLProcessingInstruction.prototype.toString = function(options, level) { |
|
var indent, newline, offset, pretty, r, ref, ref1, ref2, space; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
level || (level = 0); |
|
space = new Array(level + offset + 1).join(indent); |
|
r = ''; |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += '<?'; |
|
r += this.target; |
|
if (this.value) { |
|
r += ' ' + this.value; |
|
} |
|
r += '?>'; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
return r; |
|
}; |
|
|
|
return XMLProcessingInstruction; |
|
|
|
})(); |
|
|
|
}).call(this); |
|
|
|
},{"lodash/object/create":57}],76:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLNode, XMLRaw, create, |
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, |
|
hasProp = {}.hasOwnProperty; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
XMLNode = require('./XMLNode'); |
|
|
|
module.exports = XMLRaw = (function(superClass) { |
|
extend(XMLRaw, superClass); |
|
|
|
function XMLRaw(parent, text) { |
|
XMLRaw.__super__.constructor.call(this, parent); |
|
if (text == null) { |
|
throw new Error("Missing raw text"); |
|
} |
|
this.value = this.stringify.raw(text); |
|
} |
|
|
|
XMLRaw.prototype.clone = function() { |
|
return create(XMLRaw.prototype, this); |
|
}; |
|
|
|
XMLRaw.prototype.toString = function(options, level) { |
|
var indent, newline, offset, pretty, r, ref, ref1, ref2, space; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
level || (level = 0); |
|
space = new Array(level + offset + 1).join(indent); |
|
r = ''; |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += this.value; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
return r; |
|
}; |
|
|
|
return XMLRaw; |
|
|
|
})(XMLNode); |
|
|
|
}).call(this); |
|
|
|
},{"./XMLNode":74,"lodash/object/create":57}],77:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLStringifier, |
|
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, |
|
hasProp = {}.hasOwnProperty; |
|
|
|
module.exports = XMLStringifier = (function() { |
|
function XMLStringifier(options) { |
|
this.assertLegalChar = bind(this.assertLegalChar, this); |
|
var key, ref, value; |
|
this.allowSurrogateChars = options != null ? options.allowSurrogateChars : void 0; |
|
ref = (options != null ? options.stringify : void 0) || {}; |
|
for (key in ref) { |
|
if (!hasProp.call(ref, key)) continue; |
|
value = ref[key]; |
|
this[key] = value; |
|
} |
|
} |
|
|
|
XMLStringifier.prototype.eleName = function(val) { |
|
val = '' + val || ''; |
|
return this.assertLegalChar(val); |
|
}; |
|
|
|
XMLStringifier.prototype.eleText = function(val) { |
|
val = '' + val || ''; |
|
return this.assertLegalChar(this.elEscape(val)); |
|
}; |
|
|
|
XMLStringifier.prototype.cdata = function(val) { |
|
val = '' + val || ''; |
|
if (val.match(/]]>/)) { |
|
throw new Error("Invalid CDATA text: " + val); |
|
} |
|
return this.assertLegalChar(val); |
|
}; |
|
|
|
XMLStringifier.prototype.comment = function(val) { |
|
val = '' + val || ''; |
|
if (val.match(/--/)) { |
|
throw new Error("Comment text cannot contain double-hypen: " + val); |
|
} |
|
return this.assertLegalChar(val); |
|
}; |
|
|
|
XMLStringifier.prototype.raw = function(val) { |
|
return '' + val || ''; |
|
}; |
|
|
|
XMLStringifier.prototype.attName = function(val) { |
|
return '' + val || ''; |
|
}; |
|
|
|
XMLStringifier.prototype.attValue = function(val) { |
|
val = '' + val || ''; |
|
return this.attEscape(val); |
|
}; |
|
|
|
XMLStringifier.prototype.insTarget = function(val) { |
|
return '' + val || ''; |
|
}; |
|
|
|
XMLStringifier.prototype.insValue = function(val) { |
|
val = '' + val || ''; |
|
if (val.match(/\?>/)) { |
|
throw new Error("Invalid processing instruction value: " + val); |
|
} |
|
return val; |
|
}; |
|
|
|
XMLStringifier.prototype.xmlVersion = function(val) { |
|
val = '' + val || ''; |
|
if (!val.match(/1\.[0-9]+/)) { |
|
throw new Error("Invalid version number: " + val); |
|
} |
|
return val; |
|
}; |
|
|
|
XMLStringifier.prototype.xmlEncoding = function(val) { |
|
val = '' + val || ''; |
|
if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-]|-)*$/)) { |
|
throw new Error("Invalid encoding: " + val); |
|
} |
|
return val; |
|
}; |
|
|
|
XMLStringifier.prototype.xmlStandalone = function(val) { |
|
if (val) { |
|
return "yes"; |
|
} else { |
|
return "no"; |
|
} |
|
}; |
|
|
|
XMLStringifier.prototype.dtdPubID = function(val) { |
|
return '' + val || ''; |
|
}; |
|
|
|
XMLStringifier.prototype.dtdSysID = function(val) { |
|
return '' + val || ''; |
|
}; |
|
|
|
XMLStringifier.prototype.dtdElementValue = function(val) { |
|
return '' + val || ''; |
|
}; |
|
|
|
XMLStringifier.prototype.dtdAttType = function(val) { |
|
return '' + val || ''; |
|
}; |
|
|
|
XMLStringifier.prototype.dtdAttDefault = function(val) { |
|
if (val != null) { |
|
return '' + val || ''; |
|
} else { |
|
return val; |
|
} |
|
}; |
|
|
|
XMLStringifier.prototype.dtdEntityValue = function(val) { |
|
return '' + val || ''; |
|
}; |
|
|
|
XMLStringifier.prototype.dtdNData = function(val) { |
|
return '' + val || ''; |
|
}; |
|
|
|
XMLStringifier.prototype.convertAttKey = '@'; |
|
|
|
XMLStringifier.prototype.convertPIKey = '?'; |
|
|
|
XMLStringifier.prototype.convertTextKey = '#text'; |
|
|
|
XMLStringifier.prototype.convertCDataKey = '#cdata'; |
|
|
|
XMLStringifier.prototype.convertCommentKey = '#comment'; |
|
|
|
XMLStringifier.prototype.convertRawKey = '#raw'; |
|
|
|
XMLStringifier.prototype.assertLegalChar = function(str) { |
|
var chars, chr; |
|
if (this.allowSurrogateChars) { |
|
chars = /[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uFFFE-\uFFFF]/; |
|
} else { |
|
chars = /[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/; |
|
} |
|
chr = str.match(chars); |
|
if (chr) { |
|
throw new Error("Invalid character (" + chr + ") in string: " + str + " at index " + chr.index); |
|
} |
|
return str; |
|
}; |
|
|
|
XMLStringifier.prototype.elEscape = function(str) { |
|
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\r/g, '
'); |
|
}; |
|
|
|
XMLStringifier.prototype.attEscape = function(str) { |
|
return str.replace(/&/g, '&').replace(/</g, '<').replace(/"/g, '"'); |
|
}; |
|
|
|
return XMLStringifier; |
|
|
|
})(); |
|
|
|
}).call(this); |
|
|
|
},{}],78:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLNode, XMLText, create, |
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, |
|
hasProp = {}.hasOwnProperty; |
|
|
|
create = require('lodash/object/create'); |
|
|
|
XMLNode = require('./XMLNode'); |
|
|
|
module.exports = XMLText = (function(superClass) { |
|
extend(XMLText, superClass); |
|
|
|
function XMLText(parent, text) { |
|
XMLText.__super__.constructor.call(this, parent); |
|
if (text == null) { |
|
throw new Error("Missing element text"); |
|
} |
|
this.value = this.stringify.eleText(text); |
|
} |
|
|
|
XMLText.prototype.clone = function() { |
|
return create(XMLText.prototype, this); |
|
}; |
|
|
|
XMLText.prototype.toString = function(options, level) { |
|
var indent, newline, offset, pretty, r, ref, ref1, ref2, space; |
|
pretty = (options != null ? options.pretty : void 0) || false; |
|
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; |
|
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; |
|
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; |
|
level || (level = 0); |
|
space = new Array(level + offset + 1).join(indent); |
|
r = ''; |
|
if (pretty) { |
|
r += space; |
|
} |
|
r += this.value; |
|
if (pretty) { |
|
r += newline; |
|
} |
|
return r; |
|
}; |
|
|
|
return XMLText; |
|
|
|
})(XMLNode); |
|
|
|
}).call(this); |
|
|
|
},{"./XMLNode":74,"lodash/object/create":57}],79:[function(require,module,exports){ |
|
// Generated by CoffeeScript 1.9.1 |
|
(function() { |
|
var XMLBuilder, assign; |
|
|
|
assign = require('lodash/object/assign'); |
|
|
|
XMLBuilder = require('./XMLBuilder'); |
|
|
|
module.exports.create = function(name, xmldec, doctype, options) { |
|
options = assign({}, xmldec, doctype, options); |
|
return new XMLBuilder(name, options).root(); |
|
}; |
|
|
|
}).call(this); |
|
|
|
},{"./XMLBuilder":64,"lodash/object/assign":56}]},{},[1])(1) |
|
}); |