node_modules

This commit is contained in:
Florian Dold 2016-11-03 01:33:53 +01:00
parent d0a0695fb5
commit d1291f6755
10780 changed files with 186808 additions and 442235 deletions

1
node_modules/.bin/babylon generated vendored
View File

@ -1 +0,0 @@
../babylon/bin/babylon.js

1
node_modules/.bin/dateformat generated vendored
View File

@ -1 +0,0 @@
../dateformat/bin/cli.js

1
node_modules/.bin/detect-indent generated vendored
View File

@ -1 +0,0 @@
../detect-indent/cli.js

1
node_modules/.bin/jade generated vendored
View File

@ -1 +0,0 @@
../jade/bin/jade

1
node_modules/.bin/jsesc generated vendored
View File

@ -1 +0,0 @@
../jsesc/bin/jsesc

1
node_modules/.bin/loose-envify generated vendored
View File

@ -1 +0,0 @@
../loose-envify/cli.js

1
node_modules/.bin/mkdirp generated vendored
View File

@ -1 +0,0 @@
../mkdirp/bin/cmd.js

1
node_modules/.bin/rimraf generated vendored
View File

@ -1 +0,0 @@
../rimraf/bin.js

1
node_modules/.bin/strip-indent generated vendored
View File

@ -1 +0,0 @@
../strip-indent/cli.js

1
node_modules/.bin/user-home generated vendored
View File

@ -1 +0,0 @@
../user-home/cli.js

1
node_modules/.bin/which generated vendored
View File

@ -1 +0,0 @@
../which/bin/which

1
node_modules/.yarn-integrity generated vendored Normal file
View File

@ -0,0 +1 @@
4ba2f689d57511507e94d43fc06be3ad7c3198ea985e1cb661c2eef84d2fc993

5
node_modules/adm-zip/.idea/scopes/scope_settings.xml generated vendored Normal file
View File

@ -0,0 +1,5 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>

21
node_modules/adm-zip/MIT-LICENSE.txt generated vendored Normal file
View File

@ -0,0 +1,21 @@
Copyright (c) 2012 Another-D-Mention Software and other contributors,
http://www.another-d-mention.ro/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

64
node_modules/adm-zip/README.md generated vendored Normal file
View File

@ -0,0 +1,64 @@
# ADM-ZIP for NodeJS
ADM-ZIP is a pure JavaScript implementation for zip data compression for [NodeJS](http://nodejs.org/).
# Installation
With [npm](http://npmjs.org) do:
$ npm install adm-zip
## What is it good for?
The library allows you to:
* decompress zip files directly to disk or in memory buffers
* compress files and store them to disk in .zip format or in compressed buffers
* update content of/add new/delete files from an existing .zip
# Dependencies
There are no other nodeJS libraries that ADM-ZIP is dependent of
# Examples
## Basic usage
```javascript
var AdmZip = require('adm-zip');
// reading archives
var zip = new AdmZip("./my_file.zip");
var zipEntries = zip.getEntries(); // an array of ZipEntry records
zipEntries.forEach(function(zipEntry) {
console.log(zipEntry.toString()); // outputs zip entries information
if (zipEntry.entryName == "my_file.txt") {
console.log(zipEntry.data.toString('utf8'));
}
});
// outputs the content of some_folder/my_file.txt
console.log(zip.readAsText("some_folder/my_file.txt"));
// extracts the specified file to the specified location
zip.extractEntryTo(/*entry name*/"some_folder/my_file.txt", /*target path*/"/home/me/tempfolder", /*maintainEntryPath*/false, /*overwrite*/true);
// extracts everything
zip.extractAllTo(/*target path*/"/home/me/zipcontent/", /*overwrite*/true);
// creating archives
var zip = new AdmZip();
// add file directly
zip.addFile("test.txt", new Buffer("inner content of the file"), "entry comment goes here");
// add local file
zip.addLocalFile("/home/me/some_picture.png");
// get everything as a buffer
var willSendthis = zip.toBuffer();
// or write everything to disk
zip.writeZip(/*target file name*/"/home/me/files.zip");
// ... more examples in the wiki
```
For more detailed information please check out the [wiki](https://github.com/cthackers/adm-zip/wiki).
[![build status](https://secure.travis-ci.org/cthackers/adm-zip.png)](http://travis-ci.org/cthackers/adm-zip)

404
node_modules/adm-zip/adm-zip.js generated vendored Normal file
View File

@ -0,0 +1,404 @@
var fs = require("fs"),
pth = require("path");
fs.existsSync = fs.existsSync || pth.existsSync;
var ZipEntry = require("./zipEntry"),
ZipFile = require("./zipFile"),
Utils = require("./util");
module.exports = function(/*String*/input) {
var _zip = undefined,
_filename = "";
if (input && typeof input === "string") { // load zip file
if (fs.existsSync(input)) {
_filename = input;
_zip = new ZipFile(input, Utils.Constants.FILE);
} else {
throw Utils.Errors.INVALID_FILENAME;
}
} else if(input && Buffer.isBuffer(input)) { // load buffer
_zip = new ZipFile(input, Utils.Constants.BUFFER);
} else { // create new zip file
_zip = new ZipFile(null, Utils.Constants.NONE);
}
function getEntry(/*Object*/entry) {
if (entry && _zip) {
var item;
// If entry was given as a file name
if (typeof entry === "string")
item = _zip.getEntry(entry);
// if entry was given as a ZipEntry object
if (typeof entry === "object" && entry.entryName != undefined && entry.header != undefined)
item = _zip.getEntry(entry.entryName);
if (item) {
return item;
}
}
return null;
}
return {
/**
* Extracts the given entry from the archive and returns the content as a Buffer object
* @param entry ZipEntry object or String with the full path of the entry
*
* @return Buffer or Null in case of error
*/
readFile : function(/*Object*/entry) {
var item = getEntry(entry);
return item && item.getData() || null;
},
/**
* Asynchronous readFile
* @param entry ZipEntry object or String with the full path of the entry
* @param callback
*
* @return Buffer or Null in case of error
*/
readFileAsync : function(/*Object*/entry, /*Function*/callback) {
var item = getEntry(entry);
if (item) {
item.getDataAsync(callback);
} else {
callback(null,"getEntry failed for:" + entry)
}
},
/**
* Extracts the given entry from the archive and returns the content as plain text in the given encoding
* @param entry ZipEntry object or String with the full path of the entry
* @param encoding Optional. If no encoding is specified utf8 is used
*
* @return String
*/
readAsText : function(/*Object*/entry, /*String - Optional*/encoding) {
var item = getEntry(entry);
if (item) {
var data = item.getData();
if (data && data.length) {
return data.toString(encoding || "utf8");
}
}
return "";
},
/**
* Asynchronous readAsText
* @param entry ZipEntry object or String with the full path of the entry
* @param callback
* @param encoding Optional. If no encoding is specified utf8 is used
*
* @return String
*/
readAsTextAsync : function(/*Object*/entry, /*Function*/callback, /*String - Optional*/encoding) {
var item = getEntry(entry);
if (item) {
item.getDataAsync(function(data) {
if (data && data.length) {
callback(data.toString(encoding || "utf8"));
} else {
callback("");
}
})
} else {
callback("");
}
},
/**
* Remove the entry from the file or the entry and all it's nested directories and files if the given entry is a directory
*
* @param entry
*/
deleteFile : function(/*Object*/entry) { // @TODO: test deleteFile
var item = getEntry(entry);
if (item) {
_zip.deleteEntry(item.entryName);
}
},
/**
* Adds a comment to the zip. The zip must be rewritten after adding the comment.
*
* @param comment
*/
addZipComment : function(/*String*/comment) { // @TODO: test addZipComment
_zip.comment = comment;
},
/**
* Returns the zip comment
*
* @return String
*/
getZipComment : function() {
return _zip.comment || '';
},
/**
* Adds a comment to a specified zipEntry. The zip must be rewritten after adding the comment
* The comment cannot exceed 65535 characters in length
*
* @param entry
* @param comment
*/
addZipEntryComment : function(/*Object*/entry,/*String*/comment) {
var item = getEntry(entry);
if (item) {
item.comment = comment;
}
},
/**
* Returns the comment of the specified entry
*
* @param entry
* @return String
*/
getZipEntryComment : function(/*Object*/entry) {
var item = getEntry(entry);
if (item) {
return item.comment || '';
}
return ''
},
/**
* Updates the content of an existing entry inside the archive. The zip must be rewritten after updating the content
*
* @param entry
* @param content
*/
updateFile : function(/*Object*/entry, /*Buffer*/content) {
var item = getEntry(entry);
if (item) {
item.setData(content);
}
},
/**
* Adds a file from the disk to the archive
*
* @param localPath
*/
addLocalFile : function(/*String*/localPath, /*String*/zipPath) {
if (fs.existsSync(localPath)) {
if(zipPath){
zipPath=zipPath.split("\\").join("/");
if(zipPath.charAt(zipPath.length - 1) != "/"){
zipPath += "/";
}
}else{
zipPath="";
}
var p = localPath.split("\\").join("/").split("/").pop();
this.addFile(zipPath+p, fs.readFileSync(localPath), "", 0)
} else {
throw Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath);
}
},
/**
* Adds a local directory and all its nested files and directories to the archive
*
* @param localPath
*/
addLocalFolder : function(/*String*/localPath, /*String*/zipPath) {
if(zipPath){
zipPath=zipPath.split("\\").join("/");
if(zipPath.charAt(zipPath.length - 1) != "/"){
zipPath += "/";
}
}else{
zipPath="";
}
localPath = localPath.split("\\").join("/"); //windows fix
if (localPath.charAt(localPath.length - 1) != "/")
localPath += "/";
if (fs.existsSync(localPath)) {
var items = Utils.findFiles(localPath),
self = this;
if (items.length) {
items.forEach(function(path) {
var p = path.split("\\").join("/").replace(localPath, ""); //windows fix
if (p.charAt(p.length - 1) !== "/") {
self.addFile(zipPath+p, fs.readFileSync(path), "", 0)
} else {
self.addFile(zipPath+p, new Buffer(0), "", 0)
}
});
}
} else {
throw Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath);
}
},
/**
* Allows you to create a entry (file or directory) in the zip file.
* If you want to create a directory the entryName must end in / and a null buffer should be provided.
* Comment and attributes are optional
*
* @param entryName
* @param content
* @param comment
* @param attr
*/
addFile : function(/*String*/entryName, /*Buffer*/content, /*String*/comment, /*Number*/attr) {
var entry = new ZipEntry();
entry.entryName = entryName;
entry.comment = comment || "";
entry.attr = attr || 438; //0666;
if (entry.isDirectory && content.length) {
// throw Utils.Errors.DIRECTORY_CONTENT_ERROR;
}
entry.setData(content);
_zip.setEntry(entry);
},
/**
* Returns an array of ZipEntry objects representing the files and folders inside the archive
*
* @return Array
*/
getEntries : function() {
if (_zip) {
return _zip.entries;
} else {
return [];
}
},
/**
* Returns a ZipEntry object representing the file or folder specified by ``name``.
*
* @param name
* @return ZipEntry
*/
getEntry : function(/*String*/name) {
return getEntry(name);
},
/**
* Extracts the given entry to the given targetPath
* If the entry is a directory inside the archive, the entire directory and it's subdirectories will be extracted
*
* @param entry ZipEntry object or String with the full path of the entry
* @param targetPath Target folder where to write the file
* @param maintainEntryPath If maintainEntryPath is true and the entry is inside a folder, the entry folder
* will be created in targetPath as well. Default is TRUE
* @param overwrite If the file already exists at the target path, the file will be overwriten if this is true.
* Default is FALSE
*
* @return Boolean
*/
extractEntryTo : function(/*Object*/entry, /*String*/targetPath, /*Boolean*/maintainEntryPath, /*Boolean*/overwrite) {
overwrite = overwrite || false;
maintainEntryPath = typeof maintainEntryPath == "undefined" ? true : maintainEntryPath;
var item = getEntry(entry);
if (!item) {
throw Utils.Errors.NO_ENTRY;
}
var target = pth.resolve(targetPath, maintainEntryPath ? item.entryName : pth.basename(item.entryName));
if (item.isDirectory) {
target = pth.resolve(target, "..");
var children = _zip.getEntryChildren(item);
children.forEach(function(child) {
if (child.isDirectory) return;
var content = child.getData();
if (!content) {
throw Utils.Errors.CANT_EXTRACT_FILE;
}
Utils.writeFileTo(pth.resolve(targetPath, maintainEntryPath ? child.entryName : child.entryName.substr(item.entryName.length)), content, overwrite);
});
return true;
}
var content = item.getData();
if (!content) throw Utils.Errors.CANT_EXTRACT_FILE;
if (fs.existsSync(targetPath) && !overwrite) {
throw Utils.Errors.CANT_OVERRIDE;
}
Utils.writeFileTo(target, content, overwrite);
return true;
},
/**
* Extracts the entire archive to the given location
*
* @param targetPath Target location
* @param overwrite If the file already exists at the target path, the file will be overwriten if this is true.
* Default is FALSE
*/
extractAllTo : function(/*String*/targetPath, /*Boolean*/overwrite) {
overwrite = overwrite || false;
if (!_zip) {
throw Utils.Errors.NO_ZIP;
}
_zip.entries.forEach(function(entry) {
if (entry.isDirectory) {
Utils.makeDir(pth.resolve(targetPath, entry.entryName.toString()));
return;
}
var content = entry.getData();
if (!content) {
throw Utils.Errors.CANT_EXTRACT_FILE + "2";
}
Utils.writeFileTo(pth.resolve(targetPath, entry.entryName.toString()), content, overwrite);
})
},
/**
* Writes the newly created zip file to disk at the specified location or if a zip was opened and no ``targetFileName`` is provided, it will overwrite the opened zip
*
* @param targetFileName
* @param callback
*/
writeZip : function(/*String*/targetFileName, /*Function*/callback) {
if (arguments.length == 1) {
if (typeof targetFileName == "function") {
callback = targetFileName;
targetFileName = "";
}
}
if (!targetFileName && _filename) {
targetFileName = _filename;
}
if (!targetFileName) return;
var zipData = _zip.compressToBuffer();
if (zipData) {
Utils.writeFileTo(targetFileName, zipData, true);
}
},
/**
* Returns the content of the entire zip file as a Buffer object
*
* @return Buffer
*/
toBuffer : function(/*Function*/onSuccess,/*Function*/onFail,/*Function*/onItemStart,/*Function*/onItemEnd) {
this.valueOf = 2;
if (typeof onSuccess == "function") {
_zip.toAsyncBuffer(onSuccess,onFail,onItemStart,onItemEnd);
return null;
}
return _zip.compressToBuffer()
}
}
};

261
node_modules/adm-zip/headers/entryHeader.js generated vendored Normal file
View File

@ -0,0 +1,261 @@
var Utils = require("../util"),
Constants = Utils.Constants;
/* The central directory file header */
module.exports = function () {
var _verMade = 0x0A,
_version = 0x0A,
_flags = 0,
_method = 0,
_time = 0,
_crc = 0,
_compressedSize = 0,
_size = 0,
_fnameLen = 0,
_extraLen = 0,
_comLen = 0,
_diskStart = 0,
_inattr = 0,
_attr = 0,
_offset = 0;
var _dataHeader = {};
function setTime(val) {
var val = new Date(val);
_time = (val.getFullYear() - 1980 & 0x7f) << 25 // b09-16 years from 1980
| (val.getMonth() + 1) << 21 // b05-08 month
| val.getDay() << 16 // b00-04 hour
// 2 bytes time
| val.getHours() << 11 // b11-15 hour
| val.getMinutes() << 5 // b05-10 minute
| val.getSeconds() >> 1; // b00-04 seconds divided by 2
}
setTime(+new Date());
return {
get made () { return _verMade; },
set made (val) { _verMade = val; },
get version () { return _version; },
set version (val) { _version = val },
get flags () { return _flags },
set flags (val) { _flags = val; },
get method () { return _method; },
set method (val) { _method = val; },
get time () { return new Date(
((_time >> 25) & 0x7f) + 1980,
((_time >> 21) & 0x0f) - 1,
(_time >> 16) & 0x1f,
(_time >> 11) & 0x1f,
(_time >> 5) & 0x3f,
(_time & 0x1f) << 1
);
},
set time (val) {
setTime(val);
},
get crc () { return _crc; },
set crc (val) { _crc = val; },
get compressedSize () { return _compressedSize; },
set compressedSize (val) { _compressedSize = val; },
get size () { return _size; },
set size (val) { _size = val; },
get fileNameLength () { return _fnameLen; },
set fileNameLength (val) { _fnameLen = val; },
get extraLength () { return _extraLen },
set extraLength (val) { _extraLen = val; },
get commentLength () { return _comLen },
set commentLength (val) { _comLen = val },
get diskNumStart () { return _diskStart },
set diskNumStart (val) { _diskStart = val },
get inAttr () { return _inattr },
set inAttr (val) { _inattr = val },
get attr () { return _attr },
set attr (val) { _attr = val },
get offset () { return _offset },
set offset (val) { _offset = val },
get encripted () { return (_flags & 1) == 1 },
get entryHeaderSize () {
return Constants.CENHDR + _fnameLen + _extraLen + _comLen;
},
get realDataOffset () {
return _offset + Constants.LOCHDR + _dataHeader.fnameLen + _dataHeader.extraLen;
},
get dataHeader () {
return _dataHeader;
},
loadDataHeaderFromBinary : function(/*Buffer*/input) {
var data = input.slice(_offset, _offset + Constants.LOCHDR);
// 30 bytes and should start with "PK\003\004"
if (data.readUInt32LE(0) != Constants.LOCSIG) {
throw Utils.Errors.INVALID_LOC;
}
_dataHeader = {
// version needed to extract
version : data.readUInt16LE(Constants.LOCVER),
// general purpose bit flag
flags : data.readUInt16LE(Constants.LOCFLG),
// compression method
method : data.readUInt16LE(Constants.LOCHOW),
// modification time (2 bytes time, 2 bytes date)
time : data.readUInt32LE(Constants.LOCTIM),
// uncompressed file crc-32 value
crc : data.readUInt32LE(Constants.LOCCRC),
// compressed size
compressedSize : data.readUInt32LE(Constants.LOCSIZ),
// uncompressed size
size : data.readUInt32LE(Constants.LOCLEN),
// filename length
fnameLen : data.readUInt16LE(Constants.LOCNAM),
// extra field length
extraLen : data.readUInt16LE(Constants.LOCEXT)
}
},
loadFromBinary : function(/*Buffer*/data) {
// data should be 46 bytes and start with "PK 01 02"
if (data.length != Constants.CENHDR || data.readUInt32LE(0) != Constants.CENSIG) {
throw Utils.Errors.INVALID_CEN;
}
// version made by
_verMade = data.readUInt16LE(Constants.CENVEM);
// version needed to extract
_version = data.readUInt16LE(Constants.CENVER);
// encrypt, decrypt flags
_flags = data.readUInt16LE(Constants.CENFLG);
// compression method
_method = data.readUInt16LE(Constants.CENHOW);
// modification time (2 bytes time, 2 bytes date)
_time = data.readUInt32LE(Constants.CENTIM);
// uncompressed file crc-32 value
_crc = data.readUInt32LE(Constants.CENCRC);
// compressed size
_compressedSize = data.readUInt32LE(Constants.CENSIZ);
// uncompressed size
_size = data.readUInt32LE(Constants.CENLEN);
// filename length
_fnameLen = data.readUInt16LE(Constants.CENNAM);
// extra field length
_extraLen = data.readUInt16LE(Constants.CENEXT);
// file comment length
_comLen = data.readUInt16LE(Constants.CENCOM);
// volume number start
_diskStart = data.readUInt16LE(Constants.CENDSK);
// internal file attributes
_inattr = data.readUInt16LE(Constants.CENATT);
// external file attributes
_attr = data.readUInt32LE(Constants.CENATX);
// LOC header offset
_offset = data.readUInt32LE(Constants.CENOFF);
},
dataHeaderToBinary : function() {
// LOC header size (30 bytes)
var data = new Buffer(Constants.LOCHDR);
// "PK\003\004"
data.writeUInt32LE(Constants.LOCSIG, 0);
// version needed to extract
data.writeUInt16LE(_version, Constants.LOCVER);
// general purpose bit flag
data.writeUInt16LE(_flags, Constants.LOCFLG);
// compression method
data.writeUInt16LE(_method, Constants.LOCHOW);
// modification time (2 bytes time, 2 bytes date)
data.writeUInt32LE(_time, Constants.LOCTIM);
// uncompressed file crc-32 value
data.writeUInt32LE(_crc, Constants.LOCCRC);
// compressed size
data.writeUInt32LE(_compressedSize, Constants.LOCSIZ);
// uncompressed size
data.writeUInt32LE(_size, Constants.LOCLEN);
// filename length
data.writeUInt16LE(_fnameLen, Constants.LOCNAM);
// extra field length
data.writeUInt16LE(_extraLen, Constants.LOCEXT);
return data;
},
entryHeaderToBinary : function() {
// CEN header size (46 bytes)
var data = new Buffer(Constants.CENHDR + _fnameLen + _extraLen + _comLen);
// "PK\001\002"
data.writeUInt32LE(Constants.CENSIG, 0);
// version made by
data.writeUInt16LE(_verMade, Constants.CENVEM);
// version needed to extract
data.writeUInt16LE(_version, Constants.CENVER);
// encrypt, decrypt flags
data.writeUInt16LE(_flags, Constants.CENFLG);
// compression method
data.writeUInt16LE(_method, Constants.CENHOW);
// modification time (2 bytes time, 2 bytes date)
data.writeUInt32LE(_time, Constants.CENTIM);
// uncompressed file crc-32 value
data.writeInt32LE(_crc, Constants.CENCRC, true);
// compressed size
data.writeUInt32LE(_compressedSize, Constants.CENSIZ);
// uncompressed size
data.writeUInt32LE(_size, Constants.CENLEN);
// filename length
data.writeUInt16LE(_fnameLen, Constants.CENNAM);
// extra field length
data.writeUInt16LE(_extraLen, Constants.CENEXT);
// file comment length
data.writeUInt16LE(_comLen, Constants.CENCOM);
// volume number start
data.writeUInt16LE(_diskStart, Constants.CENDSK);
// internal file attributes
data.writeUInt16LE(_inattr, Constants.CENATT);
// external file attributes
data.writeUInt32LE(_attr, Constants.CENATX);
// LOC header offset
data.writeUInt32LE(_offset, Constants.CENOFF);
// fill all with
data.fill(0x00, Constants.CENHDR);
return data;
},
toString : function() {
return '{\n' +
'\t"made" : ' + _verMade + ",\n" +
'\t"version" : ' + _version + ",\n" +
'\t"flags" : ' + _flags + ",\n" +
'\t"method" : ' + Utils.methodToString(_method) + ",\n" +
'\t"time" : ' + _time + ",\n" +
'\t"crc" : 0x' + _crc.toString(16).toUpperCase() + ",\n" +
'\t"compressedSize" : ' + _compressedSize + " bytes,\n" +
'\t"size" : ' + _size + " bytes,\n" +
'\t"fileNameLength" : ' + _fnameLen + ",\n" +
'\t"extraLength" : ' + _extraLen + " bytes,\n" +
'\t"commentLength" : ' + _comLen + " bytes,\n" +
'\t"diskNumStart" : ' + _diskStart + ",\n" +
'\t"inAttr" : ' + _inattr + ",\n" +
'\t"attr" : ' + _attr + ",\n" +
'\t"offset" : ' + _offset + ",\n" +
'\t"entryHeaderSize" : ' + (Constants.CENHDR + _fnameLen + _extraLen + _comLen) + " bytes\n" +
'}';
}
}
};

2
node_modules/adm-zip/headers/index.js generated vendored Normal file
View File

@ -0,0 +1,2 @@
exports.EntryHeader = require("./entryHeader");
exports.MainHeader = require("./mainHeader");

80
node_modules/adm-zip/headers/mainHeader.js generated vendored Normal file
View File

@ -0,0 +1,80 @@
var Utils = require("../util"),
Constants = Utils.Constants;
/* The entries in the end of central directory */
module.exports = function () {
var _volumeEntries = 0,
_totalEntries = 0,
_size = 0,
_offset = 0,
_commentLength = 0;
return {
get diskEntries () { return _volumeEntries },
set diskEntries (/*Number*/val) { _volumeEntries = _totalEntries = val; },
get totalEntries () { return _totalEntries },
set totalEntries (/*Number*/val) { _totalEntries = _volumeEntries = val; },
get size () { return _size },
set size (/*Number*/val) { _size = val; },
get offset () { return _offset },
set offset (/*Number*/val) { _offset = val; },
get commentLength () { return _commentLength },
set commentLength (/*Number*/val) { _commentLength = val; },
get mainHeaderSize () {
return Constants.ENDHDR + _commentLength;
},
loadFromBinary : function(/*Buffer*/data) {
// data should be 22 bytes and start with "PK 05 06"
if (data.length != Constants.ENDHDR || data.readUInt32LE(0) != Constants.ENDSIG)
throw Utils.Errors.INVALID_END;
// number of entries on this volume
_volumeEntries = data.readUInt16LE(Constants.ENDSUB);
// total number of entries
_totalEntries = data.readUInt16LE(Constants.ENDTOT);
// central directory size in bytes
_size = data.readUInt32LE(Constants.ENDSIZ);
// offset of first CEN header
_offset = data.readUInt32LE(Constants.ENDOFF);
// zip file comment length
_commentLength = data.readUInt16LE(Constants.ENDCOM);
},
toBinary : function() {
var b = new Buffer(Constants.ENDHDR + _commentLength);
// "PK 05 06" signature
b.writeUInt32LE(Constants.ENDSIG, 0);
b.writeUInt32LE(0, 4);
// number of entries on this volume
b.writeUInt16LE(_volumeEntries, Constants.ENDSUB);
// total number of entries
b.writeUInt16LE(_totalEntries, Constants.ENDTOT);
// central directory size in bytes
b.writeUInt32LE(_size, Constants.ENDSIZ);
// offset of first CEN header
b.writeUInt32LE(_offset, Constants.ENDOFF);
// zip file comment length
b.writeUInt16LE(_commentLength, Constants.ENDCOM);
// fill comment memory with spaces so no garbage is left there
b.fill(" ", Constants.ENDHDR);
return b;
},
toString : function() {
return '{\n' +
'\t"diskEntries" : ' + _volumeEntries + ",\n" +
'\t"totalEntries" : ' + _totalEntries + ",\n" +
'\t"size" : ' + _size + " bytes,\n" +
'\t"offset" : 0x' + _offset.toString(16).toUpperCase() + ",\n" +
'\t"commentLength" : 0x' + _commentLength + "\n" +
'}';
}
}
};

1578
node_modules/adm-zip/methods/deflater.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

2
node_modules/adm-zip/methods/index.js generated vendored Normal file
View File

@ -0,0 +1,2 @@
exports.Deflater = require("./deflater");
exports.Inflater = require("./inflater");

448
node_modules/adm-zip/methods/inflater.js generated vendored Normal file
View File

@ -0,0 +1,448 @@
var Buffer = require("buffer").Buffer;
function JSInflater(/*Buffer*/input) {
var WSIZE = 0x8000,
slide = new Buffer(0x10000),
windowPos = 0,
fixedTableList = null,
fixedTableDist,
fixedLookup,
bitBuf = 0,
bitLen = 0,
method = -1,
eof = false,
copyLen = 0,
copyDist = 0,
tblList, tblDist, bitList, bitdist,
inputPosition = 0,
MASK_BITS = [0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff],
LENS = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0],
LEXT = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99],
DISTS = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577],
DEXT = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13],
BITORDER = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
function HuffTable(clen, cnum, cval, blist, elist, lookupm) {
this.status = 0;
this.root = null;
this.maxbit = 0;
var el, f, tail,
offsets = [],
countTbl = [],
sTbl = [],
values = [],
tentry = {extra: 0, bitcnt: 0, lbase: 0, next: null};
tail = this.root = null;
for(var i = 0; i < 0x11; i++) { countTbl[i] = 0; sTbl[i] = 0; offsets[i] = 0; }
for(i = 0; i < 0x120; i++) values[i] = 0;
el = cnum > 256 ? clen[256] : 16;
var pidx = -1;
while (++pidx < cnum) countTbl[clen[pidx]]++;
if(countTbl[0] == cnum) return;
for(var j = 1; j <= 16; j++) if(countTbl[j] != 0) break;
var bitLen = j;
for(i = 16; i != 0; i--) if(countTbl[i] != 0) break;
var maxLen = i;
lookupm < j && (lookupm = j);
var dCodes = 1 << j;
for(; j < i; j++, dCodes <<= 1)
if((dCodes -= countTbl[j]) < 0) {
this.status = 2;
this.maxbit = lookupm;
return;
}
if((dCodes -= countTbl[i]) < 0) {
this.status = 2;
this.maxbit = lookupm;
return;
}
countTbl[i] += dCodes;
offsets[1] = j = 0;
pidx = 1;
var xp = 2;
while(--i > 0) offsets[xp++] = (j += countTbl[pidx++]);
pidx = 0;
i = 0;
do {
(j = clen[pidx++]) && (values[offsets[j]++] = i);
} while(++i < cnum);
cnum = offsets[maxLen];
offsets[0] = i = 0;
pidx = 0;
var level = -1,
w = sTbl[0] = 0,
cnode = null,
tblCnt = 0,
tblStack = [];
for(; bitLen <= maxLen; bitLen++) {
var kccnt = countTbl[bitLen];
while(kccnt-- > 0) {
while(bitLen > w + sTbl[1 + level]) {
w += sTbl[1 + level];
level++;
tblCnt = (tblCnt = maxLen - w) > lookupm ? lookupm : tblCnt;
if((f = 1 << (j = bitLen - w)) > kccnt + 1) {
f -= kccnt + 1;
xp = bitLen;
while(++j < tblCnt) {
if((f <<= 1) <= countTbl[++xp]) break;
f -= countTbl[xp];
}
}
if(w + j > el && w < el) j = el - w;
tblCnt = 1 << j;
sTbl[1 + level] = j;
cnode = [];
while (cnode.length < tblCnt) cnode.push({extra: 0, bitcnt: 0, lbase: 0, next: null});
if (tail == null) {
tail = this.root = {next:null, list:null};
} else {
tail = tail.next = {next:null, list:null}
}
tail.next = null;
tail.list = cnode;
tblStack[level] = cnode;
if(level > 0) {
offsets[level] = i;
tentry.bitcnt = sTbl[level];
tentry.extra = 16 + j;
tentry.next = cnode;
j = (i & ((1 << w) - 1)) >> (w - sTbl[level]);
tblStack[level-1][j].extra = tentry.extra;
tblStack[level-1][j].bitcnt = tentry.bitcnt;
tblStack[level-1][j].lbase = tentry.lbase;
tblStack[level-1][j].next = tentry.next;
}
}
tentry.bitcnt = bitLen - w;
if(pidx >= cnum)
tentry.extra = 99;
else if(values[pidx] < cval) {
tentry.extra = (values[pidx] < 256 ? 16 : 15);
tentry.lbase = values[pidx++];
} else {
tentry.extra = elist[values[pidx] - cval];
tentry.lbase = blist[values[pidx++] - cval];
}
f = 1 << (bitLen - w);
for(j = i >> w; j < tblCnt; j += f) {
cnode[j].extra = tentry.extra;
cnode[j].bitcnt = tentry.bitcnt;
cnode[j].lbase = tentry.lbase;
cnode[j].next = tentry.next;
}
for(j = 1 << (bitLen - 1); (i & j) != 0; j >>= 1)
i ^= j;
i ^= j;
while((i & ((1 << w) - 1)) != offsets[level]) {
w -= sTbl[level];
level--;
}
}
}
this.maxbit = sTbl[1];
this.status = ((dCodes != 0 && maxLen != 1) ? 1 : 0);
}
function addBits(n) {
while(bitLen < n) {
bitBuf |= input[inputPosition++] << bitLen;
bitLen += 8;
}
return bitBuf;
}
function cutBits(n) {
bitLen -= n;
return bitBuf >>= n;
}
function maskBits(n) {
while(bitLen < n) {
bitBuf |= input[inputPosition++] << bitLen;
bitLen += 8;
}
var res = bitBuf & MASK_BITS[n];
bitBuf >>= n;
bitLen -= n;
return res;
}
function codes(buff, off, size) {
var e, t;
if(size == 0) return 0;
var n = 0;
for(;;) {
t = tblList.list[addBits(bitList) & MASK_BITS[bitList]];
e = t.extra;
while(e > 16) {
if(e == 99) return -1;
cutBits(t.bitcnt);
e -= 16;
t = t.next[addBits(e) & MASK_BITS[e]];
e = t.extra;
}
cutBits(t.bitcnt);
if(e == 16) {
windowPos &= WSIZE - 1;
buff[off + n++] = slide[windowPos++] = t.lbase;
if(n == size) return size;
continue;
}
if(e == 15) break;
copyLen = t.lbase + maskBits(e);
t = tblDist.list[addBits(bitdist) & MASK_BITS[bitdist]];
e = t.extra;
while(e > 16) {
if(e == 99) return -1;
cutBits(t.bitcnt);
e -= 16;
t = t.next[addBits(e) & MASK_BITS[e]];
e = t.extra
}
cutBits(t.bitcnt);
copyDist = windowPos - t.lbase - maskBits(e);
while(copyLen > 0 && n < size) {
copyLen--;
copyDist &= WSIZE - 1;
windowPos &= WSIZE - 1;
buff[off + n++] = slide[windowPos++] = slide[copyDist++];
}
if(n == size) return size;
}
method = -1; // done
return n;
}
function stored(buff, off, size) {
cutBits(bitLen & 7);
var n = maskBits(0x10);
if(n != ((~maskBits(0x10)) & 0xffff)) return -1;
copyLen = n;
n = 0;
while(copyLen > 0 && n < size) {
copyLen--;
windowPos &= WSIZE - 1;
buff[off + n++] = slide[windowPos++] = maskBits(8);
}
if(copyLen == 0) method = -1;
return n;
}
function fixed(buff, off, size) {
var fixed_bd = 0;
if(fixedTableList == null) {
var lengths = [];
for(var symbol = 0; symbol < 144; symbol++) lengths[symbol] = 8;
for(; symbol < 256; symbol++) lengths[symbol] = 9;
for(; symbol < 280; symbol++) lengths[symbol] = 7;
for(; symbol < 288; symbol++) lengths[symbol] = 8;
fixedLookup = 7;
var htbl = new HuffTable(lengths, 288, 257, LENS, LEXT, fixedLookup);
if(htbl.status != 0) return -1;
fixedTableList = htbl.root;
fixedLookup = htbl.maxbit;
for(symbol = 0; symbol < 30; symbol++) lengths[symbol] = 5;
fixed_bd = 5;
htbl = new HuffTable(lengths, 30, 0, DISTS, DEXT, fixed_bd);
if(htbl.status > 1) {
fixedTableList = null;
return -1;
}
fixedTableDist = htbl.root;
fixed_bd = htbl.maxbit;
}
tblList = fixedTableList;
tblDist = fixedTableDist;
bitList = fixedLookup;
bitdist = fixed_bd;
return codes(buff, off, size);
}
function dynamic(buff, off, size) {
var ll = new Array(0x023C);
for (var m = 0; m < 0x023C; m++) ll[m] = 0;
var llencnt = 257 + maskBits(5),
dcodescnt = 1 + maskBits(5),
bitlencnt = 4 + maskBits(4);
if(llencnt > 286 || dcodescnt > 30) return -1;
for(var j = 0; j < bitlencnt; j++) ll[BITORDER[j]] = maskBits(3);
for(; j < 19; j++) ll[BITORDER[j]] = 0;
// build decoding table for trees--single level, 7 bit lookup
bitList = 7;
var hufTable = new HuffTable(ll, 19, 19, null, null, bitList);
if(hufTable.status != 0)
return -1; // incomplete code set
tblList = hufTable.root;
bitList = hufTable.maxbit;
var lencnt = llencnt + dcodescnt,
i = 0,
lastLen = 0;
while(i < lencnt) {
var hufLcode = tblList.list[addBits(bitList) & MASK_BITS[bitList]];
j = hufLcode.bitcnt;
cutBits(j);
j = hufLcode.lbase;
if(j < 16)
ll[i++] = lastLen = j;
else if(j == 16) {
j = 3 + maskBits(2);
if(i + j > lencnt) return -1;
while(j-- > 0) ll[i++] = lastLen;
} else if(j == 17) {
j = 3 + maskBits(3);
if(i + j > lencnt) return -1;
while(j-- > 0) ll[i++] = 0;
lastLen = 0;
} else {
j = 11 + maskBits(7);
if(i + j > lencnt) return -1;
while(j-- > 0) ll[i++] = 0;
lastLen = 0;
}
}
bitList = 9;
hufTable = new HuffTable(ll, llencnt, 257, LENS, LEXT, bitList);
bitList == 0 && (hufTable.status = 1);
if (hufTable.status != 0) return -1;
tblList = hufTable.root;
bitList = hufTable.maxbit;
for(i = 0; i < dcodescnt; i++) ll[i] = ll[i + llencnt];
bitdist = 6;
hufTable = new HuffTable(ll, dcodescnt, 0, DISTS, DEXT, bitdist);
tblDist = hufTable.root;
bitdist = hufTable.maxbit;
if((bitdist == 0 && llencnt > 257) || hufTable.status != 0) return -1;
return codes(buff, off, size);
}
return {
inflate : function(/*Buffer*/outputBuffer) {
tblList = null;
var size = outputBuffer.length,
offset = 0, i;
while(offset < size) {
if(eof && method == -1) return;
if(copyLen > 0) {
if(method != 0) {
while(copyLen > 0 && offset < size) {
copyLen--;
copyDist &= WSIZE - 1;
windowPos &= WSIZE - 1;
outputBuffer[offset++] = (slide[windowPos++] = slide[copyDist++]);
}
} else {
while(copyLen > 0 && offset < size) {
copyLen--;
windowPos &= WSIZE - 1;
outputBuffer[offset++] = (slide[windowPos++] = maskBits(8));
}
copyLen == 0 && (method = -1); // done
}
if (offset == size) return;
}
if(method == -1) {
if(eof) break;
eof = maskBits(1) != 0;
method = maskBits(2);
tblList = null;
copyLen = 0;
}
switch(method) {
case 0: i = stored(outputBuffer, offset, size - offset); break;
case 1: i = tblList != null ? codes(outputBuffer, offset, size - offset) : fixed(outputBuffer, offset, size - offset); break;
case 2: i = tblList != null ? codes(outputBuffer, offset, size - offset) : dynamic(outputBuffer, offset, size - offset); break;
default: i = -1; break;
}
if(i == -1) return;
offset += i;
}
}
};
}
module.exports = function(/*Buffer*/inbuf) {
var zlib = require("zlib");
return {
inflateAsync : function(/*Function*/callback) {
var tmp = zlib.createInflateRaw(),
parts = [], total = 0;
tmp.on('data', function(data) {
parts.push(data);
total += data.length;
});
tmp.on('end', function() {
var buf = new Buffer(total), written = 0;
buf.fill(0);
for (var i = 0; i < parts.length; i++) {
var part = parts[i];
part.copy(buf, written);
written += part.length;
}
callback && callback(buf);
});
tmp.end(inbuf)
},
inflate : function(/*Buffer*/outputBuffer) {
var x = {
x: new JSInflater(inbuf)
};
x.x.inflate(outputBuffer);
delete(x.x);
}
}
};

31
node_modules/adm-zip/package.json generated vendored Normal file
View File

@ -0,0 +1,31 @@
{
"name": "adm-zip",
"version": "0.4.4",
"description": "A Javascript implementation of zip for nodejs. Allows user to create or extract zip files both in memory or to/from disk",
"keywords": [
"zip",
"methods",
"archive",
"unzip"
],
"homepage": "http://github.com/cthackers/adm-zip",
"author": "Nasca Iacob <sy@another-d-mention.ro> (https://github.com/cthackers)",
"bugs": {
"email": "sy@another-d-mention.ro",
"url": "https://github.com/cthackers/adm-zip/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://raw.github.com/cthackers/adm-zip/master/MIT-LICENSE.txt"
}
],
"main": "adm-zip.js",
"repository": {
"type": "git",
"url": "https://github.com/cthackers/adm-zip.git"
},
"engines": {
"node": ">=0.3.0"
}
}

BIN
node_modules/adm-zip/test/assets/attributes_test.zip generated vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

BIN
node_modules/adm-zip/test/assets/fast.zip generated vendored Normal file

Binary file not shown.

BIN
node_modules/adm-zip/test/assets/fastest.zip generated vendored Normal file

Binary file not shown.

BIN
node_modules/adm-zip/test/assets/linux_arc.zip generated vendored Normal file

Binary file not shown.

BIN
node_modules/adm-zip/test/assets/maximum.zip generated vendored Normal file

Binary file not shown.

BIN
node_modules/adm-zip/test/assets/normal.zip generated vendored Normal file

Binary file not shown.

BIN
node_modules/adm-zip/test/assets/store.zip generated vendored Normal file

Binary file not shown.

BIN
node_modules/adm-zip/test/assets/ultra.zip generated vendored Normal file

Binary file not shown.

5
node_modules/adm-zip/test/index.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
var Attr = require("../util").FileAttr,
Zip = require("../adm-zip"),
fs = require("fs");
//zip.addLocalFile("./test/readonly.txt");

84
node_modules/adm-zip/util/constants.js generated vendored Normal file
View File

@ -0,0 +1,84 @@
module.exports = {
/* The local file header */
LOCHDR : 30, // LOC header size
LOCSIG : 0x04034b50, // "PK\003\004"
LOCVER : 4, // version needed to extract
LOCFLG : 6, // general purpose bit flag
LOCHOW : 8, // compression method
LOCTIM : 10, // modification time (2 bytes time, 2 bytes date)
LOCCRC : 14, // uncompressed file crc-32 value
LOCSIZ : 18, // compressed size
LOCLEN : 22, // uncompressed size
LOCNAM : 26, // filename length
LOCEXT : 28, // extra field length
/* The Data descriptor */
EXTSIG : 0x08074b50, // "PK\007\008"
EXTHDR : 16, // EXT header size
EXTCRC : 4, // uncompressed file crc-32 value
EXTSIZ : 8, // compressed size
EXTLEN : 12, // uncompressed size
/* The central directory file header */
CENHDR : 46, // CEN header size
CENSIG : 0x02014b50, // "PK\001\002"
CENVEM : 4, // version made by
CENVER : 6, // version needed to extract
CENFLG : 8, // encrypt, decrypt flags
CENHOW : 10, // compression method
CENTIM : 12, // modification time (2 bytes time, 2 bytes date)
CENCRC : 16, // uncompressed file crc-32 value
CENSIZ : 20, // compressed size
CENLEN : 24, // uncompressed size
CENNAM : 28, // filename length
CENEXT : 30, // extra field length
CENCOM : 32, // file comment length
CENDSK : 34, // volume number start
CENATT : 36, // internal file attributes
CENATX : 38, // external file attributes (host system dependent)
CENOFF : 42, // LOC header offset
/* The entries in the end of central directory */
ENDHDR : 22, // END header size
ENDSIG : 0x06054b50, // "PK\005\006"
ENDSUB : 8, // number of entries on this disk
ENDTOT : 10, // total number of entries
ENDSIZ : 12, // central directory size in bytes
ENDOFF : 16, // offset of first CEN header
ENDCOM : 20, // zip file comment length
/* Compression methods */
STORED : 0, // no compression
SHRUNK : 1, // shrunk
REDUCED1 : 2, // reduced with compression factor 1
REDUCED2 : 3, // reduced with compression factor 2
REDUCED3 : 4, // reduced with compression factor 3
REDUCED4 : 5, // reduced with compression factor 4
IMPLODED : 6, // imploded
// 7 reserved
DEFLATED : 8, // deflated
ENHANCED_DEFLATED: 9, // enhanced deflated
PKWARE : 10,// PKWare DCL imploded
// 11 reserved
BZIP2 : 12, // compressed using BZIP2
// 13 reserved
LZMA : 14, // LZMA
// 15-17 reserved
IBM_TERSE : 18, // compressed using IBM TERSE
IBM_LZ77 : 19, //IBM LZ77 z
/* General purpose bit flag */
FLG_ENC : 0, // encripted file
FLG_COMP1 : 1, // compression option
FLG_COMP2 : 2, // compression option
FLG_DESC : 4, // data descriptor
FLG_ENH : 8, // enhanced deflation
FLG_STR : 16, // strong encryption
FLG_LNG : 1024, // language encoding
FLG_MSK : 4096, // mask header values
/* Load type */
FILE : 0,
BUFFER : 1,
NONE : 2
};

35
node_modules/adm-zip/util/errors.js generated vendored Normal file
View File

@ -0,0 +1,35 @@
module.exports = {
/* Header error messages */
"INVALID_LOC" : "Invalid LOC header (bad signature)",
"INVALID_CEN" : "Invalid CEN header (bad signature)",
"INVALID_END" : "Invalid END header (bad signature)",
/* ZipEntry error messages*/
"NO_DATA" : "Nothing to decompress",
"BAD_CRC" : "CRC32 checksum failed",
"FILE_IN_THE_WAY" : "There is a file in the way: %s",
"UNKNOWN_METHOD" : "Invalid/unsupported compression method",
/* Inflater error messages */
"AVAIL_DATA" : "inflate::Available inflate data did not terminate",
"INVALID_DISTANCE" : "inflate::Invalid literal/length or distance code in fixed or dynamic block",
"TO_MANY_CODES" : "inflate::Dynamic block code description: too many length or distance codes",
"INVALID_REPEAT_LEN" : "inflate::Dynamic block code description: repeat more than specified lengths",
"INVALID_REPEAT_FIRST" : "inflate::Dynamic block code description: repeat lengths with no first length",
"INCOMPLETE_CODES" : "inflate::Dynamic block code description: code lengths codes incomplete",
"INVALID_DYN_DISTANCE": "inflate::Dynamic block code description: invalid distance code lengths",
"INVALID_CODES_LEN": "inflate::Dynamic block code description: invalid literal/length code lengths",
"INVALID_STORE_BLOCK" : "inflate::Stored block length did not match one's complement",
"INVALID_BLOCK_TYPE" : "inflate::Invalid block type (type == 3)",
/* ADM-ZIP error messages */
"CANT_EXTRACT_FILE" : "Could not extract the file",
"CANT_OVERRIDE" : "Target file already exists",
"NO_ZIP" : "No zip file was loaded",
"NO_ENTRY" : "Entry doesn't exist",
"DIRECTORY_CONTENT_ERROR" : "A directory cannot have content",
"FILE_NOT_FOUND" : "File not found: %s",
"NOT_IMPLEMENTED" : "Not implemented",
"INVALID_FILENAME" : "Invalid filename",
"INVALID_FORMAT" : "Invalid or unsupported zip format. No END header found"
};

84
node_modules/adm-zip/util/fattr.js generated vendored Normal file
View File

@ -0,0 +1,84 @@
var fs = require("fs"),
pth = require("path");
fs.existsSync = fs.existsSync || pth.existsSync;
module.exports = function(/*String*/path) {
var _path = path || "",
_permissions = 0,
_obj = newAttr(),
_stat = null;
function newAttr() {
return {
directory : false,
readonly : false,
hidden : false,
executable : false,
mtime : 0,
atime : 0
}
}
if (_path && fs.existsSync(_path)) {
_stat = fs.statSync(_path);
_obj.directory = _stat.isDirectory();
_obj.mtime = _stat.mtime;
_obj.atime = _stat.atime;
_obj.executable = !!(1 & parseInt ((_stat.mode & parseInt ("777", 8)).toString (8)[0]));
_obj.readonly = !!(2 & parseInt ((_stat.mode & parseInt ("777", 8)).toString (8)[0]));
_obj.hidden = pth.basename(_path)[0] === ".";
} else {
console.warn("Invalid path: " + _path)
}
return {
get directory () {
return _obj.directory;
},
get readOnly () {
return _obj.readonly;
},
get hidden () {
return _obj.hidden;
},
get mtime () {
return _obj.mtime;
},
get atime () {
return _obj.atime;
},
get executable () {
return _obj.executable;
},
decodeAttributes : function(val) {
},
encodeAttributes : function (val) {
},
toString : function() {
return '{\n' +
'\t"path" : "' + _path + ",\n" +
'\t"isDirectory" : ' + _obj.directory + ",\n" +
'\t"isReadOnly" : ' + _obj.readonly + ",\n" +
'\t"isHidden" : ' + _obj.hidden + ",\n" +
'\t"isExecutable" : ' + _obj.executable + ",\n" +
'\t"mTime" : ' + _obj.mtime + "\n" +
'\t"aTime" : ' + _obj.atime + "\n" +
'}';
}
}
};

4
node_modules/adm-zip/util/index.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
module.exports = require("./utils");
module.exports.Constants = require("./constants");
module.exports.Errors = require("./errors");
module.exports.FileAttr = require("./fattr");

145
node_modules/adm-zip/util/utils.js generated vendored Normal file
View File

@ -0,0 +1,145 @@
var fs = require("fs"),
pth = require('path');
fs.existsSync = fs.existsSync || pth.existsSync;
module.exports = (function() {
var crcTable = [],
Constants = require('./constants'),
Errors = require('./errors'),
PATH_SEPARATOR = pth.normalize("/");
function mkdirSync(/*String*/path) {
var resolvedPath = path.split(PATH_SEPARATOR)[0];
path.split(PATH_SEPARATOR).forEach(function(name) {
if (!name || name.substr(-1,1) == ":") return;
resolvedPath += PATH_SEPARATOR + name;
var stat;
try {
stat = fs.statSync(resolvedPath);
} catch (e) {
fs.mkdirSync(resolvedPath);
}
if (stat && stat.isFile())
throw Errors.FILE_IN_THE_WAY.replace("%s", resolvedPath);
});
}
function findSync(/*String*/root, /*RegExp*/pattern, /*Boolean*/recoursive) {
if (typeof pattern === 'boolean') {
recoursive = pattern;
pattern = undefined;
}
var files = [];
fs.readdirSync(root).forEach(function(file) {
var path = pth.join(root, file);
if (fs.statSync(path).isDirectory() && recoursive)
files = files.concat(findSync(path, pattern, recoursive));
if (!pattern || pattern.test(path)) {
files.push(pth.normalize(path) + (fs.statSync(path).isDirectory() ? PATH_SEPARATOR : ""));
}
});
return files;
}
return {
makeDir : function(/*String*/path) {
mkdirSync(path);
},
crc32 : function(buf) {
var b = new Buffer(4);
if (!crcTable.length) {
for (var n = 0; n < 256; n++) {
var c = n;
for (var k = 8; --k >= 0;) //
if ((c & 1) != 0) { c = 0xedb88320 ^ (c >>> 1); } else { c = c >>> 1; }
if (c < 0) {
b.writeInt32LE(c, 0);
c = b.readUInt32LE(0);
}
crcTable[n] = c;
}
}
var crc = 0, off = 0, len = buf.length, c1 = ~crc;
while(--len >= 0) c1 = crcTable[(c1 ^ buf[off++]) & 0xff] ^ (c1 >>> 8);
crc = ~c1;
b.writeInt32LE(crc & 0xffffffff, 0);
return b.readUInt32LE(0);
},
methodToString : function(/*Number*/method) {
switch (method) {
case Constants.STORED:
return 'STORED (' + method + ')';
case Constants.DEFLATED:
return 'DEFLATED (' + method + ')';
default:
return 'UNSUPPORTED (' + method + ')'
}
},
writeFileTo : function(/*String*/path, /*Buffer*/content, /*Boolean*/overwrite, /*Number*/attr) {
if (fs.existsSync(path)) {
if (!overwrite)
return false; // cannot overwite
var stat = fs.statSync(path);
if (stat.isDirectory()) {
return false;
}
}
var folder = pth.dirname(path);
if (!fs.existsSync(folder)) {
mkdirSync(folder);
}
var fd;
try {
fd = fs.openSync(path, 'w', 438); // 0666
} catch(e) {
fs.chmodSync(path, 438);
fd = fs.openSync(path, 'w', 438);
}
if (fd) {
fs.writeSync(fd, content, 0, content.length, 0);
fs.closeSync(fd);
}
fs.chmodSync(path, attr || 438);
return true;
},
findFiles : function(/*String*/path) {
return findSync(path, true);
},
getAttributes : function(/*String*/path) {
},
setAttributes : function(/*String*/path) {
},
toBuffer : function(input) {
if (Buffer.isBuffer(input)) {
return input;
} else {
if (input.length == 0) {
return new Buffer(0)
}
return new Buffer(input, 'utf8');
}
},
Constants : Constants,
Errors : Errors
}
})();

224
node_modules/adm-zip/zipEntry.js generated vendored Normal file
View File

@ -0,0 +1,224 @@
var Utils = require("./util"),
Headers = require("./headers"),
Constants = Utils.Constants,
Methods = require("./methods");
module.exports = function (/*Buffer*/input) {
var _entryHeader = new Headers.EntryHeader(),
_entryName = new Buffer(0),
_comment = new Buffer(0),
_isDirectory = false,
uncompressedData = null,
_extra = new Buffer(0);
function getCompressedDataFromZip() {
if (!input || !Buffer.isBuffer(input)) {
return new Buffer(0);
}
_entryHeader.loadDataHeaderFromBinary(input);
return input.slice(_entryHeader.realDataOffset, _entryHeader.realDataOffset + _entryHeader.compressedSize)
}
function crc32OK(data) {
// if bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the header is written
if (_entryHeader.flags & 0x8 != 0x8) {
if (Utils.crc32(data) != _entryHeader.crc) {
return false;
}
} else {
// @TODO: load and check data descriptor header
// The fields in the local header are filled with zero, and the CRC-32 and size are appended in a 12-byte structure
// (optionally preceded by a 4-byte signature) immediately after the compressed data:
}
return true;
}
function decompress(/*Boolean*/async, /*Function*/callback) {
if (_isDirectory) {
if (async && callback) {
callback(new Buffer(0), Utils.Errors.DIRECTORY_CONTENT_ERROR); //si added error.
}
return new Buffer(0);
}
var compressedData = getCompressedDataFromZip();
if (compressedData.length == 0) {
if (async && callback) callback(compressedData, Utils.Errors.NO_DATA);//si added error.
return compressedData;
}
var data = new Buffer(_entryHeader.size);
data.fill(0);
switch (_entryHeader.method) {
case Utils.Constants.STORED:
compressedData.copy(data);
if (!crc32OK(data)) {
if (async && callback) callback(data, Utils.Errors.BAD_CRC);//si added error
return Utils.Errors.BAD_CRC;
} else {//si added otherwise did not seem to return data.
if (async && callback) callback(data);
return data;
}
break;
case Utils.Constants.DEFLATED:
var inflater = new Methods.Inflater(compressedData);
if (!async) {
inflater.inflate(data);
if (!crc32OK(data)) {
console.warn(Utils.Errors.BAD_CRC + " " + _entryName.toString())
}
return data;
} else {
inflater.inflateAsync(function(result) {
result.copy(data, 0);
if (crc32OK(data)) {
if (callback) callback(data, Utils.Errors.BAD_CRC); //si added error
} else { //si added otherwise did not seem to return data.
if (callback) callback(data);
}
})
}
break;
default:
if (async && callback) callback(new Buffer(0), Utils.Errors.UNKNOWN_METHOD);
return Utils.Errors.UNKNOWN_METHOD;
}
}
function compress(/*Boolean*/async, /*Function*/callback) {
if ((!uncompressedData || !uncompressedData.length) && Buffer.isBuffer(input)) {
// no data set or the data wasn't changed to require recompression
if (async && callback) callback(getCompressedDataFromZip());
return getCompressedDataFromZip();
}
if (uncompressedData.length && !_isDirectory) {
var compressedData;
// Local file header
switch (_entryHeader.method) {
case Utils.Constants.STORED:
_entryHeader.compressedSize = _entryHeader.size;
compressedData = new Buffer(uncompressedData.length);
uncompressedData.copy(compressedData);
if (async && callback) callback(compressedData);
return compressedData;
break;
default:
case Utils.Constants.DEFLATED:
var deflater = new Methods.Deflater(uncompressedData);
if (!async) {
var deflated = deflater.deflate();
_entryHeader.compressedSize = deflated.length;
return deflated;
} else {
deflater.deflateAsync(function(data) {
compressedData = new Buffer(data.length);
_entryHeader.compressedSize = data.length;
data.copy(compressedData);
callback && callback(compressedData);
})
}
deflater = null;
break;
}
} else {
if (async && callback) {
callback(new Buffer(0));
} else {
return new Buffer(0);
}
}
}
return {
get entryName () { return _entryName.toString(); },
get rawEntryName() { return _entryName; },
set entryName (val) {
_entryName = Utils.toBuffer(val);
var lastChar = _entryName[_entryName.length - 1];
_isDirectory = (lastChar == 47) || (lastChar == 92);
_entryHeader.fileNameLength = _entryName.length;
},
get extra () { return _extra; },
set extra (val) {
_extra = val;
_entryHeader.extraLength = val.length;
},
get comment () { return _comment.toString(); },
set comment (val) {
_comment = Utils.toBuffer(val);
_entryHeader.commentLength = _comment.length;
},
get name () { var n = _entryName.toString(); return _isDirectory ? n.substr(n.length - 1).split("/").pop() : n.split("/").pop(); },
get isDirectory () { return _isDirectory },
getCompressedData : function() {
return compress(false, null)
},
getCompressedDataAsync : function(/*Function*/callback) {
compress(true, callback)
},
setData : function(value) {
uncompressedData = Utils.toBuffer(value);
if (!_isDirectory && uncompressedData.length) {
_entryHeader.size = uncompressedData.length;
_entryHeader.method = Utils.Constants.DEFLATED;
_entryHeader.crc = Utils.crc32(value);
} else { // folders and blank files should be stored
_entryHeader.method = Utils.Constants.STORED;
}
},
getData : function() {
return decompress(false, null);
},
getDataAsync : function(/*Function*/callback) {
decompress(true, callback)
},
set header(/*Buffer*/data) {
_entryHeader.loadFromBinary(data);
},
get header() {
return _entryHeader;
},
packHeader : function() {
var header = _entryHeader.entryHeaderToBinary();
// add
_entryName.copy(header, Utils.Constants.CENHDR);
if (_entryHeader.extraLength) {
_extra.copy(header, Utils.Constants.CENHDR + _entryName.length)
}
if (_entryHeader.commentLength) {
_comment.copy(header, Utils.Constants.CENHDR + _entryName.length + _entryHeader.extraLength, _comment.length);
}
return header;
},
toString : function() {
return '{\n' +
'\t"entryName" : "' + _entryName.toString() + "\",\n" +
'\t"name" : "' + _entryName.toString().split("/").pop() + "\",\n" +
'\t"comment" : "' + _comment.toString() + "\",\n" +
'\t"isDirectory" : ' + _isDirectory + ",\n" +
'\t"header" : ' + _entryHeader.toString().replace(/\t/mg, "\t\t") + ",\n" +
'\t"compressedData" : <' + (input && input.length + " bytes buffer" || "null") + ">\n" +
'\t"data" : <' + (uncompressedData && uncompressedData.length + " bytes buffer" || "null") + ">\n" +
'}';
}
}
};

311
node_modules/adm-zip/zipFile.js generated vendored Normal file
View File

@ -0,0 +1,311 @@
var ZipEntry = require("./zipEntry"),
Headers = require("./headers"),
Utils = require("./util");
module.exports = function(/*String|Buffer*/input, /*Number*/inputType) {
var entryList = [],
entryTable = {},
_comment = new Buffer(0),
filename = "",
fs = require("fs"),
inBuffer = null,
mainHeader = new Headers.MainHeader();
if (inputType == Utils.Constants.FILE) {
// is a filename
filename = input;
inBuffer = fs.readFileSync(filename);
readMainHeader();
} else if (inputType == Utils.Constants.BUFFER) {
// is a memory buffer
inBuffer = input;
readMainHeader();
} else {
// none. is a new file
}
function readEntries() {
entryTable = {};
entryList = new Array(mainHeader.diskEntries); // total number of entries
var index = mainHeader.offset; // offset of first CEN header
for(var i = 0; i < entryList.length; i++) {
var tmp = index,
entry = new ZipEntry(inBuffer);
entry.header = inBuffer.slice(tmp, tmp += Utils.Constants.CENHDR);
entry.entryName = inBuffer.slice(tmp, tmp += entry.header.fileNameLength);
if (entry.header.extraLength) {
entry.extra = inBuffer.slice(tmp, tmp += entry.header.extraLength);
}
if (entry.header.commentLength)
entry.comment = inBuffer.slice(tmp, tmp + entry.header.commentLength);
index += entry.header.entryHeaderSize;
entryList[i] = entry;
entryTable[entry.entryName] = entry;
}
}
function readMainHeader() {
var i = inBuffer.length - Utils.Constants.ENDHDR, // END header size
n = Math.max(0, i - 0xFFFF), // 0xFFFF is the max zip file comment length
endOffset = 0; // Start offset of the END header
for (i; i >= n; i--) {
if (inBuffer[i] != 0x50) continue; // quick check that the byte is 'P'
if (inBuffer.readUInt32LE(i) == Utils.Constants.ENDSIG) { // "PK\005\006"
endOffset = i;
break;
}
}
if (!endOffset)
throw Utils.Errors.INVALID_FORMAT;
mainHeader.loadFromBinary(inBuffer.slice(endOffset, endOffset + Utils.Constants.ENDHDR));
if (mainHeader.commentLength) {
_comment = inBuffer.slice(endOffset + Utils.Constants.ENDHDR);
}
readEntries();
}
return {
/**
* Returns an array of ZipEntry objects existent in the current opened archive
* @return Array
*/
get entries () {
return entryList;
},
/**
* Archive comment
* @return {String}
*/
get comment () { return _comment.toString(); },
set comment(val) {
mainHeader.commentLength = val.length;
_comment = val;
},
/**
* Returns a reference to the entry with the given name or null if entry is inexistent
*
* @param entryName
* @return ZipEntry
*/
getEntry : function(/*String*/entryName) {
return entryTable[entryName] || null;
},
/**
* Adds the given entry to the entry list
*
* @param entry
*/
setEntry : function(/*ZipEntry*/entry) {
entryList.push(entry);
entryTable[entry.entryName] = entry;
mainHeader.totalEntries = entryList.length;
},
/**
* Removes the entry with the given name from the entry list.
*
* If the entry is a directory, then all nested files and directories will be removed
* @param entryName
*/
deleteEntry : function(/*String*/entryName) {
var entry = entryTable[entryName];
if (entry && entry.isDirectory) {
var _self = this;
this.getEntryChildren(entry).forEach(function(child) {
if (child.entryName != entryName) {
_self.deleteEntry(child.entryName)
}
})
}
entryList.splice(entryList.indexOf(entry), 1);
delete(entryTable[entryName]);
mainHeader.totalEntries = entryList.length;
},
/**
* Iterates and returns all nested files and directories of the given entry
*
* @param entry
* @return Array
*/
getEntryChildren : function(/*ZipEntry*/entry) {
if (entry.isDirectory) {
var list = [],
name = entry.entryName,
len = name.length;
entryList.forEach(function(zipEntry) {
if (zipEntry.entryName.substr(0, len) == name) {
list.push(zipEntry);
}
});
return list;
}
return []
},
/**
* Returns the zip file
*
* @return Buffer
*/
compressToBuffer : function() {
if (entryList.length > 1) {
entryList.sort(function(a, b) {
var nameA = a.entryName.toLowerCase();
var nameB = b.entryName.toLowerCase();
if (nameA < nameB) {return -1}
if (nameA > nameB) {return 1}
return 0;
});
}
var totalSize = 0,
dataBlock = [],
entryHeaders = [],
dindex = 0;
mainHeader.size = 0;
mainHeader.offset = 0;
entryList.forEach(function(entry) {
entry.header.offset = dindex;
// compress data and set local and entry header accordingly. Reason why is called first
var compressedData = entry.getCompressedData();
// data header
var dataHeader = entry.header.dataHeaderToBinary();
var postHeader = new Buffer(entry.entryName + entry.extra.toString());
var dataLength = dataHeader.length + postHeader.length + compressedData.length;
dindex += dataLength;
dataBlock.push(dataHeader);
dataBlock.push(postHeader);
dataBlock.push(compressedData);
var entryHeader = entry.packHeader();
entryHeaders.push(entryHeader);
mainHeader.size += entryHeader.length;
totalSize += (dataLength + entryHeader.length);
});
totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length
// point to end of data and begining of central directory first record
mainHeader.offset = dindex;
dindex = 0;
var outBuffer = new Buffer(totalSize);
dataBlock.forEach(function(content) {
content.copy(outBuffer, dindex); // write data blocks
dindex += content.length;
});
entryHeaders.forEach(function(content) {
content.copy(outBuffer, dindex); // write central directory entries
dindex += content.length;
});
var mh = mainHeader.toBinary();
if (_comment) {
_comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment
}
mh.copy(outBuffer, dindex); // write main header
return outBuffer
},
toAsyncBuffer : function(/*Function*/onSuccess,/*Function*/onFail,/*Function*/onItemStart,/*Function*/onItemEnd) {
if (entryList.length > 1) {
entryList.sort(function(a, b) {
var nameA = a.entryName.toLowerCase();
var nameB = b.entryName.toLowerCase();
if (nameA > nameB) {return -1}
if (nameA < nameB) {return 1}
return 0;
});
}
var totalSize = 0,
dataBlock = [],
entryHeaders = [],
dindex = 0;
mainHeader.size = 0;
mainHeader.offset = 0;
var compress=function(entryList){
var self=arguments.callee;
var entry;
if(entryList.length){
var entry=entryList.pop();
var name=entry.entryName + entry.extra.toString();
if(onItemStart)onItemStart(name);
entry.getCompressedDataAsync(function(compressedData){
if(onItemEnd)onItemEnd(name);
entry.header.offset = dindex;
// data header
var dataHeader = entry.header.dataHeaderToBinary();
var postHeader = new Buffer(name);
var dataLength = dataHeader.length + postHeader.length + compressedData.length;
dindex += dataLength;
dataBlock.push(dataHeader);
dataBlock.push(postHeader);
dataBlock.push(compressedData);
var entryHeader = entry.packHeader();
entryHeaders.push(entryHeader);
mainHeader.size += entryHeader.length;
totalSize += (dataLength + entryHeader.length);
if(entryList.length){
self(entryList);
}else{
totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length
// point to end of data and begining of central directory first record
mainHeader.offset = dindex;
dindex = 0;
var outBuffer = new Buffer(totalSize);
dataBlock.forEach(function(content) {
content.copy(outBuffer, dindex); // write data blocks
dindex += content.length;
});
entryHeaders.forEach(function(content) {
content.copy(outBuffer, dindex); // write central directory entries
dindex += content.length;
});
var mh = mainHeader.toBinary();
if (_comment) {
_comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment
}
mh.copy(outBuffer, dindex); // write main header
onSuccess(outBuffer);
}
});
}
};
compress(entryList);
}
}
};

97
node_modules/ansi-regex/package.json generated vendored
View File

@ -1,73 +1,28 @@
{
"_args": [
[
{
"raw": "ansi-regex@^2.0.0",
"scope": null,
"escapedName": "ansi-regex",
"name": "ansi-regex",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"/home/dold/repos/taler/wallet-webex/node_modules/has-ansi"
]
],
"_from": "ansi-regex@>=2.0.0 <3.0.0",
"_id": "ansi-regex@2.0.0",
"_inCache": true,
"_location": "/ansi-regex",
"_nodeVersion": "0.12.5",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "2.11.2",
"_phantomChildren": {},
"_requested": {
"raw": "ansi-regex@^2.0.0",
"scope": null,
"escapedName": "ansi-regex",
"name": "ansi-regex",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/has-ansi",
"/strip-ansi"
],
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz",
"_shasum": "c5061b6e0ef8a81775e50f5d66151bf6bf371107",
"_shrinkwrap": null,
"_spec": "ansi-regex@^2.0.0",
"_where": "/home/dold/repos/taler/wallet-webex/node_modules/has-ansi",
"name": "ansi-regex",
"version": "2.0.0",
"description": "Regular expression for matching ANSI escape codes",
"license": "MIT",
"repository": "sindresorhus/ansi-regex",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/ansi-regex/issues"
},
"dependencies": {},
"description": "Regular expression for matching ANSI escape codes",
"devDependencies": {
"mocha": "*"
},
"directories": {},
"dist": {
"shasum": "c5061b6e0ef8a81775e50f5d66151bf6bf371107",
"tarball": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz"
},
"maintainers": [
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
"Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)"
],
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha test/test.js",
"view-supported": "node test/viewCodes.js"
},
"files": [
"index.js"
],
"gitHead": "57c3f2941a73079fa8b081e02a522e3d29913e2f",
"homepage": "https://github.com/sindresorhus/ansi-regex",
"keywords": [
"ansi",
"styles",
@ -95,27 +50,7 @@
"find",
"pattern"
],
"license": "MIT",
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
{
"name": "jbnicolai",
"email": "jappelman@xebia.com"
}
],
"name": "ansi-regex",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/ansi-regex.git"
},
"scripts": {
"test": "mocha test/test.js",
"view-supported": "node test/viewCodes.js"
},
"version": "2.0.0"
"devDependencies": {
"mocha": "*"
}
}

View File

@ -1,76 +1,27 @@
{
"_args": [
[
{
"raw": "ansi-styles@^2.2.1",
"scope": null,
"escapedName": "ansi-styles",
"name": "ansi-styles",
"rawSpec": "^2.2.1",
"spec": ">=2.2.1 <3.0.0",
"type": "range"
},
"/home/dold/repos/taler/wallet-webex/node_modules/chalk"
]
],
"_from": "ansi-styles@>=2.2.1 <3.0.0",
"_id": "ansi-styles@2.2.1",
"_inCache": true,
"_location": "/ansi-styles",
"_nodeVersion": "4.3.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/ansi-styles-2.2.1.tgz_1459197317833_0.9694824463222176"
},
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "3.8.3",
"_phantomChildren": {},
"_requested": {
"raw": "ansi-styles@^2.2.1",
"scope": null,
"escapedName": "ansi-styles",
"name": "ansi-styles",
"rawSpec": "^2.2.1",
"spec": ">=2.2.1 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/chalk"
],
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"_shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe",
"_shrinkwrap": null,
"_spec": "ansi-styles@^2.2.1",
"_where": "/home/dold/repos/taler/wallet-webex/node_modules/chalk",
"name": "ansi-styles",
"version": "2.2.1",
"description": "ANSI escape codes for styling strings in the terminal",
"license": "MIT",
"repository": "chalk/ansi-styles",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/chalk/ansi-styles/issues"
},
"dependencies": {},
"description": "ANSI escape codes for styling strings in the terminal",
"devDependencies": {
"mocha": "*"
},
"directories": {},
"dist": {
"shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe",
"tarball": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz"
},
"maintainers": [
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
"Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)"
],
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"files": [
"index.js"
],
"gitHead": "95c59b23be760108b6530ca1c89477c21b258032",
"homepage": "https://github.com/chalk/ansi-styles#readme",
"keywords": [
"ansi",
"styles",
@ -93,22 +44,7 @@
"command-line",
"text"
],
"license": "MIT",
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "ansi-styles",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/ansi-styles.git"
},
"scripts": {
"test": "mocha"
},
"version": "2.2.1"
"devDependencies": {
"mocha": "*"
}
}

View File

@ -1,104 +0,0 @@
{
"_args": [
[
{
"raw": "isarray@~1.0.0",
"scope": null,
"escapedName": "isarray",
"name": "isarray",
"rawSpec": "~1.0.0",
"spec": ">=1.0.0 <1.1.0",
"type": "range"
},
"/home/dold/repos/taler/wallet-webex/node_modules/archiver-utils/node_modules/readable-stream"
]
],
"_from": "isarray@>=1.0.0 <1.1.0",
"_id": "isarray@1.0.0",
"_inCache": true,
"_location": "/archiver-utils/isarray",
"_nodeVersion": "5.1.0",
"_npmUser": {
"name": "juliangruber",
"email": "julian@juliangruber.com"
},
"_npmVersion": "3.3.12",
"_phantomChildren": {},
"_requested": {
"raw": "isarray@~1.0.0",
"scope": null,
"escapedName": "isarray",
"name": "isarray",
"rawSpec": "~1.0.0",
"spec": ">=1.0.0 <1.1.0",
"type": "range"
},
"_requiredBy": [
"/archiver-utils/readable-stream"
],
"_resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"_shasum": "bb935d48582cba168c06834957a54a3e07124f11",
"_shrinkwrap": null,
"_spec": "isarray@~1.0.0",
"_where": "/home/dold/repos/taler/wallet-webex/node_modules/archiver-utils/node_modules/readable-stream",
"author": {
"name": "Julian Gruber",
"email": "mail@juliangruber.com",
"url": "http://juliangruber.com"
},
"bugs": {
"url": "https://github.com/juliangruber/isarray/issues"
},
"dependencies": {},
"description": "Array#isArray for older browsers",
"devDependencies": {
"tape": "~2.13.4"
},
"directories": {},
"dist": {
"shasum": "bb935d48582cba168c06834957a54a3e07124f11",
"tarball": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"
},
"gitHead": "2a23a281f369e9ae06394c0fb4d2381355a6ba33",
"homepage": "https://github.com/juliangruber/isarray",
"keywords": [
"browser",
"isarray",
"array"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "juliangruber",
"email": "julian@juliangruber.com"
}
],
"name": "isarray",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/juliangruber/isarray.git"
},
"scripts": {
"test": "tape test.js"
},
"testling": {
"files": "test.js",
"browsers": [
"ie/8..latest",
"firefox/17..latest",
"firefox/nightly",
"chrome/22..latest",
"chrome/canary",
"opera/12..latest",
"opera/next",
"safari/5.1..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2..latest"
]
},
"version": "1.0.0"
}

View File

@ -1,47 +0,0 @@
Copyright jQuery Foundation and other contributors <https://jquery.org/>
Based on Underscore.js, copyright Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/lodash/lodash
The following license applies to all parts of this software except as
documented below:
====
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====
Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code displayed within the prose of the
documentation.
CC0: http://creativecommons.org/publicdomain/zero/1.0/
====
Files located in the node_modules and vendor directories are externally
maintained libraries used by this software which have their own
licenses; we recommend you read them, as their terms may differ from the
terms above.

View File

@ -1,39 +0,0 @@
# lodash v4.16.4
The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules.
## Installation
Using npm:
```shell
$ npm i -g npm
$ npm i --save lodash
```
In Node.js:
```js
// Load the full build.
var _ = require('lodash');
// Load the core build.
var _ = require('lodash/core');
// Load the FP build for immutable auto-curried iteratee-first data-last methods.
var fp = require('lodash/fp');
// Load method categories.
var array = require('lodash/array');
var object = require('lodash/fp/object');
// Cherry-pick methods for smaller browserify/rollup/webpack bundles.
var at = require('lodash/at');
var curryN = require('lodash/fp/curryN');
```
See the [package source](https://github.com/lodash/lodash/tree/4.16.4-npm) for more details.
**Note:**<br>
Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL.
## Support
Tested in Chrome 52-53, Firefox 48-49, IE 11, Edge 14, Safari 9-10, Node.js 4-6, & PhantomJS 2.1.1.<br>
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available.

View File

@ -1,32 +0,0 @@
var hashClear = require('./_hashClear'),
hashDelete = require('./_hashDelete'),
hashGet = require('./_hashGet'),
hashHas = require('./_hashHas'),
hashSet = require('./_hashSet');
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
module.exports = Hash;

View File

@ -1,32 +0,0 @@
var listCacheClear = require('./_listCacheClear'),
listCacheDelete = require('./_listCacheDelete'),
listCacheGet = require('./_listCacheGet'),
listCacheHas = require('./_listCacheHas'),
listCacheSet = require('./_listCacheSet');
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
module.exports = ListCache;

View File

@ -1,32 +0,0 @@
var mapCacheClear = require('./_mapCacheClear'),
mapCacheDelete = require('./_mapCacheDelete'),
mapCacheGet = require('./_mapCacheGet'),
mapCacheHas = require('./_mapCacheHas'),
mapCacheSet = require('./_mapCacheSet');
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
module.exports = MapCache;

View File

@ -1,27 +0,0 @@
var MapCache = require('./_MapCache'),
setCacheAdd = require('./_setCacheAdd'),
setCacheHas = require('./_setCacheHas');
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values ? values.length : 0;
this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
module.exports = SetCache;

View File

@ -1,22 +0,0 @@
/**
* A specialized version of `baseAggregator` for arrays.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function arrayAggregator(array, setter, iteratee, accumulator) {
var index = -1,
length = array ? array.length : 0;
while (++index < length) {
var value = array[index];
setter(accumulator, value, iteratee(value), array);
}
return accumulator;
}
module.exports = arrayAggregator;

View File

@ -1,22 +0,0 @@
/**
* A specialized version of `_.forEach` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array ? array.length : 0;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
module.exports = arrayEach;

View File

@ -1,21 +0,0 @@
/**
* A specialized version of `_.forEachRight` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEachRight(array, iteratee) {
var length = array ? array.length : 0;
while (length--) {
if (iteratee(array[length], length, array) === false) {
break;
}
}
return array;
}
module.exports = arrayEachRight;

View File

@ -1,23 +0,0 @@
/**
* A specialized version of `_.every` for arrays without support for
* iteratee shorthands.
*
* @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 ? array.length : 0;
while (++index < length) {
if (!predicate(array[index], index, array)) {
return false;
}
}
return true;
}
module.exports = arrayEvery;

View File

@ -1,25 +0,0 @@
/**
* A specialized version of `_.filter` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array ? array.length : 0,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
module.exports = arrayFilter;

View File

@ -1,17 +0,0 @@
var baseIndexOf = require('./_baseIndexOf');
/**
* A specialized version of `_.includes` for arrays without support for
* specifying an index to search from.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludes(array, value) {
var length = array ? array.length : 0;
return !!length && baseIndexOf(array, value, 0) > -1;
}
module.exports = arrayIncludes;

View File

@ -1,22 +0,0 @@
/**
* This function is like `arrayIncludes` except that it accepts a comparator.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @param {Function} comparator The comparator invoked per element.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludesWith(array, value, comparator) {
var index = -1,
length = array ? array.length : 0;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
module.exports = arrayIncludesWith;

View File

@ -1,21 +0,0 @@
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array ? array.length : 0,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
module.exports = arrayMap;

View File

@ -1,26 +0,0 @@
/**
* A specialized version of `_.reduce` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @param {boolean} [initAccum] Specify using the first element of `array` as
* the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1,
length = array ? array.length : 0;
if (initAccum && length) {
accumulator = array[++index];
}
while (++index < length) {
accumulator = iteratee(accumulator, array[index], index, array);
}
return accumulator;
}
module.exports = arrayReduce;

View File

@ -1,24 +0,0 @@
/**
* A specialized version of `_.reduceRight` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @param {boolean} [initAccum] Specify using the last element of `array` as
* the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
var length = array ? array.length : 0;
if (initAccum && length) {
accumulator = array[--length];
}
while (length--) {
accumulator = iteratee(accumulator, array[length], length, array);
}
return accumulator;
}
module.exports = arrayReduceRight;

View File

@ -1,23 +0,0 @@
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @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 ? array.length : 0;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
module.exports = arraySome;

View File

@ -1,23 +0,0 @@
var get = require('./get');
/**
* The base implementation of `_.at` without support for individual paths.
*
* @private
* @param {Object} object The object to iterate over.
* @param {string[]} paths The property paths of elements to pick.
* @returns {Array} Returns the picked elements.
*/
function baseAt(object, paths) {
var index = -1,
isNil = object == null,
length = paths.length,
result = Array(length);
while (++index < length) {
result[index] = isNil ? undefined : get(object, paths[index]);
}
return result;
}
module.exports = baseAt;

View File

@ -1,67 +0,0 @@
var SetCache = require('./_SetCache'),
arrayIncludes = require('./_arrayIncludes'),
arrayIncludesWith = require('./_arrayIncludesWith'),
arrayMap = require('./_arrayMap'),
baseUnary = require('./_baseUnary'),
cacheHas = require('./_cacheHas');
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* The base implementation of methods like `_.difference` without support
* for excluding multiple arrays or iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Array} values The values to exclude.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of filtered values.
*/
function baseDifference(array, values, iteratee, comparator) {
var index = -1,
includes = arrayIncludes,
isCommon = true,
length = array.length,
result = [],
valuesLength = values.length;
if (!length) {
return result;
}
if (iteratee) {
values = arrayMap(values, baseUnary(iteratee));
}
if (comparator) {
includes = arrayIncludesWith;
isCommon = false;
}
else if (values.length >= LARGE_ARRAY_SIZE) {
includes = cacheHas;
isCommon = false;
values = new SetCache(values);
}
outer:
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var valuesIndex = valuesLength;
while (valuesIndex--) {
if (values[valuesIndex] === computed) {
continue outer;
}
}
result.push(value);
}
else if (!includes(values, computed, comparator)) {
result.push(value);
}
}
return result;
}
module.exports = baseDifference;

View File

@ -1,22 +0,0 @@
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* The base implementation of `getTag`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
return objectToString.call(value);
}
module.exports = baseGetTag;

View File

@ -1,27 +0,0 @@
var isObjectLike = require('./isObjectLike');
/** `Object#toString` result references. */
var argsTag = '[object Arguments]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* The base implementation of `_.isArguments`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
return isObjectLike(value) && objectToString.call(value) == argsTag;
}
module.exports = baseIsArguments;

View File

@ -1,26 +0,0 @@
var isObjectLike = require('./isObjectLike');
var arrayBufferTag = '[object ArrayBuffer]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* The base implementation of `_.isArrayBuffer` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
*/
function baseIsArrayBuffer(value) {
return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;
}
module.exports = baseIsArrayBuffer;

View File

@ -1,27 +0,0 @@
var isObjectLike = require('./isObjectLike');
/** `Object#toString` result references. */
var dateTag = '[object Date]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* The base implementation of `_.isDate` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
*/
function baseIsDate(value) {
return isObjectLike(value) && objectToString.call(value) == dateTag;
}
module.exports = baseIsDate;

View File

@ -1,27 +0,0 @@
var isObject = require('./isObject');
/** `Object#toString` result references. */
var regexpTag = '[object RegExp]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* The base implementation of `_.isRegExp` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
*/
function baseIsRegExp(value) {
return isObject(value) && objectToString.call(value) == regexpTag;
}
module.exports = baseIsRegExp;

View File

@ -1,69 +0,0 @@
var isLength = require('./isLength'),
isObjectLike = require('./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]',
dataViewTag = '[object DataView]',
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[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike(value) &&
isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
}
module.exports = baseIsTypedArray;

View File

@ -1,20 +0,0 @@
var baseSum = require('./_baseSum');
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
/**
* The base implementation of `_.mean` and `_.meanBy` without support for
* iteratee shorthands.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {number} Returns the mean.
*/
function baseMean(array, iteratee) {
var length = array ? array.length : 0;
return length ? (baseSum(array, iteratee) / length) : NAN;
}
module.exports = baseMean;

View File

@ -1,42 +0,0 @@
var baseSortedIndexBy = require('./_baseSortedIndexBy'),
identity = require('./identity'),
isSymbol = require('./isSymbol');
/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295,
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
/**
* The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
* performs a binary search of `array` to determine the index at which `value`
* should be inserted into `array` in order to maintain its sort order.
*
* @private
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
* @param {boolean} [retHighest] Specify returning the highest qualified index.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
*/
function baseSortedIndex(array, value, retHighest) {
var low = 0,
high = array ? array.length : low;
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
while (low < high) {
var mid = (low + high) >>> 1,
computed = array[mid];
if (computed !== null && !isSymbol(computed) &&
(retHighest ? (computed <= value) : (computed < value))) {
low = mid + 1;
} else {
high = mid;
}
}
return high;
}
return baseSortedIndexBy(array, value, identity, retHighest);
}
module.exports = baseSortedIndex;

View File

@ -1,64 +0,0 @@
var isSymbol = require('./isSymbol');
/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295,
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeFloor = Math.floor,
nativeMin = Math.min;
/**
* The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
* which invokes `iteratee` for `value` and each element of `array` to compute
* their sort ranking. The iteratee is invoked with one argument; (value).
*
* @private
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
* @param {Function} iteratee The iteratee invoked per element.
* @param {boolean} [retHighest] Specify returning the highest qualified index.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
*/
function baseSortedIndexBy(array, value, iteratee, retHighest) {
value = iteratee(value);
var low = 0,
high = array ? array.length : 0,
valIsNaN = value !== value,
valIsNull = value === null,
valIsSymbol = isSymbol(value),
valIsUndefined = value === undefined;
while (low < high) {
var mid = nativeFloor((low + high) / 2),
computed = iteratee(array[mid]),
othIsDefined = computed !== undefined,
othIsNull = computed === null,
othIsReflexive = computed === computed,
othIsSymbol = isSymbol(computed);
if (valIsNaN) {
var setLow = retHighest || othIsReflexive;
} else if (valIsUndefined) {
setLow = othIsReflexive && (retHighest || othIsDefined);
} else if (valIsNull) {
setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
} else if (valIsSymbol) {
setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
} else if (othIsNull || othIsSymbol) {
setLow = false;
} else {
setLow = retHighest ? (computed <= value) : (computed < value);
}
if (setLow) {
low = mid + 1;
} else {
high = mid;
}
}
return nativeMin(high, MAX_ARRAY_INDEX);
}
module.exports = baseSortedIndexBy;

View File

@ -1,30 +0,0 @@
var arrayPush = require('./_arrayPush'),
baseDifference = require('./_baseDifference'),
baseUniq = require('./_baseUniq');
/**
* The base implementation of methods like `_.xor`, without support for
* iteratee shorthands, that accepts an array of arrays to inspect.
*
* @private
* @param {Array} arrays The arrays to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of values.
*/
function baseXor(arrays, iteratee, comparator) {
var index = -1,
length = arrays.length;
while (++index < length) {
var result = result
? arrayPush(
baseDifference(result, arrays[index], iteratee, comparator),
baseDifference(arrays[index], result, iteratee, comparator)
)
: arrays[index];
}
return (result && result.length) ? baseUniq(result, iteratee, comparator) : [];
}
module.exports = baseXor;

View File

@ -1,68 +0,0 @@
var DataView = require('./_DataView'),
Map = require('./_Map'),
Promise = require('./_Promise'),
Set = require('./_Set'),
WeakMap = require('./_WeakMap'),
baseGetTag = require('./_baseGetTag'),
toSource = require('./_toSource');
/** `Object#toString` result references. */
var mapTag = '[object Map]',
objectTag = '[object Object]',
promiseTag = '[object Promise]',
setTag = '[object Set]',
weakMapTag = '[object WeakMap]';
var dataViewTag = '[object DataView]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Map && getTag(new Map) != mapTag) ||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : undefined;
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;
};
}
module.exports = getTag;

View File

@ -1,40 +0,0 @@
var castPath = require('./_castPath'),
isArguments = require('./isArguments'),
isArray = require('./isArray'),
isIndex = require('./_isIndex'),
isKey = require('./_isKey'),
isLength = require('./isLength'),
toKey = require('./_toKey');
/**
* Checks if `path` exists on `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @param {Function} hasFunc The function to check properties.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
*/
function hasPath(object, path, hasFunc) {
path = isKey(path, object) ? [path] : castPath(path);
var index = -1,
length = path.length,
result = false;
while (++index < length) {
var key = toKey(path[index]);
if (!(result = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result || ++index != length) {
return result;
}
length = object ? object.length : 0;
return !!length && isLength(length) && isIndex(key, length) &&
(isArray(object) || isArguments(object));
}
module.exports = hasPath;

View File

@ -1,37 +0,0 @@
/** Used to detect hot functions by number of calls within a span of milliseconds. */
var HOT_COUNT = 500,
HOT_SPAN = 16;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeNow = Date.now;
/**
* Creates a function that'll short out and invoke `identity` instead
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
* milliseconds.
*
* @private
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new shortable function.
*/
function shortOut(func) {
var count = 0,
lastCalled = 0;
return function() {
var stamp = nativeNow(),
remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count >= HOT_COUNT) {
return arguments[0];
}
} else {
count = 0;
}
return func.apply(undefined, arguments);
};
}
module.exports = shortOut;

View File

@ -1,26 +0,0 @@
/** Used for built-in method references. */
var funcProto = Function.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to process.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
module.exports = toSource;

View File

@ -1,63 +0,0 @@
/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
rsComboSymbolsRange = '\\u20d0-\\u20f0',
rsDingbatRange = '\\u2700-\\u27bf',
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
rsPunctuationRange = '\\u2000-\\u206f',
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
rsVarRange = '\\ufe0e\\ufe0f',
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
/** Used to compose unicode capture groups. */
var rsApos = "['\u2019]",
rsBreak = '[' + rsBreakRange + ']',
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
rsDigits = '\\d+',
rsDingbat = '[' + rsDingbatRange + ']',
rsLower = '[' + rsLowerRange + ']',
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
rsFitz = '\\ud83c[\\udffb-\\udfff]',
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
rsNonAstral = '[^' + rsAstralRange + ']',
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
rsUpper = '[' + rsUpperRange + ']',
rsZWJ = '\\u200d';
/** Used to compose unicode regexes. */
var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
reOptMod = rsModifier + '?',
rsOptVar = '[' + rsVarRange + ']?',
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
rsSeq = rsOptVar + reOptMod + rsOptJoin,
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
/** Used to match complex or compound words. */
var reUnicodeWord = RegExp([
rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
rsUpper + '+' + rsOptUpperContr,
rsDigits,
rsEmoji
].join('|'), 'g');
/**
* Splits a Unicode `string` into an array of its words.
*
* @private
* @param {string} The string to inspect.
* @returns {Array} Returns the words of `string`.
*/
function unicodeWords(string) {
return string.match(reUnicodeWord) || [];
}
module.exports = unicodeWords;

View File

@ -1,50 +0,0 @@
var baseSlice = require('./_baseSlice'),
isIterateeCall = require('./_isIterateeCall'),
toInteger = require('./toInteger');
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil,
nativeMax = Math.max;
/**
* Creates an array of elements split into groups the length of `size`.
* If `array` can't be split evenly, the final chunk will be the remaining
* elements.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to process.
* @param {number} [size=1] The length of each chunk
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the new array of chunks.
* @example
*
* _.chunk(['a', 'b', 'c', 'd'], 2);
* // => [['a', 'b'], ['c', 'd']]
*
* _.chunk(['a', 'b', 'c', 'd'], 3);
* // => [['a', 'b', 'c'], ['d']]
*/
function chunk(array, size, guard) {
if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
size = 1;
} else {
size = nativeMax(toInteger(size), 0);
}
var length = array ? array.length : 0;
if (!length || size < 1) {
return [];
}
var index = 0,
resIndex = 0,
result = Array(nativeCeil(length / size));
while (index < length) {
result[resIndex++] = baseSlice(array, index, (index += size));
}
return result;
}
module.exports = chunk;

View File

@ -1,35 +0,0 @@
var baseClone = require('./_baseClone');
/**
* This method is like `_.cloneWith` except that it recursively clones `value`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to recursively clone.
* @param {Function} [customizer] The function to customize cloning.
* @returns {*} Returns the deep cloned value.
* @see _.cloneWith
* @example
*
* function customizer(value) {
* if (_.isElement(value)) {
* return value.cloneNode(true);
* }
* }
*
* var el = _.cloneDeepWith(document.body, customizer);
*
* console.log(el === document.body);
* // => false
* console.log(el.nodeName);
* // => 'BODY'
* console.log(el.childNodes.length);
* // => 20
*/
function cloneDeepWith(value, customizer) {
return baseClone(value, true, true, customizer);
}
module.exports = cloneDeepWith;

View File

@ -1,38 +0,0 @@
var baseClone = require('./_baseClone');
/**
* This method is like `_.clone` except that it accepts `customizer` which
* is invoked to produce the cloned value. If `customizer` returns `undefined`,
* cloning is handled by the method instead. The `customizer` is invoked with
* up to four arguments; (value [, index|key, object, stack]).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to clone.
* @param {Function} [customizer] The function to customize cloning.
* @returns {*} Returns the cloned value.
* @see _.cloneDeepWith
* @example
*
* function customizer(value) {
* if (_.isElement(value)) {
* return value.cloneNode(false);
* }
* }
*
* var el = _.cloneWith(document.body, customizer);
*
* console.log(el === document.body);
* // => false
* console.log(el.nodeName);
* // => 'BODY'
* console.log(el.childNodes.length);
* // => 0
*/
function cloneWith(value, customizer) {
return baseClone(value, false, true, customizer);
}
module.exports = cloneWith;

View File

@ -1,31 +0,0 @@
/**
* Creates an array with all falsey values removed. The values `false`, `null`,
* `0`, `""`, `undefined`, and `NaN` are falsey.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to compact.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* _.compact([0, 1, false, 2, '', 3]);
* // => [1, 2, 3]
*/
function compact(array) {
var index = -1,
length = array ? array.length : 0,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (value) {
result[resIndex++] = value;
}
}
return result;
}
module.exports = compact;

View File

@ -1,60 +0,0 @@
var apply = require('./_apply'),
arrayMap = require('./_arrayMap'),
baseIteratee = require('./_baseIteratee'),
baseRest = require('./_baseRest');
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/**
* Creates a function that iterates over `pairs` and invokes the corresponding
* function of the first predicate to return truthy. The predicate-function
* pairs are invoked with the `this` binding and arguments of the created
* function.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Util
* @param {Array} pairs The predicate-function pairs.
* @returns {Function} Returns the new composite function.
* @example
*
* var func = _.cond([
* [_.matches({ 'a': 1 }), _.constant('matches A')],
* [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
* [_.stubTrue, _.constant('no match')]
* ]);
*
* func({ 'a': 1, 'b': 2 });
* // => 'matches A'
*
* func({ 'a': 0, 'b': 1 });
* // => 'matches B'
*
* func({ 'a': '1', 'b': '2' });
* // => 'no match'
*/
function cond(pairs) {
var length = pairs ? pairs.length : 0,
toIteratee = baseIteratee;
pairs = !length ? [] : arrayMap(pairs, function(pair) {
if (typeof pair[1] != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return [toIteratee(pair[0]), pair[1]];
});
return baseRest(function(args) {
var index = -1;
while (++index < length) {
var pair = pairs[index];
if (apply(pair[0], this, args)) {
return apply(pair[1], this, args);
}
}
});
}
module.exports = cond;

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
/**
* @license
* lodash (Custom Build) /license | Underscore.js 1.8.3 underscorejs.org/LICENSE
* Build: `lodash core -o ./dist/lodash.core.js`
*/
;(function(){function n(n){return K(n)&&pn.call(n,"callee")&&!bn.call(n,"callee")}function t(n,t){return n.push.apply(n,t),n}function r(n){return function(t){return null==t?nn:t[n]}}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return d(t,function(t){return n[t]})}function o(n){return n instanceof i?n:new i(n)}function i(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function c(n,t,r,e){return n===nn||M(n,ln[r])&&!pn.call(e,r)?t:n}function f(n,t,r){
if(typeof n!="function")throw new TypeError("Expected a function");return setTimeout(function(){n.apply(nn,r)},t)}function a(n,t){var r=true;return mn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function l(n,t,r){for(var e=-1,u=n.length;++e<u;){var o=n[e],i=t(o);if(null!=i&&(c===nn?i===i:r(i,c)))var c=i,f=o}return f}function p(n,t){var r=[];return mn(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function s(n,r,e,u,o){var i=-1,c=n.length;for(e||(e=D),o||(o=[]);++i<c;){var f=n[i];0<r&&e(f)?1<r?s(f,r-1,e,u,o):t(o,f):u||(o[o.length]=f);
}return o}function h(n,t){return n&&On(n,t,qn)}function v(n,t){return p(t,function(t){return V(n[t])})}function y(n,t){return n>t}function b(n,t,r,e,u){return n===t||(null==n||null==t||!H(n)&&!K(t)?n!==n&&t!==t:g(n,t,b,r,e,u))}function g(n,t,r,e,u,o){var i=Sn(n),c=Sn(t),f="[object Array]",a="[object Array]";i||(f=hn.call(n),f="[object Arguments]"==f?"[object Object]":f),c||(a=hn.call(t),a="[object Arguments]"==a?"[object Object]":a);var l="[object Object]"==f,c="[object Object]"==a,a=f==a;o||(o=[]);
var p=En(o,function(t){return t[0]==n}),s=En(o,function(n){return n[0]==t});if(p&&s)return p[1]==t;if(o.push([n,t]),o.push([t,n]),a&&!l){if(i)r=B(n,t,r,e,u,o);else n:{switch(f){case"[object Boolean]":case"[object Date]":case"[object Number]":r=M(+n,+t);break n;case"[object Error]":r=n.name==t.name&&n.message==t.message;break n;case"[object RegExp]":case"[object String]":r=n==t+"";break n}r=false}return o.pop(),r}return 2&u||(i=l&&pn.call(n,"__wrapped__"),f=c&&pn.call(t,"__wrapped__"),!i&&!f)?!!a&&(r=R(n,t,r,e,u,o),
o.pop(),r):(i=i?n.value():n,f=f?t.value():t,r=r(i,f,e,u,o),o.pop(),r)}function _(n){return typeof n=="function"?n:null==n?Y:(typeof n=="object"?m:r)(n)}function j(n,t){return n<t}function d(n,t){var r=-1,e=U(n)?Array(n.length):[];return mn(n,function(n,u,o){e[++r]=t(n,u,o)}),e}function m(n){var t=_n(n);return function(r){var e=t.length;if(null==r)return!e;for(r=Object(r);e--;){var u=t[e];if(!(u in r&&b(n[u],r[u],nn,3)))return false}return true}}function O(n,t){return n=Object(n),G(t,function(t,r){return r in n&&(t[r]=n[r]),
t},{})}function x(n){return xn(q(n,void 0,Y),n+"")}function A(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e<u;)r[e]=n[e+t];return r}function E(n){return A(n,0,n.length)}function w(n,t){var r;return mn(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function k(n,r){return G(r,function(n,r){return r.func.apply(r.thisArg,t([n],r.args))},n)}function N(n,t,r,e){var u=!r;r||(r={});for(var o=-1,i=t.length;++o<i;){var c=t[o],f=e?e(r[c],n[c],c,r,n):nn;
if(f===nn&&(f=n[c]),u)r[c]=f;else{var a=r,l=a[c];pn.call(a,c)&&M(l,f)&&(f!==nn||c in a)||(a[c]=f)}}return r}function S(n){return x(function(t,r){var e=-1,u=r.length,o=1<u?r[u-1]:nn,o=3<n.length&&typeof o=="function"?(u--,o):nn;for(t=Object(t);++e<u;){var i=r[e];i&&n(t,i,e,o)}return t})}function T(n){return function(){var t=arguments,r=dn(n.prototype),t=n.apply(r,t);return H(t)?t:r}}function F(n,t,r){function e(){for(var o=-1,i=arguments.length,c=-1,f=r.length,a=Array(f+i),l=this&&this!==on&&this instanceof e?u:n;++c<f;)a[c]=r[c];
for(;i--;)a[c++]=arguments[++o];return l.apply(t,a)}if(typeof n!="function")throw new TypeError("Expected a function");var u=T(n);return e}function B(n,t,r,e,u,o){var i=n.length,c=t.length;if(i!=c&&!(2&u&&c>i))return false;for(var c=-1,f=true,a=1&u?[]:nn;++c<i;){var l=n[c],p=t[c];if(void 0!==nn){f=false;break}if(a){if(!w(t,function(n,t){if(!z(a,t)&&(l===n||r(l,n,e,u,o)))return a.push(t)})){f=false;break}}else if(l!==p&&!r(l,p,e,u,o)){f=false;break}}return f}function R(n,t,r,e,u,o){var i=2&u,c=qn(n),f=c.length,a=qn(t).length;
if(f!=a&&!i)return false;for(var l=f;l--;){var p=c[l];if(!(i?p in t:pn.call(t,p)))return false}for(a=true;++l<f;){var p=c[l],s=n[p],h=t[p];if(void 0!==nn||s!==h&&!r(s,h,e,u,o)){a=false;break}i||(i="constructor"==p)}return a&&!i&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!(typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)&&(a=false)),a}function D(t){return Sn(t)||n(t)}function I(n){var t=[];if(null!=n)for(var r in Object(n))t.push(r);return t}function q(n,t,r){
return t=jn(t===nn?n.length-1:t,0),function(){for(var e=arguments,u=-1,o=jn(e.length-t,0),i=Array(o);++u<o;)i[u]=e[t+u];for(u=-1,o=Array(t+1);++u<t;)o[u]=e[u];return o[t]=r(i),n.apply(this,o)}}function $(n){return n&&n.length?s(n,1):[]}function P(n){return n&&n.length?n[0]:nn}function z(n,t,r){var e=n?n.length:0;r=typeof r=="number"?0>r?jn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++r<e;){var o=n[r];if(u?o===t:o!==o)return r}return-1}function C(n,t){return mn(n,_(t))}function G(n,t,r){return e(n,_(t),r,3>arguments.length,mn);
}function J(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Tn(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=nn),r}}function M(n,t){return n===t||n!==n&&t!==t}function U(n){var t;return(t=null!=n)&&(t=n.length,t=typeof t=="number"&&-1<t&&0==t%1&&9007199254740991>=t),t&&!V(n)}function V(n){return n=H(n)?hn.call(n):"","[object Function]"==n||"[object GeneratorFunction]"==n||"[object Proxy]"==n}function H(n){var t=typeof n;return null!=n&&("object"==t||"function"==t);
}function K(n){return null!=n&&typeof n=="object"}function L(n){return typeof n=="number"||K(n)&&"[object Number]"==hn.call(n)}function Q(n){return typeof n=="string"||!Sn(n)&&K(n)&&"[object String]"==hn.call(n)}function W(n){return typeof n=="string"?n:null==n?"":n+""}function X(n){return n?u(n,qn(n)):[]}function Y(n){return n}function Z(n,r,e){var u=qn(r),o=v(r,u);null!=e||H(r)&&(o.length||!u.length)||(e=r,r=n,n=this,o=v(r,qn(r)));var i=!(H(e)&&"chain"in e&&!e.chain),c=V(n);return mn(o,function(e){
var u=r[e];n[e]=u,c&&(n.prototype[e]=function(){var r=this.__chain__;if(i||r){var e=n(this.__wrapped__);return(e.__actions__=E(this.__actions__)).push({func:u,args:arguments,thisArg:n}),e.__chain__=r,e}return u.apply(n,t([this.value()],arguments))})}),n}var nn,tn=1/0,rn=/[&<>"']/g,en=RegExp(rn.source),un=typeof self=="object"&&self&&self.Object===Object&&self,on=typeof global=="object"&&global&&global.Object===Object&&global||un||Function("return this")(),cn=(un=typeof exports=="object"&&exports&&!exports.nodeType&&exports)&&typeof module=="object"&&module&&!module.nodeType&&module,fn=function(n){
return function(t){return null==n?nn:n[t]}}({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}),an=Array.prototype,ln=Object.prototype,pn=ln.hasOwnProperty,sn=0,hn=ln.toString,vn=on._,yn=Object.create,bn=ln.propertyIsEnumerable,gn=on.isFinite,_n=function(n,t){return function(r){return n(t(r))}}(Object.keys,Object),jn=Math.max,dn=function(){function n(){}return function(t){return H(t)?yn?yn(t):(n.prototype=t,t=new n,n.prototype=nn,t):{}}}();i.prototype=dn(o.prototype),i.prototype.constructor=i;
var mn=function(n,t){return function(r,e){if(null==r)return r;if(!U(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++o<u)&&false!==e(i[o],o,i););return r}}(h),On=function(n){return function(t,r,e){var u=-1,o=Object(t);e=e(t);for(var i=e.length;i--;){var c=e[n?i:++u];if(false===r(o[c],c,o))break}return t}}(),xn=Y,An=String,En=function(n){return function(t,r,e){var u=Object(t);if(!U(t)){var o=_(r);t=qn(t),r=function(n){return o(u[n],n,u)}}return r=n(t,r,e),-1<r?u[o?t[r]:r]:nn}}(function(n,t,r){
var e=n?n.length:0;if(!e)return-1;r=null==r?0:Tn(r),0>r&&(r=jn(e+r,0));n:{for(t=_(t),e=n.length,r+=-1;++r<e;)if(t(n[r],r,n)){n=r;break n}n=-1}return n}),wn=x(function(n,t,r){return F(n,t,r)}),kn=x(function(n,t){return f(n,1,t)}),Nn=x(function(n,t,r){return f(n,Fn(t)||0,r)}),Sn=Array.isArray,Tn=Number,Fn=Number,Bn=S(function(n,t){N(t,_n(t),n)}),Rn=S(function(n,t){N(t,I(t),n)}),Dn=S(function(n,t,r,e){N(t,$n(t),n,e)}),In=x(function(n){return n.push(nn,c),Dn.apply(nn,n)}),qn=_n,$n=I,Pn=function(n){return xn(q(n,nn,$),n+"");
}(function(n,t){return null==n?{}:O(n,d(t,An))});o.assignIn=Rn,o.before=J,o.bind=wn,o.chain=function(n){return n=o(n),n.__chain__=true,n},o.compact=function(n){return p(n,Boolean)},o.concat=function(){var n=arguments.length;if(!n)return[];for(var r=Array(n-1),e=arguments[0];n--;)r[n-1]=arguments[n];return t(Sn(e)?E(e):[e],s(r,1))},o.create=function(n,t){var r=dn(n);return t?Bn(r,t):r},o.defaults=In,o.defer=kn,o.delay=Nn,o.filter=function(n,t){return p(n,_(t))},o.flatten=$,o.flattenDeep=function(n){
return n&&n.length?s(n,tn):[]},o.iteratee=_,o.keys=qn,o.map=function(n,t){return d(n,_(t))},o.matches=function(n){return m(Bn({},n))},o.mixin=Z,o.negate=function(n){if(typeof n!="function")throw new TypeError("Expected a function");return function(){return!n.apply(this,arguments)}},o.once=function(n){return J(2,n)},o.pick=Pn,o.slice=function(n,t,r){var e=n?n.length:0;return r=r===nn?e:+r,e?A(n,null==t?0:+t,r):[]},o.sortBy=function(n,t){var e=0;return t=_(t),d(d(n,function(n,r,u){return{value:n,index:e++,
criteria:t(n,r,u)}}).sort(function(n,t){var r;n:{r=n.criteria;var e=t.criteria;if(r!==e){var u=r!==nn,o=null===r,i=r===r,c=e!==nn,f=null===e,a=e===e;if(!f&&r>e||o&&c&&a||!u&&a||!i){r=1;break n}if(!o&&r<e||f&&u&&i||!c&&i||!a){r=-1;break n}}r=0}return r||n.index-t.index}),r("value"))},o.tap=function(n,t){return t(n),n},o.thru=function(n,t){return t(n)},o.toArray=function(n){return U(n)?n.length?E(n):[]:X(n)},o.values=X,o.extend=Rn,Z(o,o),o.clone=function(n){return H(n)?Sn(n)?E(n):N(n,_n(n)):n},o.escape=function(n){
return(n=W(n))&&en.test(n)?n.replace(rn,fn):n},o.every=function(n,t,r){return t=r?nn:t,a(n,_(t))},o.find=En,o.forEach=C,o.has=function(n,t){return null!=n&&pn.call(n,t)},o.head=P,o.identity=Y,o.indexOf=z,o.isArguments=n,o.isArray=Sn,o.isBoolean=function(n){return true===n||false===n||K(n)&&"[object Boolean]"==hn.call(n)},o.isDate=function(n){return K(n)&&"[object Date]"==hn.call(n)},o.isEmpty=function(t){return U(t)&&(Sn(t)||Q(t)||V(t.splice)||n(t))?!t.length:!_n(t).length},o.isEqual=function(n,t){return b(n,t);
},o.isFinite=function(n){return typeof n=="number"&&gn(n)},o.isFunction=V,o.isNaN=function(n){return L(n)&&n!=+n},o.isNull=function(n){return null===n},o.isNumber=L,o.isObject=H,o.isRegExp=function(n){return H(n)&&"[object RegExp]"==hn.call(n)},o.isString=Q,o.isUndefined=function(n){return n===nn},o.last=function(n){var t=n?n.length:0;return t?n[t-1]:nn},o.max=function(n){return n&&n.length?l(n,Y,y):nn},o.min=function(n){return n&&n.length?l(n,Y,j):nn},o.noConflict=function(){return on._===this&&(on._=vn),
this},o.noop=function(){},o.reduce=G,o.result=function(n,t,r){return t=null==n?nn:n[t],t===nn&&(t=r),V(t)?t.call(n):t},o.size=function(n){return null==n?0:(n=U(n)?n:_n(n),n.length)},o.some=function(n,t,r){return t=r?nn:t,w(n,_(t))},o.uniqueId=function(n){var t=++sn;return W(n)+t},o.each=C,o.first=P,Z(o,function(){var n={};return h(o,function(t,r){pn.call(o.prototype,r)||(n[r]=t)}),n}(),{chain:false}),o.VERSION="4.16.4",mn("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){
var t=(/^(?:replace|split)$/.test(n)?String.prototype:an)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|join|replace|shift)$/.test(n);o.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(Sn(u)?u:[],n)}return this[r](function(r){return t.apply(Sn(r)?r:[],n)})}}),o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=function(){return k(this.__wrapped__,this.__actions__)},typeof define=="function"&&typeof define.amd=="object"&&define.amd?(on._=o,
define(function(){return o})):cn?((cn.exports=o)._=o,un._=o):on._=o}).call(this);

View File

@ -1,41 +0,0 @@
var baseAssignValue = require('./_baseAssignValue'),
createAggregator = require('./_createAggregator');
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Creates an object composed of keys generated from the results of running
* each element of `collection` thru `iteratee`. The corresponding value of
* each key is the number of times the key was returned by `iteratee`. The
* iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 0.5.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity]
* The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
* _.countBy([6.1, 4.2, 6.3], Math.floor);
* // => { '4': 1, '6': 2 }
*
* // The `_.property` iteratee shorthand.
* _.countBy(['one', 'two', 'three'], 'length');
* // => { '3': 2, '5': 1 }
*/
var countBy = createAggregator(function(result, value, key) {
if (hasOwnProperty.call(result, key)) {
++result[key];
} else {
baseAssignValue(result, key, 1);
}
});
module.exports = countBy;

View File

@ -1,43 +0,0 @@
var baseAssign = require('./_baseAssign'),
baseCreate = require('./_baseCreate');
/**
* Creates an object that inherits from the `prototype` object. If a
* `properties` object is given, its own enumerable string keyed properties
* are assigned to the created object.
*
* @static
* @memberOf _
* @since 2.3.0
* @category Object
* @param {Object} prototype The object to inherit from.
* @param {Object} [properties] The properties to assign to the object.
* @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) {
var result = baseCreate(prototype);
return properties ? baseAssign(result, properties) : result;
}
module.exports = create;

View File

@ -1,38 +0,0 @@
var baseSlice = require('./_baseSlice'),
toInteger = require('./toInteger');
/**
* Creates a slice of `array` with `n` elements dropped from the beginning.
*
* @static
* @memberOf _
* @since 0.5.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to drop.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.drop([1, 2, 3]);
* // => [2, 3]
*
* _.drop([1, 2, 3], 2);
* // => [3]
*
* _.drop([1, 2, 3], 5);
* // => []
*
* _.drop([1, 2, 3], 0);
* // => [1, 2, 3]
*/
function drop(array, n, guard) {
var length = array ? array.length : 0;
if (!length) {
return [];
}
n = (guard || n === undefined) ? 1 : toInteger(n);
return baseSlice(array, n < 0 ? 0 : n, length);
}
module.exports = drop;

View File

@ -1,39 +0,0 @@
var baseSlice = require('./_baseSlice'),
toInteger = require('./toInteger');
/**
* Creates a slice of `array` with `n` elements dropped from the end.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to drop.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.dropRight([1, 2, 3]);
* // => [1, 2]
*
* _.dropRight([1, 2, 3], 2);
* // => [1]
*
* _.dropRight([1, 2, 3], 5);
* // => []
*
* _.dropRight([1, 2, 3], 0);
* // => [1, 2, 3]
*/
function dropRight(array, n, guard) {
var length = array ? array.length : 0;
if (!length) {
return [];
}
n = (guard || n === undefined) ? 1 : toInteger(n);
n = length - n;
return baseSlice(array, 0, n < 0 ? 0 : n);
}
module.exports = dropRight;

View File

@ -1,46 +0,0 @@
var baseIteratee = require('./_baseIteratee'),
baseWhile = require('./_baseWhile');
/**
* Creates a slice of `array` excluding elements dropped from the beginning.
* Elements are dropped until `predicate` returns falsey. The predicate is
* invoked with three arguments: (value, index, array).
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true }
* ];
*
* _.dropWhile(users, function(o) { return !o.active; });
* // => objects for ['pebbles']
*
* // The `_.matches` iteratee shorthand.
* _.dropWhile(users, { 'user': 'barney', 'active': false });
* // => objects for ['fred', 'pebbles']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.dropWhile(users, ['active', false]);
* // => objects for ['pebbles']
*
* // The `_.property` iteratee shorthand.
* _.dropWhile(users, 'active');
* // => objects for ['barney', 'fred', 'pebbles']
*/
function dropWhile(array, predicate) {
return (array && array.length)
? baseWhile(array, baseIteratee(predicate, 3), true)
: [];
}
module.exports = dropWhile;

View File

@ -1,57 +0,0 @@
var arrayEvery = require('./_arrayEvery'),
baseEvery = require('./_baseEvery'),
baseIteratee = require('./_baseIteratee'),
isArray = require('./isArray'),
isIterateeCall = require('./_isIterateeCall');
/**
* Checks if `predicate` returns truthy for **all** elements of `collection`.
* Iteration is stopped once `predicate` returns falsey. The predicate is
* invoked with three arguments: (value, index|key, collection).
*
* **Note:** This method returns `true` for
* [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
* [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
* elements of empty collections.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @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', 'age': 36, 'active': false },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* // The `_.matches` iteratee shorthand.
* _.every(users, { 'user': 'barney', 'active': false });
* // => false
*
* // The `_.matchesProperty` iteratee shorthand.
* _.every(users, ['active', false]);
* // => true
*
* // The `_.property` iteratee shorthand.
* _.every(users, 'active');
* // => false
*/
function every(collection, predicate, guard) {
var func = isArray(collection) ? arrayEvery : baseEvery;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined;
}
return func(collection, baseIteratee(predicate, 3));
}
module.exports = every;

View File

@ -1,45 +0,0 @@
var baseFill = require('./_baseFill'),
isIterateeCall = require('./_isIterateeCall');
/**
* Fills elements of `array` with `value` from `start` up to, but not
* including, `end`.
*
* **Note:** This method mutates `array`.
*
* @static
* @memberOf _
* @since 3.2.0
* @category Array
* @param {Array} array The array to fill.
* @param {*} value The value to fill `array` with.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns `array`.
* @example
*
* var array = [1, 2, 3];
*
* _.fill(array, 'a');
* console.log(array);
* // => ['a', 'a', 'a']
*
* _.fill(Array(3), 2);
* // => [2, 2, 2]
*
* _.fill([4, 6, 8, 10], '*', 1, 3);
* // => [4, '*', '*', 10]
*/
function fill(array, value, start, end) {
var length = array ? array.length : 0;
if (!length) {
return [];
}
if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
start = 0;
end = length;
}
return baseFill(array, value, start, end);
}
module.exports = fill;

View File

@ -1,49 +0,0 @@
var arrayFilter = require('./_arrayFilter'),
baseFilter = require('./_baseFilter'),
baseIteratee = require('./_baseIteratee'),
isArray = require('./isArray');
/**
* Iterates over elements of `collection`, returning an array of all elements
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* **Note:** Unlike `_.remove`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.reject
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* _.filter(users, function(o) { return !o.active; });
* // => objects for ['fred']
*
* // The `_.matches` iteratee shorthand.
* _.filter(users, { 'age': 36, 'active': true });
* // => objects for ['barney']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.filter(users, ['active', false]);
* // => objects for ['fred']
*
* // The `_.property` iteratee shorthand.
* _.filter(users, 'active');
* // => objects for ['barney']
*/
function filter(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, baseIteratee(predicate, 3));
}
module.exports = filter;

View File

@ -1,43 +0,0 @@
var createFind = require('./_createFind'),
findIndex = require('./findIndex');
/**
* Iterates over elements of `collection`, returning the first element
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to inspect.
* @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false },
* { 'user': 'pebbles', 'age': 1, 'active': true }
* ];
*
* _.find(users, function(o) { return o.age < 40; });
* // => object for 'barney'
*
* // The `_.matches` iteratee shorthand.
* _.find(users, { 'age': 1, 'active': true });
* // => object for 'pebbles'
*
* // The `_.matchesProperty` iteratee shorthand.
* _.find(users, ['active', false]);
* // => object for 'fred'
*
* // The `_.property` iteratee shorthand.
* _.find(users, 'active');
* // => object for 'barney'
*/
var find = createFind(findIndex);
module.exports = find;

View File

@ -1,56 +0,0 @@
var baseFindIndex = require('./_baseFindIndex'),
baseIteratee = require('./_baseIteratee'),
toInteger = require('./toInteger');
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* This method is like `_.find` except that it returns the index of the first
* element `predicate` returns truthy for instead of the element itself.
*
* @static
* @memberOf _
* @since 1.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true }
* ];
*
* _.findIndex(users, function(o) { return o.user == 'barney'; });
* // => 0
*
* // The `_.matches` iteratee shorthand.
* _.findIndex(users, { 'user': 'fred', 'active': false });
* // => 1
*
* // The `_.matchesProperty` iteratee shorthand.
* _.findIndex(users, ['active', false]);
* // => 0
*
* // The `_.property` iteratee shorthand.
* _.findIndex(users, 'active');
* // => 2
*/
function findIndex(array, predicate, fromIndex) {
var length = array ? array.length : 0;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseFindIndex(array, baseIteratee(predicate, 3), index);
}
module.exports = findIndex;

View File

@ -1,26 +0,0 @@
var createFind = require('./_createFind'),
findLastIndex = require('./findLastIndex');
/**
* This method is like `_.find` except that it iterates over elements of
* `collection` from right to left.
*
* @static
* @memberOf _
* @since 2.0.0
* @category Collection
* @param {Array|Object} collection The collection to inspect.
* @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param {number} [fromIndex=collection.length-1] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
* _.findLast([1, 2, 3, 4], function(n) {
* return n % 2 == 1;
* });
* // => 3
*/
var findLast = createFind(findLastIndex);
module.exports = findLast;

Some files were not shown because too many files have changed in this diff Show More