Commit 33ead8772ef34267c38d09d9ed171dccf5c5f167
0 parents
Exists in
master
and in
1 other branch
first code
Showing
4491 changed files
with
547824 additions
and
0 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 4491 files displayed.
| 1 | +++ a/.idea/express-project.iml | |
| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<module type="WEB_MODULE" version="4"> | |
| 3 | + <component name="NewModuleRootManager"> | |
| 4 | + <content url="file://$MODULE_DIR$"> | |
| 5 | + <excludeFolder url="file://$MODULE_DIR$/.tmp" /> | |
| 6 | + <excludeFolder url="file://$MODULE_DIR$/temp" /> | |
| 7 | + <excludeFolder url="file://$MODULE_DIR$/tmp" /> | |
| 8 | + </content> | |
| 9 | + <orderEntry type="inheritedJdk" /> | |
| 10 | + <orderEntry type="sourceFolder" forTests="false" /> | |
| 11 | + </component> | |
| 12 | +</module> | |
| 0 | 13 | \ No newline at end of file | ... | ... |
| 1 | +++ a/.idea/jsLibraryMappings.xml | |
| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project version="4"> | |
| 3 | + <component name="JavaScriptLibraryMappings"> | |
| 4 | + <includedPredefinedLibrary name="Node.js Core" /> | |
| 5 | + </component> | |
| 6 | +</project> | |
| 0 | 7 | \ No newline at end of file | ... | ... |
| 1 | +++ a/.idea/markdown-navigator.xml | |
| ... | ... | @@ -0,0 +1,72 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project version="4"> | |
| 3 | + <component name="MarkdownProjectSettings"> | |
| 4 | + <PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="false" showSelectionInPreview="true"> | |
| 5 | + <PanelProvider> | |
| 6 | + <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" /> | |
| 7 | + </PanelProvider> | |
| 8 | + </PreviewSettings> | |
| 9 | + <ParserSettings gitHubSyntaxChange="false"> | |
| 10 | + <PegdownExtensions> | |
| 11 | + <option name="ABBREVIATIONS" value="false" /> | |
| 12 | + <option name="ANCHORLINKS" value="true" /> | |
| 13 | + <option name="ASIDE" value="false" /> | |
| 14 | + <option name="ATXHEADERSPACE" value="true" /> | |
| 15 | + <option name="AUTOLINKS" value="true" /> | |
| 16 | + <option name="DEFINITIONS" value="false" /> | |
| 17 | + <option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" /> | |
| 18 | + <option name="FENCED_CODE_BLOCKS" value="true" /> | |
| 19 | + <option name="FOOTNOTES" value="false" /> | |
| 20 | + <option name="HARDWRAPS" value="false" /> | |
| 21 | + <option name="HTML_DEEP_PARSER" value="false" /> | |
| 22 | + <option name="INSERTED" value="false" /> | |
| 23 | + <option name="QUOTES" value="false" /> | |
| 24 | + <option name="RELAXEDHRULES" value="true" /> | |
| 25 | + <option name="SMARTS" value="false" /> | |
| 26 | + <option name="STRIKETHROUGH" value="true" /> | |
| 27 | + <option name="SUBSCRIPT" value="false" /> | |
| 28 | + <option name="SUPERSCRIPT" value="false" /> | |
| 29 | + <option name="SUPPRESS_HTML_BLOCKS" value="false" /> | |
| 30 | + <option name="SUPPRESS_INLINE_HTML" value="false" /> | |
| 31 | + <option name="TABLES" value="true" /> | |
| 32 | + <option name="TASKLISTITEMS" value="true" /> | |
| 33 | + <option name="TOC" value="false" /> | |
| 34 | + <option name="WIKILINKS" value="true" /> | |
| 35 | + </PegdownExtensions> | |
| 36 | + <ParserOptions> | |
| 37 | + <option name="COMMONMARK_LISTS" value="true" /> | |
| 38 | + <option name="DUMMY" value="false" /> | |
| 39 | + <option name="EMOJI_SHORTCUTS" value="true" /> | |
| 40 | + <option name="FLEXMARK_FRONT_MATTER" value="false" /> | |
| 41 | + <option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" /> | |
| 42 | + <option name="GFM_TABLE_RENDERING" value="true" /> | |
| 43 | + <option name="GITBOOK_URL_ENCODING" value="false" /> | |
| 44 | + <option name="GITHUB_EMOJI_URL" value="false" /> | |
| 45 | + <option name="GITHUB_LISTS" value="false" /> | |
| 46 | + <option name="GITHUB_WIKI_LINKS" value="true" /> | |
| 47 | + <option name="JEKYLL_FRONT_MATTER" value="false" /> | |
| 48 | + <option name="SIM_TOC_BLANK_LINE_SPACER" value="true" /> | |
| 49 | + </ParserOptions> | |
| 50 | + </ParserSettings> | |
| 51 | + <HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true"> | |
| 52 | + <GeneratorProvider> | |
| 53 | + <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" /> | |
| 54 | + </GeneratorProvider> | |
| 55 | + <headerTop /> | |
| 56 | + <headerBottom /> | |
| 57 | + <bodyTop /> | |
| 58 | + <bodyBottom /> | |
| 59 | + </HtmlSettings> | |
| 60 | + <CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true"> | |
| 61 | + <StylesheetProvider> | |
| 62 | + <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" /> | |
| 63 | + </StylesheetProvider> | |
| 64 | + <ScriptProviders /> | |
| 65 | + <cssText /> | |
| 66 | + </CssSettings> | |
| 67 | + <HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" /> | |
| 68 | + <LinkMapSettings> | |
| 69 | + <textMaps /> | |
| 70 | + </LinkMapSettings> | |
| 71 | + </component> | |
| 72 | +</project> | |
| 0 | 73 | \ No newline at end of file | ... | ... |
| 1 | +++ a/.idea/modules.xml | |
| ... | ... | @@ -0,0 +1,8 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project version="4"> | |
| 3 | + <component name="ProjectModuleManager"> | |
| 4 | + <modules> | |
| 5 | + <module fileurl="file://$PROJECT_DIR$/.idea/express-project.iml" filepath="$PROJECT_DIR$/.idea/express-project.iml" /> | |
| 6 | + </modules> | |
| 7 | + </component> | |
| 8 | +</project> | |
| 0 | 9 | \ No newline at end of file | ... | ... |
| 1 | +++ a/app.config.json | |
| ... | ... | @@ -0,0 +1,63 @@ |
| 1 | +{ | |
| 2 | + "default": { | |
| 3 | + "appPort": 3000, | |
| 4 | + "apiUrlPrefix": "/api/partner", | |
| 5 | + "requestTimeout": 10, | |
| 6 | + "redis" : { | |
| 7 | + "host": "10.1.2.155", | |
| 8 | + "port": "6379" | |
| 9 | + }, | |
| 10 | + "passport": { | |
| 11 | + "strategy": "local", | |
| 12 | + "configStrategy": { | |
| 13 | + "local": { | |
| 14 | + "usernameField": "username", | |
| 15 | + "passwordField": "password" | |
| 16 | + }, | |
| 17 | + "saml": { | |
| 18 | + "path": "/login/callback", | |
| 19 | + "entryPoint": "https://10.252.160.223:9443/samlsso", | |
| 20 | + "issuer": "smaf-partner" | |
| 21 | + } | |
| 22 | + }, | |
| 23 | + "routes": { | |
| 24 | + "local": { | |
| 25 | + "loginPageUrl": "http://localhost:4200/#/login", | |
| 26 | + "logoutRedirectUrl": "http://localhost:4200" | |
| 27 | + }, | |
| 28 | + "saml": { | |
| 29 | + "loginPageUrl": "/login", | |
| 30 | + "logoutRedirectUrl": "http://localhost:4200" | |
| 31 | + } | |
| 32 | + } | |
| 33 | + }, | |
| 34 | + "sdfHost": "http://10.1.2.222:5000", | |
| 35 | + "sdfAPI": { | |
| 36 | + "saleArea": "/api/abc/def" | |
| 37 | + } | |
| 38 | + }, | |
| 39 | + "dev": { | |
| 40 | + "redis" : { | |
| 41 | + "host": "11.1.2.155", | |
| 42 | + "port": "6379" | |
| 43 | + }, | |
| 44 | + "sdfHost": "http://10.1.2.222:5000" | |
| 45 | + }, | |
| 46 | + "staging": { | |
| 47 | + "appPort": 4800, | |
| 48 | + "redis" : { | |
| 49 | + "host": "12.1.2.155", | |
| 50 | + "port": "6379" | |
| 51 | + }, | |
| 52 | + "sdfHost": "http://10.1.2.222:5000" | |
| 53 | + }, | |
| 54 | + "production": { | |
| 55 | + "appPort": 4800, | |
| 56 | + "redis" : { | |
| 57 | + "host": "12.1.2.155", | |
| 58 | + "port": "6379" | |
| 59 | + }, | |
| 60 | + "sdfHost": "http://10.1.2.222:5000" | |
| 61 | + } | |
| 62 | +} | |
| 63 | + | ... | ... |
| 1 | +++ a/app.js | |
| ... | ... | @@ -0,0 +1,135 @@ |
| 1 | +require('app-module-path').addPath(__dirname); | |
| 2 | +const express = require('express'); | |
| 3 | +const app = express(); | |
| 4 | + | |
| 5 | +const conf = require('utils/config'); | |
| 6 | + | |
| 7 | +console.log(conf.get('redis.host')); | |
| 8 | + | |
| 9 | +// setup generate request-id middleware | |
| 10 | +const addRequestId = require('express-request-id')(); | |
| 11 | +app.use(addRequestId); | |
| 12 | + | |
| 13 | +// setup express-session with redis store | |
| 14 | +const session = require('express-session'); | |
| 15 | +const RedisStore = require('connect-redis')(session); | |
| 16 | +const uuidV4 = require('uuid/v4'); | |
| 17 | + | |
| 18 | +app.use(session({ | |
| 19 | + genid: function(req) { | |
| 20 | + return uuidV4(); // generates session id using UUID | |
| 21 | + }, | |
| 22 | + store: new RedisStore({ | |
| 23 | + host: conf.get('redis.host'), | |
| 24 | + port: conf.get('redis.port'), | |
| 25 | + ttl: 180 | |
| 26 | + }), | |
| 27 | + secret: 'dbc33e678f', | |
| 28 | + saveUninitialized: true, | |
| 29 | + resave: false, | |
| 30 | + cookie: { maxAge: 3600000 } | |
| 31 | +})); | |
| 32 | + | |
| 33 | + | |
| 34 | +// setup json body parser | |
| 35 | +const bodyParser = require('body-parser'); | |
| 36 | +app.use(bodyParser.json()); | |
| 37 | + | |
| 38 | +// setup logger | |
| 39 | +// const logger = require('utils/request-logger'); | |
| 40 | + | |
| 41 | +// setup express request/response logger | |
| 42 | +const log4js = require('log4js'); | |
| 43 | +log4js.configure('./config/log4js_config.json'); | |
| 44 | +// const log4jsLogger = log4js.getLogger('express-project'); | |
| 45 | + | |
| 46 | +// const fileTransport = logger.fileTransport; | |
| 47 | +// const expressWinston = require('winston-express-middleware'); | |
| 48 | +// expressWinston.requestWhitelist.push('session'); | |
| 49 | +// expressWinston.requestWhitelist.push('body'); | |
| 50 | +// expressWinston.responseWhitelist.push('session'); | |
| 51 | +// expressWinston.responseWhitelist.push('body'); | |
| 52 | + | |
| 53 | +// app.use(expressWinston.logger({ | |
| 54 | +// transports: [fileTransport], | |
| 55 | +// meta: true, // optional: control whether you want to log the meta data about the request (default to true) | |
| 56 | +// msg: "phoenix-partner - :: ## {{req.uid}} - {{req.id}} ## HTTP {{req.method}} {{req.url}} ", | |
| 57 | +// //msg: "SID:[{{req.session.id}}] UID:[{{req.id}}] HTTP {{req.method}} {{req.url}} ", //request-body:{{JSON.stringify(req.body)}}", // -- response-body:{{JSON.stringify(res.body)}}", // optional: customize the default logging message. E.g. "{{res.statusCode}} {{req.method}} {{res.responseTime}}ms {{req.url}}" | |
| 58 | +// expressFormat: false, // Use the default Express/morgan request formatting, with the same colors. Enabling this will override any msg and colorStatus if true. Will only output colors on transports with colorize set to true | |
| 59 | +// colorStatus: true, // Color the status code, using the Express/morgan color palette (default green, 3XX cyan, 4XX yellow, 5XX red). Will not be recognized if expressFormat is true | |
| 60 | +// ignoreRoute: function (req, res) { return false; }, // optional: allows to skip some log messages based on request and/or response, | |
| 61 | +// customLogger: log4jsLogger, | |
| 62 | +// filterOutList: ['dropdown', 'loggedin', 'query-table', 'query-last-package-number', '.png', '.woff', '.ttf', 'jquery.nanoscroller', 'favicon.ico'], // not log any messages that have one of these words | |
| 63 | +// noExportData: true, // remove resultData in case message has '/export' | |
| 64 | +// noHeader: true, // not log headers if true | |
| 65 | +// noBody: false // not log body if true | |
| 66 | +// })); | |
| 67 | + | |
| 68 | + | |
| 69 | +// setup passport | |
| 70 | +const passport = require('utils/passport-func')(); | |
| 71 | +const flash = require('connect-flash'); | |
| 72 | +app.use(flash()); | |
| 73 | +app.use(passport.initialize()); | |
| 74 | +app.use(passport.session()); | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | +app.use(function (req, res, next) { | |
| 79 | + // add generated request-id to session | |
| 80 | + //req.session.reqId = req.id; | |
| 81 | + // Enable CORS | |
| 82 | + // res.header("Access-Control-Allow-Origin", "*"); | |
| 83 | + res.header("Access-Control-Allow-Credentials", "true"); | |
| 84 | + res.header("Access-Control-Allow-Origin", req.headers.origin); | |
| 85 | + res.header("Access-Control-Allow-Methods", "POST, PUT, GET, DELETE, OPTIONS"); | |
| 86 | + res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); | |
| 87 | + next(); | |
| 88 | +}); | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | +// get BE api configs | |
| 94 | +const apiUrlPrefix = conf.get('apiUrlPrefix'); | |
| 95 | +const appPort = conf.get('appPort'); | |
| 96 | + | |
| 97 | +// load controllers | |
| 98 | +let mongoQuery = require('./controllers/mongo-db/index'); | |
| 99 | +app.use('/mongo', mongoQuery); | |
| 100 | + | |
| 101 | +let apiSaleArea = require('./controllers/sale-area/index'); | |
| 102 | +app.use(apiUrlPrefix + '/sale-area', apiSaleArea); | |
| 103 | + | |
| 104 | +let apiLogin = require('./controllers/login/login')(passport); | |
| 105 | +app.use('/', apiLogin); | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | +// handle not found | |
| 110 | +app.all('*', function(req, res) { | |
| 111 | + res.status(404); | |
| 112 | + | |
| 113 | + // respond with json | |
| 114 | + res.send({ | |
| 115 | + error: 'Not found' | |
| 116 | + }); | |
| 117 | + | |
| 118 | +}); | |
| 119 | + | |
| 120 | +// // handle errors | |
| 121 | +// app.use(function (err, req, res, next) { | |
| 122 | +// // we may use properties of the error object | |
| 123 | +// // here and next(err) appropriately, or if | |
| 124 | +// // we possibly recovered from the error, simply next(). | |
| 125 | +// res.status(err.status || 500).send(err.message || err); | |
| 126 | +// }); | |
| 127 | + | |
| 128 | +// winston-express-middleware errorLogger makes sense AFTER the router. | |
| 129 | +// app.use(expressWinston.errorLogger({ | |
| 130 | +// transports: [fileTransport] | |
| 131 | +// })); | |
| 132 | + | |
| 133 | +app.listen(appPort, function () { | |
| 134 | + console.log('SMAF-Partner Backend app listening on port ' + appPort + '!'); | |
| 135 | +}); | ... | ... |
| 1 | +++ a/config/log4js_config.json | |
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +{ | |
| 2 | + "appenders": { | |
| 3 | + "express-project": { | |
| 4 | + "type": "dateFile", | |
| 5 | + "filename": "./logs/express-project", | |
| 6 | + "pattern": "-yyyyMMdd.log", | |
| 7 | + "alwaysIncludePattern": false | |
| 8 | + } | |
| 9 | + }, | |
| 10 | + "categories": { | |
| 11 | + "default": { | |
| 12 | + "appenders": [ | |
| 13 | + "express-project" | |
| 14 | + ], | |
| 15 | + "level": "all" | |
| 16 | + } | |
| 17 | + } | |
| 18 | +} | |
| 0 | 19 | \ No newline at end of file | ... | ... |
| 1 | +++ a/controllers/login/login.js | |
| ... | ... | @@ -0,0 +1,89 @@ |
| 1 | +const express = require('express'); | |
| 2 | +const router = express.Router(); | |
| 3 | +const sendRequest = require('utils/send-request'); | |
| 4 | +const sendResponse = require('utils/send-response'); | |
| 5 | +const validate = require('utils/validator'); | |
| 6 | +//const passport = require('utils/passport-func')(); | |
| 7 | +const conf = require('utils/config'); | |
| 8 | + | |
| 9 | +let logoutRedirectUrl; | |
| 10 | + | |
| 11 | + | |
| 12 | +module.exports = function(passport) { | |
| 13 | + | |
| 14 | + switch(conf.get('passport.strategy')) { | |
| 15 | + case "local": | |
| 16 | + console.log('passport local routes'); | |
| 17 | + logoutRedirectUrl = conf.get('passport.routes.local.logoutRedirectUrl'); | |
| 18 | + | |
| 19 | + router.get('/login', (req, res) => { | |
| 20 | + res.redirect(conf.get('passport.routes.local.loginPageUrl')); | |
| 21 | + }); | |
| 22 | + | |
| 23 | + router.post('/login', passport.authenticate('local', { failureFlash: true }), (req, res) => { | |
| 24 | + // this function runs if success | |
| 25 | + console.log('post login'); | |
| 26 | + req.session.regenerate(function(err) { | |
| 27 | + if (err) { | |
| 28 | + res.json(err); | |
| 29 | + } | |
| 30 | + }); | |
| 31 | + console.log('Login success... returning user in json'); | |
| 32 | + res.json(req.user); | |
| 33 | + }); | |
| 34 | + | |
| 35 | + break; | |
| 36 | + | |
| 37 | + case "saml": | |
| 38 | + | |
| 39 | + logoutRedirectUrl = conf.get('passport.routes.saml.logoutRedirectUrl'); | |
| 40 | + | |
| 41 | + router.get('/login', | |
| 42 | + passport.authenticate('saml', | |
| 43 | + { | |
| 44 | + successRedirect: '/', | |
| 45 | + failureRedirect: '/login' | |
| 46 | + }) | |
| 47 | + ); | |
| 48 | + | |
| 49 | + router.post(conf.get('passport.configStrategy.saml.path'), | |
| 50 | + passport.authenticate('saml', | |
| 51 | + { | |
| 52 | + failureRedirect: '/', | |
| 53 | + failureFlash: false | |
| 54 | + }), | |
| 55 | + (req, res) => { | |
| 56 | + // code to get user permission | |
| 57 | + console.log(req.user); | |
| 58 | + // redirect to dashboard | |
| 59 | + res.redirect('http://localhost:4200'); | |
| 60 | + } | |
| 61 | + ); | |
| 62 | + | |
| 63 | + break; | |
| 64 | + | |
| 65 | + default: | |
| 66 | + logoutRedirectUrl = '/'; | |
| 67 | + } | |
| 68 | + | |
| 69 | + router.get('/loggedin', (req, res) => { | |
| 70 | + if (req.isUnauthenticated()) { | |
| 71 | + console.log('GET /loggedin not authenticated'); | |
| 72 | + return res.json({ error: 'not logged in'}); | |
| 73 | + } else { | |
| 74 | + console.log('authenticated'); | |
| 75 | + console.log('GET /loggedin ' + req.session.id); | |
| 76 | + return res.json(req.user); | |
| 77 | + } | |
| 78 | + }); | |
| 79 | + | |
| 80 | + router.get('/logout', (req, res) => { | |
| 81 | + console.log('User logged out.'); | |
| 82 | + req.session.destroy(); | |
| 83 | + req.logout(); | |
| 84 | + res.redirect(logoutRedirectUrl); | |
| 85 | + }); | |
| 86 | + | |
| 87 | + | |
| 88 | + return router; | |
| 89 | +}; | ... | ... |
| 1 | +++ a/controllers/mongo-db/index.js | |
| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | +let express = require('express'); | |
| 2 | +let router = express.Router(); | |
| 3 | + | |
| 4 | +// load controllers | |
| 5 | +const queryCtrl = require('./query'); | |
| 6 | + | |
| 7 | +router.use('/query', queryCtrl); | |
| 8 | + | |
| 9 | +module.exports = router; | |
| 0 | 10 | \ No newline at end of file | ... | ... |
| 1 | +++ a/controllers/mongo-db/mongoConnect.js | |
| ... | ... | @@ -0,0 +1,58 @@ |
| 1 | +const logger = require('../../utils/request-logger'); | |
| 2 | +var MongoClient = require('mongodb').MongoClient; | |
| 3 | +var url = "mongodb://10.1.2.155:27017/"; | |
| 4 | +const database = "spw" | |
| 5 | + | |
| 6 | +var connection = {}; | |
| 7 | + | |
| 8 | +connection.reqMongo = async function (req, query, collection) { | |
| 9 | + | |
| 10 | + console.log(req.id) | |
| 11 | + | |
| 12 | + var result = await mongoReq(req, query, collection); | |
| 13 | + | |
| 14 | + return result; | |
| 15 | +} | |
| 16 | + | |
| 17 | + | |
| 18 | +function mongoReq(req, query, collection){ | |
| 19 | + | |
| 20 | + logger.logSqlQuery({id : "session", reqId : req.id}, query); | |
| 21 | + | |
| 22 | + return new Promise((resolve, reject) => { | |
| 23 | + MongoClient.connect(url, { useNewUrlParser: true }, function(err, db) { | |
| 24 | + if (err) { | |
| 25 | + console.log(err) | |
| 26 | + logger.logSqlResult({id : "session", reqId : req.id}, err.errmsg); | |
| 27 | + resolve({ | |
| 28 | + resultCode : "50001", | |
| 29 | + message : err.errmsg | |
| 30 | + }); | |
| 31 | + } | |
| 32 | + | |
| 33 | + var dbo = db.db(database); | |
| 34 | + dbo.collection(collection).find(query, { projection: { _id: 0 } }).toArray(function(err, result) { | |
| 35 | + db.close(); | |
| 36 | + | |
| 37 | + if (err) { | |
| 38 | + console.log(err) | |
| 39 | + logger.logSqlResult({id : "session", reqId : req.id}, err.errmsg); | |
| 40 | + resolve({ | |
| 41 | + resultCode : "50001", | |
| 42 | + message : err.errmsg | |
| 43 | + }); | |
| 44 | + } | |
| 45 | + logger.logSqlResult({id : "session", reqId : req.id}, result); | |
| 46 | + resolve({ | |
| 47 | + resultCode : "20000", | |
| 48 | + resultDescription : "Success", | |
| 49 | + resultData : result | |
| 50 | + }); | |
| 51 | + }); | |
| 52 | + }); | |
| 53 | + }); | |
| 54 | + | |
| 55 | +} | |
| 56 | + | |
| 57 | + | |
| 58 | +module.exports = connection; | |
| 0 | 59 | \ No newline at end of file | ... | ... |
| 1 | +++ a/controllers/mongo-db/query.js | |
| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | +let express = require('express'); | |
| 2 | +let router = express.Router(); | |
| 3 | +let connection = require("./mongoConnect.js") | |
| 4 | + | |
| 5 | + | |
| 6 | +router.get('/',async function (req, res) { | |
| 7 | + var query = Object.assign(req.params, req.query); | |
| 8 | + var result = await connection.reqMongo(req, query) | |
| 9 | + res.status(200).json(result); | |
| 10 | +}); | |
| 11 | + | |
| 12 | +router.post('/', (req, res) => { | |
| 13 | + res.send('POST Query'); | |
| 14 | +}); | |
| 15 | + | |
| 16 | +router.put('/', (req, res) => { | |
| 17 | + res.send('PUT Query'); | |
| 18 | +}); | |
| 19 | + | |
| 20 | +router.delete('/', (req, res) => { | |
| 21 | + res.send('DELETE Query'); | |
| 22 | +}); | |
| 23 | + | |
| 24 | +module.exports = router; | ... | ... |
| 1 | +++ a/controllers/sale-area/index.js | |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +let express = require('express'); | |
| 2 | +let router = express.Router(); | |
| 3 | + | |
| 4 | +// load controllers | |
| 5 | +const saleAreaCtrl = require('./sale-area'); | |
| 6 | +const mappingRegionCtrl = require('./mapping-region'); | |
| 7 | +const provinceCtrl = require('./province'); | |
| 8 | +const mappingDistributionCtrl= require('./mapping-distribution'); | |
| 9 | + | |
| 10 | +router.use('/sale-area', saleAreaCtrl); | |
| 11 | +router.use('/mapping-region', mappingRegionCtrl); | |
| 12 | +router.use('/province', provinceCtrl); | |
| 13 | +router.use('/mapping-distribution', mappingDistributionCtrl); | |
| 14 | + | |
| 15 | +module.exports = router; | |
| 0 | 16 | \ No newline at end of file | ... | ... |
| 1 | +++ a/controllers/sale-area/mapping-distribution.js | |
| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | +let express = require('express'); | |
| 2 | +let router = express.Router(); | |
| 3 | + | |
| 4 | +router.get('/', (req, res) => { | |
| 5 | + res.send('GET Mapping Distribution'); | |
| 6 | +}); | |
| 7 | + | |
| 8 | +router.post('/', (req, res) => { | |
| 9 | + res.send('POST Mapping Distribution'); | |
| 10 | +}); | |
| 11 | + | |
| 12 | +router.put('/', (req, res) => { | |
| 13 | + res.send('PUT Mapping Distribution'); | |
| 14 | +}); | |
| 15 | + | |
| 16 | +router.delete('/', (req, res) => { | |
| 17 | + res.send('DELETE Mapping Distribution'); | |
| 18 | +}); | |
| 19 | + | |
| 20 | +module.exports = router; | ... | ... |
| 1 | +++ a/controllers/sale-area/mapping-region.js | |
| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | +let express = require('express'); | |
| 2 | +let router = express.Router(); | |
| 3 | + | |
| 4 | +router.get('/', (req, res) => { | |
| 5 | + res.send('GET Mapping Region'); | |
| 6 | +}); | |
| 7 | + | |
| 8 | +router.post('/', (req, res) => { | |
| 9 | + res.send('POST Mapping Region'); | |
| 10 | +}); | |
| 11 | + | |
| 12 | +router.put('/', (req, res) => { | |
| 13 | + res.send('PUT Mapping Region'); | |
| 14 | +}); | |
| 15 | + | |
| 16 | +router.delete('/', (req, res) => { | |
| 17 | + res.send('DELETE Mapping Region'); | |
| 18 | +}); | |
| 19 | + | |
| 20 | +module.exports = router; | ... | ... |
| 1 | +++ a/controllers/sale-area/province.js | |
| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | +let express = require('express'); | |
| 2 | +let router = express.Router(); | |
| 3 | + | |
| 4 | +router.get('/', (req, res) => { | |
| 5 | + res.send('GET Province'); | |
| 6 | +}); | |
| 7 | + | |
| 8 | +router.post('/', (req, res) => { | |
| 9 | + res.send('POST Province'); | |
| 10 | +}); | |
| 11 | + | |
| 12 | +router.put('/', (req, res) => { | |
| 13 | + res.send('PUT Province'); | |
| 14 | +}); | |
| 15 | + | |
| 16 | +router.delete('/', (req, res) => { | |
| 17 | + res.send('DELETE Province'); | |
| 18 | +}); | |
| 19 | + | |
| 20 | +module.exports = router; | ... | ... |
| 1 | +++ a/controllers/sale-area/sale-area.js | |
| ... | ... | @@ -0,0 +1,93 @@ |
| 1 | +const express = require('express'); | |
| 2 | +const router = express.Router(); | |
| 3 | +const sendRequest = require('utils/send-request'); | |
| 4 | +const sendResponse = require('utils/send-response'); | |
| 5 | +const validate = require('utils/validator'); | |
| 6 | + | |
| 7 | +const conf = require('utils/config'); | |
| 8 | + | |
| 9 | + | |
| 10 | +const timeout = conf.get('requestTimeout'); | |
| 11 | + | |
| 12 | +router.get('/', async (req, res) => { | |
| 13 | + // get input (req.params, req.query, req.body) | |
| 14 | + console.log('GET'); | |
| 15 | + let data = req.body; | |
| 16 | + let rules = {}; | |
| 17 | + // validate input, handle error | |
| 18 | + // validate(data, rules) | |
| 19 | + // .then(() => { | |
| 20 | + // // logic | |
| 21 | + // return sendRequest.get('http://127.0.0.1/', timeout, req.session); | |
| 22 | + // }) | |
| 23 | + // .then((response) => { | |
| 24 | + // console.log('res = ' + response); | |
| 25 | + // res.send('GET Sale Area'); | |
| 26 | + // }) | |
| 27 | + // .catch((error) => { | |
| 28 | + // console.log('catch ' + error); | |
| 29 | + // if (error instanceof ValidationError) { | |
| 30 | + // let response = sendResponse.missingOrInvalidResponse(error.instance[0].message); | |
| 31 | + // res.status(403); | |
| 32 | + // res.json(response); | |
| 33 | + // } else if (error instanceof UnirestError) { | |
| 34 | + // console.log('hey'); | |
| 35 | + // res.status(500); | |
| 36 | + // res.send(error.instance.message); | |
| 37 | + // } else { | |
| 38 | + // res.status(501); | |
| 39 | + // res.send(error); | |
| 40 | + // } | |
| 41 | + // }); | |
| 42 | + try { | |
| 43 | + await validate(data, rules); | |
| 44 | + let response = await sendRequest.get('http://127.0.0.1/', timeout, req.session); | |
| 45 | + console.log('res = ' + response); | |
| 46 | + res.send('GET Sale Area'); | |
| 47 | + } | |
| 48 | + catch(error) { | |
| 49 | + let errResponse = sendResponse.handleError(error); | |
| 50 | + res.status(errResponse.code); | |
| 51 | + res.send(errResponse.object); | |
| 52 | + } | |
| 53 | +}); | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | +router.post('/', (req, res) => { | |
| 58 | + // get input (req.params, req.query, req.body) | |
| 59 | + let data = req.body; | |
| 60 | + let rules = {}; | |
| 61 | + // validate input, handle error | |
| 62 | + indicative.validate(data, rules) | |
| 63 | + .then(() => { | |
| 64 | + // logic | |
| 65 | + sendRequest.post('http://10.1.2.155:3738/api/heroes', timeout, req.session, data) | |
| 66 | + .then((response) => { | |
| 67 | + console.log(response.body); | |
| 68 | + res.send('POST Sale Area'); | |
| 69 | + }) | |
| 70 | + .catch((error) => { | |
| 71 | + console.log(error); | |
| 72 | + res.status(500); | |
| 73 | + res.send('Error POST Sale Area'); | |
| 74 | + }); | |
| 75 | + }) | |
| 76 | + .catch((error) => { | |
| 77 | + let response = sendResponse.missingOrInvalidResponse(error.message); | |
| 78 | + res.status(403); | |
| 79 | + res.json(response); | |
| 80 | + }); | |
| 81 | +}); | |
| 82 | + | |
| 83 | +router.put('/', (req, res) => { | |
| 84 | + res.send('PUT Sale Area'); | |
| 85 | +}); | |
| 86 | + | |
| 87 | +router.delete('/', (req, res) => { | |
| 88 | + res.send('DELETE Sale Area'); | |
| 89 | +}); | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | +module.exports = router; | ... | ... |
| 1 | +++ a/ecosystem.config.json | |
| ... | ... | @@ -0,0 +1,32 @@ |
| 1 | +{ | |
| 2 | + "apps" : [{ | |
| 3 | + "name" : "smaf-partner-api", | |
| 4 | + "script" : "./app.js", | |
| 5 | + "watch" : false, | |
| 6 | + "cwd" : "./", | |
| 7 | + "env": { | |
| 8 | + "NODE_ENV": "default" | |
| 9 | + }, | |
| 10 | + "env_dev": { | |
| 11 | + "NODE_ENV": "dev" | |
| 12 | + }, | |
| 13 | + "env_production" : { | |
| 14 | + "NODE_ENV": "production" | |
| 15 | + } | |
| 16 | + }, { | |
| 17 | + "name" : "smaf-partner", | |
| 18 | + "interpreter" : "/usr/local/bin/http-server", | |
| 19 | + "interpreter_args" : "dist/ -p 3000 -d false", | |
| 20 | + "script" : ".", | |
| 21 | + "watch" : false, | |
| 22 | + "env": { | |
| 23 | + "NODE_ENV": "default" | |
| 24 | + }, | |
| 25 | + "env_dev": { | |
| 26 | + "NODE_ENV": "dev" | |
| 27 | + }, | |
| 28 | + "env_production" : { | |
| 29 | + "NODE_ENV": "production" | |
| 30 | + } | |
| 31 | + }] | |
| 32 | +} | |
| 0 | 33 | \ No newline at end of file | ... | ... |
| 1 | +++ a/logs/app.log | |
| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | +{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
| 2 | +{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
| 3 | +{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: \"[{\\\"table\\\":\\\"get_spwHashtags\\\",\\\"value\\\":\\\"bbb\\\"}]\"","level":"info"} | |
| 4 | +{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
| 5 | +{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
| 6 | +{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
| 7 | +{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
| 8 | +{"message":"phoenix-partner - :: ## - - ## BE Receive HTTP GET mongodb://10.1.2.155:27017/ response-header: undefined response-body: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
| 9 | +{"message":"phoenix-partner - :: ## - - ## BE Receive SQL Result: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
| 10 | +{"message":"phoenix-partner - :: ## - - ## BE Receive SQL Result: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
| 11 | +{"message":"phoenix-partner - :: ## - session - 001bed68-f6d3-4b43-b955-5178249d3e81 ## BE Receive SQL Result: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
| 12 | +{"message":"phoenix-partner - :: ## - session - a78f627a-aef2-477a-ac52-d144167170f1 ## BE Receive SQL Result: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | |
| 13 | +{"message":"phoenix-partner - :: ## - session - 85a0f68c-6543-4db9-9bb3-8f25a6597cb0 ## BE Send SQL Query: {\"table\":\"get_spwHashtags\"}","level":"info"} | |
| 14 | +{"message":"phoenix-partner - :: ## - session - 85a0f68c-6543-4db9-9bb3-8f25a6597cb0 ## BE Receive SQL Result: [{\"table\":\"get_spwHashtags\",\"value\":\"bbb\"}]","level":"info"} | ... | ... |
| 1 | +++ a/logs/express-project | ... | ... |
| 1 | +++ a/node_modules/.bin/har-validator | |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +#!/bin/sh | |
| 2 | +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | |
| 3 | + | |
| 4 | +case `uname` in | |
| 5 | + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; | |
| 6 | +esac | |
| 7 | + | |
| 8 | +if [ -x "$basedir/node" ]; then | |
| 9 | + "$basedir/node" "$basedir/../har-validator/bin/har-validator" "$@" | |
| 10 | + ret=$? | |
| 11 | +else | |
| 12 | + node "$basedir/../har-validator/bin/har-validator" "$@" | |
| 13 | + ret=$? | |
| 14 | +fi | |
| 15 | +exit $ret | ... | ... |
| 1 | +++ a/node_modules/.bin/har-validator.cmd | |
| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | +@IF EXIST "%~dp0\node.exe" ( | |
| 2 | + "%~dp0\node.exe" "%~dp0\..\har-validator\bin\har-validator" %* | |
| 3 | +) ELSE ( | |
| 4 | + @SETLOCAL | |
| 5 | + @SET PATHEXT=%PATHEXT:;.JS;=;% | |
| 6 | + node "%~dp0\..\har-validator\bin\har-validator" %* | |
| 7 | +) | |
| 0 | 8 | \ No newline at end of file | ... | ... |
| 1 | +++ a/node_modules/.bin/mime | |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +#!/bin/sh | |
| 2 | +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | |
| 3 | + | |
| 4 | +case `uname` in | |
| 5 | + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; | |
| 6 | +esac | |
| 7 | + | |
| 8 | +if [ -x "$basedir/node" ]; then | |
| 9 | + "$basedir/node" "$basedir/../mime/cli.js" "$@" | |
| 10 | + ret=$? | |
| 11 | +else | |
| 12 | + node "$basedir/../mime/cli.js" "$@" | |
| 13 | + ret=$? | |
| 14 | +fi | |
| 15 | +exit $ret | ... | ... |
| 1 | +++ a/node_modules/.bin/mkdirp | |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +#!/bin/sh | |
| 2 | +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | |
| 3 | + | |
| 4 | +case `uname` in | |
| 5 | + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; | |
| 6 | +esac | |
| 7 | + | |
| 8 | +if [ -x "$basedir/node" ]; then | |
| 9 | + "$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@" | |
| 10 | + ret=$? | |
| 11 | +else | |
| 12 | + node "$basedir/../mkdirp/bin/cmd.js" "$@" | |
| 13 | + ret=$? | |
| 14 | +fi | |
| 15 | +exit $ret | ... | ... |
| 1 | +++ a/node_modules/.bin/semver | |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +#!/bin/sh | |
| 2 | +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | |
| 3 | + | |
| 4 | +case `uname` in | |
| 5 | + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; | |
| 6 | +esac | |
| 7 | + | |
| 8 | +if [ -x "$basedir/node" ]; then | |
| 9 | + "$basedir/node" "$basedir/../semver/bin/semver" "$@" | |
| 10 | + ret=$? | |
| 11 | +else | |
| 12 | + node "$basedir/../semver/bin/semver" "$@" | |
| 13 | + ret=$? | |
| 14 | +fi | |
| 15 | +exit $ret | ... | ... |
| 1 | +++ a/node_modules/.bin/sshpk-conv | |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +#!/bin/sh | |
| 2 | +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | |
| 3 | + | |
| 4 | +case `uname` in | |
| 5 | + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; | |
| 6 | +esac | |
| 7 | + | |
| 8 | +if [ -x "$basedir/node" ]; then | |
| 9 | + "$basedir/node" "$basedir/../sshpk/bin/sshpk-conv" "$@" | |
| 10 | + ret=$? | |
| 11 | +else | |
| 12 | + node "$basedir/../sshpk/bin/sshpk-conv" "$@" | |
| 13 | + ret=$? | |
| 14 | +fi | |
| 15 | +exit $ret | ... | ... |
| 1 | +++ a/node_modules/.bin/sshpk-conv.cmd | |
| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | +@IF EXIST "%~dp0\node.exe" ( | |
| 2 | + "%~dp0\node.exe" "%~dp0\..\sshpk\bin\sshpk-conv" %* | |
| 3 | +) ELSE ( | |
| 4 | + @SETLOCAL | |
| 5 | + @SET PATHEXT=%PATHEXT:;.JS;=;% | |
| 6 | + node "%~dp0\..\sshpk\bin\sshpk-conv" %* | |
| 7 | +) | |
| 0 | 8 | \ No newline at end of file | ... | ... |
| 1 | +++ a/node_modules/.bin/sshpk-sign | |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +#!/bin/sh | |
| 2 | +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | |
| 3 | + | |
| 4 | +case `uname` in | |
| 5 | + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; | |
| 6 | +esac | |
| 7 | + | |
| 8 | +if [ -x "$basedir/node" ]; then | |
| 9 | + "$basedir/node" "$basedir/../sshpk/bin/sshpk-sign" "$@" | |
| 10 | + ret=$? | |
| 11 | +else | |
| 12 | + node "$basedir/../sshpk/bin/sshpk-sign" "$@" | |
| 13 | + ret=$? | |
| 14 | +fi | |
| 15 | +exit $ret | ... | ... |
| 1 | +++ a/node_modules/.bin/sshpk-sign.cmd | |
| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | +@IF EXIST "%~dp0\node.exe" ( | |
| 2 | + "%~dp0\node.exe" "%~dp0\..\sshpk\bin\sshpk-sign" %* | |
| 3 | +) ELSE ( | |
| 4 | + @SETLOCAL | |
| 5 | + @SET PATHEXT=%PATHEXT:;.JS;=;% | |
| 6 | + node "%~dp0\..\sshpk\bin\sshpk-sign" %* | |
| 7 | +) | |
| 0 | 8 | \ No newline at end of file | ... | ... |
| 1 | +++ a/node_modules/.bin/sshpk-verify | |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +#!/bin/sh | |
| 2 | +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | |
| 3 | + | |
| 4 | +case `uname` in | |
| 5 | + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; | |
| 6 | +esac | |
| 7 | + | |
| 8 | +if [ -x "$basedir/node" ]; then | |
| 9 | + "$basedir/node" "$basedir/../sshpk/bin/sshpk-verify" "$@" | |
| 10 | + ret=$? | |
| 11 | +else | |
| 12 | + node "$basedir/../sshpk/bin/sshpk-verify" "$@" | |
| 13 | + ret=$? | |
| 14 | +fi | |
| 15 | +exit $ret | ... | ... |
| 1 | +++ a/node_modules/.bin/sshpk-verify.cmd | |
| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | +@IF EXIST "%~dp0\node.exe" ( | |
| 2 | + "%~dp0\node.exe" "%~dp0\..\sshpk\bin\sshpk-verify" %* | |
| 3 | +) ELSE ( | |
| 4 | + @SETLOCAL | |
| 5 | + @SET PATHEXT=%PATHEXT:;.JS;=;% | |
| 6 | + node "%~dp0\..\sshpk\bin\sshpk-verify" %* | |
| 7 | +) | |
| 0 | 8 | \ No newline at end of file | ... | ... |
| 1 | +++ a/node_modules/.bin/uglifyjs | |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +#!/bin/sh | |
| 2 | +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | |
| 3 | + | |
| 4 | +case `uname` in | |
| 5 | + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; | |
| 6 | +esac | |
| 7 | + | |
| 8 | +if [ -x "$basedir/node" ]; then | |
| 9 | + "$basedir/node" "$basedir/../uglify-js/bin/uglifyjs" "$@" | |
| 10 | + ret=$? | |
| 11 | +else | |
| 12 | + node "$basedir/../uglify-js/bin/uglifyjs" "$@" | |
| 13 | + ret=$? | |
| 14 | +fi | |
| 15 | +exit $ret | ... | ... |
| 1 | +++ a/node_modules/.bin/uglifyjs.cmd | |
| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | +@IF EXIST "%~dp0\node.exe" ( | |
| 2 | + "%~dp0\node.exe" "%~dp0\..\uglify-js\bin\uglifyjs" %* | |
| 3 | +) ELSE ( | |
| 4 | + @SETLOCAL | |
| 5 | + @SET PATHEXT=%PATHEXT:;.JS;=;% | |
| 6 | + node "%~dp0\..\uglify-js\bin\uglifyjs" %* | |
| 7 | +) | |
| 0 | 8 | \ No newline at end of file | ... | ... |
| 1 | +++ a/node_modules/.bin/uuid | |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +#!/bin/sh | |
| 2 | +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | |
| 3 | + | |
| 4 | +case `uname` in | |
| 5 | + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; | |
| 6 | +esac | |
| 7 | + | |
| 8 | +if [ -x "$basedir/node" ]; then | |
| 9 | + "$basedir/node" "$basedir/../uuid/bin/uuid" "$@" | |
| 10 | + ret=$? | |
| 11 | +else | |
| 12 | + node "$basedir/../uuid/bin/uuid" "$@" | |
| 13 | + ret=$? | |
| 14 | +fi | |
| 15 | +exit $ret | ... | ... |
| 1 | +++ a/node_modules/@sindresorhus/is/dist/example.d.ts | ... | ... |
| 1 | +++ a/node_modules/@sindresorhus/is/dist/index.d.ts | |
| ... | ... | @@ -0,0 +1,95 @@ |
| 1 | +/// <reference types="node" /> | |
| 2 | +export declare const enum TypeName { | |
| 3 | + null = "null", | |
| 4 | + boolean = "boolean", | |
| 5 | + undefined = "undefined", | |
| 6 | + string = "string", | |
| 7 | + number = "number", | |
| 8 | + symbol = "symbol", | |
| 9 | + Function = "Function", | |
| 10 | + Array = "Array", | |
| 11 | + Buffer = "Buffer", | |
| 12 | + Object = "Object", | |
| 13 | + RegExp = "RegExp", | |
| 14 | + Date = "Date", | |
| 15 | + Error = "Error", | |
| 16 | + Map = "Map", | |
| 17 | + Set = "Set", | |
| 18 | + WeakMap = "WeakMap", | |
| 19 | + WeakSet = "WeakSet", | |
| 20 | + Int8Array = "Int8Array", | |
| 21 | + Uint8Array = "Uint8Array", | |
| 22 | + Uint8ClampedArray = "Uint8ClampedArray", | |
| 23 | + Int16Array = "Int16Array", | |
| 24 | + Uint16Array = "Uint16Array", | |
| 25 | + Int32Array = "Int32Array", | |
| 26 | + Uint32Array = "Uint32Array", | |
| 27 | + Float32Array = "Float32Array", | |
| 28 | + Float64Array = "Float64Array", | |
| 29 | + ArrayBuffer = "ArrayBuffer", | |
| 30 | + SharedArrayBuffer = "SharedArrayBuffer", | |
| 31 | + DataView = "DataView", | |
| 32 | + Promise = "Promise", | |
| 33 | +} | |
| 34 | +declare function is(value: any): TypeName; | |
| 35 | +declare namespace is { | |
| 36 | + const undefined: (value: any) => boolean; | |
| 37 | + const string: (value: any) => boolean; | |
| 38 | + const number: (value: any) => boolean; | |
| 39 | + const function_: (value: any) => boolean; | |
| 40 | + const null_: (value: any) => boolean; | |
| 41 | + const class_: (value: any) => any; | |
| 42 | + const boolean: (value: any) => boolean; | |
| 43 | + const symbol: (value: any) => boolean; | |
| 44 | + const array: (arg: any) => arg is any[]; | |
| 45 | + const buffer: (obj: any) => obj is Buffer; | |
| 46 | + const nullOrUndefined: (value: any) => boolean; | |
| 47 | + const object: (value: any) => boolean; | |
| 48 | + const iterable: (value: any) => boolean; | |
| 49 | + const generator: (value: any) => boolean; | |
| 50 | + const nativePromise: (value: any) => boolean; | |
| 51 | + const promise: (value: any) => boolean; | |
| 52 | + const generatorFunction: (value: any) => boolean; | |
| 53 | + const asyncFunction: (value: any) => boolean; | |
| 54 | + const boundFunction: (value: any) => boolean; | |
| 55 | + const regExp: (value: any) => boolean; | |
| 56 | + const date: (value: any) => boolean; | |
| 57 | + const error: (value: any) => boolean; | |
| 58 | + const map: (value: any) => boolean; | |
| 59 | + const set: (value: any) => boolean; | |
| 60 | + const weakMap: (value: any) => boolean; | |
| 61 | + const weakSet: (value: any) => boolean; | |
| 62 | + const int8Array: (value: any) => boolean; | |
| 63 | + const uint8Array: (value: any) => boolean; | |
| 64 | + const uint8ClampedArray: (value: any) => boolean; | |
| 65 | + const int16Array: (value: any) => boolean; | |
| 66 | + const uint16Array: (value: any) => boolean; | |
| 67 | + const int32Array: (value: any) => boolean; | |
| 68 | + const uint32Array: (value: any) => boolean; | |
| 69 | + const float32Array: (value: any) => boolean; | |
| 70 | + const float64Array: (value: any) => boolean; | |
| 71 | + const arrayBuffer: (value: any) => boolean; | |
| 72 | + const sharedArrayBuffer: (value: any) => boolean; | |
| 73 | + const dataView: (value: any) => boolean; | |
| 74 | + const directInstanceOf: (instance: any, klass: any) => boolean; | |
| 75 | + const truthy: (value: any) => boolean; | |
| 76 | + const falsy: (value: any) => boolean; | |
| 77 | + const nan: (value: any) => boolean; | |
| 78 | + const primitive: (value: any) => boolean; | |
| 79 | + const integer: (value: any) => boolean; | |
| 80 | + const safeInteger: (value: any) => boolean; | |
| 81 | + const plainObject: (value: any) => boolean; | |
| 82 | + const typedArray: (value: any) => boolean; | |
| 83 | + const arrayLike: (value: any) => boolean; | |
| 84 | + const inRange: (value: number, range: number | number[]) => boolean; | |
| 85 | + const domElement: (value: any) => boolean; | |
| 86 | + const nodeStream: (value: any) => boolean; | |
| 87 | + const infinite: (value: any) => boolean; | |
| 88 | + const even: (rem: number) => boolean; | |
| 89 | + const odd: (rem: number) => boolean; | |
| 90 | + const empty: (value: any) => boolean; | |
| 91 | + const emptyOrWhitespace: (value: any) => boolean; | |
| 92 | + function any(...predicate: any[]): any; | |
| 93 | + function all(...predicate: any[]): any; | |
| 94 | +} | |
| 95 | +export default is; | ... | ... |
| 1 | +++ a/node_modules/@sindresorhus/is/dist/index.js | |
| ... | ... | @@ -0,0 +1,215 @@ |
| 1 | +"use strict"; | |
| 2 | +Object.defineProperty(exports, "__esModule", { value: true }); | |
| 3 | +const util = require("util"); | |
| 4 | +const toString = Object.prototype.toString; | |
| 5 | +const isOfType = (type) => (value) => typeof value === type; // tslint:disable-line:strict-type-predicates | |
| 6 | +const getObjectType = (value) => { | |
| 7 | + const objectName = toString.call(value).slice(8, -1); | |
| 8 | + if (objectName) { | |
| 9 | + return objectName; | |
| 10 | + } | |
| 11 | + return null; | |
| 12 | +}; | |
| 13 | +const isObjectOfType = (typeName) => (value) => { | |
| 14 | + return getObjectType(value) === typeName; | |
| 15 | +}; | |
| 16 | +function is(value) { | |
| 17 | + if (value === null) { | |
| 18 | + return "null" /* null */; | |
| 19 | + } | |
| 20 | + if (value === true || value === false) { | |
| 21 | + return "boolean" /* boolean */; | |
| 22 | + } | |
| 23 | + const type = typeof value; | |
| 24 | + if (type === 'undefined') { | |
| 25 | + return "undefined" /* undefined */; | |
| 26 | + } | |
| 27 | + if (type === 'string') { | |
| 28 | + return "string" /* string */; | |
| 29 | + } | |
| 30 | + if (type === 'number') { | |
| 31 | + return "number" /* number */; | |
| 32 | + } | |
| 33 | + if (type === 'symbol') { | |
| 34 | + return "symbol" /* symbol */; | |
| 35 | + } | |
| 36 | + if (is.function_(value)) { | |
| 37 | + return "Function" /* Function */; | |
| 38 | + } | |
| 39 | + if (Array.isArray(value)) { | |
| 40 | + return "Array" /* Array */; | |
| 41 | + } | |
| 42 | + if (Buffer.isBuffer(value)) { | |
| 43 | + return "Buffer" /* Buffer */; | |
| 44 | + } | |
| 45 | + const tagType = getObjectType(value); | |
| 46 | + if (tagType) { | |
| 47 | + return tagType; | |
| 48 | + } | |
| 49 | + if (value instanceof String || value instanceof Boolean || value instanceof Number) { | |
| 50 | + throw new TypeError('Please don\'t use object wrappers for primitive types'); | |
| 51 | + } | |
| 52 | + return "Object" /* Object */; | |
| 53 | +} | |
| 54 | +(function (is) { | |
| 55 | + const isObject = (value) => typeof value === 'object'; | |
| 56 | + // tslint:disable:variable-name | |
| 57 | + is.undefined = isOfType('undefined'); | |
| 58 | + is.string = isOfType('string'); | |
| 59 | + is.number = isOfType('number'); | |
| 60 | + is.function_ = isOfType('function'); | |
| 61 | + is.null_ = (value) => value === null; | |
| 62 | + is.class_ = (value) => is.function_(value) && value.toString().startsWith('class '); | |
| 63 | + is.boolean = (value) => value === true || value === false; | |
| 64 | + // tslint:enable:variable-name | |
| 65 | + is.symbol = isOfType('symbol'); | |
| 66 | + is.array = Array.isArray; | |
| 67 | + is.buffer = Buffer.isBuffer; | |
| 68 | + is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value); | |
| 69 | + is.object = (value) => !is.nullOrUndefined(value) && (is.function_(value) || isObject(value)); | |
| 70 | + is.iterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.iterator]); | |
| 71 | + is.generator = (value) => is.iterable(value) && is.function_(value.next) && is.function_(value.throw); | |
| 72 | + is.nativePromise = isObjectOfType("Promise" /* Promise */); | |
| 73 | + const hasPromiseAPI = (value) => !is.null_(value) && | |
| 74 | + isObject(value) && | |
| 75 | + is.function_(value.then) && | |
| 76 | + is.function_(value.catch); | |
| 77 | + is.promise = (value) => is.nativePromise(value) || hasPromiseAPI(value); | |
| 78 | + // TODO: Change to use `isObjectOfType` once Node.js 6 or higher is targeted | |
| 79 | + const isFunctionOfType = (type) => (value) => is.function_(value) && is.function_(value.constructor) && value.constructor.name === type; | |
| 80 | + is.generatorFunction = isFunctionOfType('GeneratorFunction'); | |
| 81 | + is.asyncFunction = isFunctionOfType('AsyncFunction'); | |
| 82 | + is.boundFunction = (value) => is.function_(value) && !value.hasOwnProperty('prototype'); | |
| 83 | + is.regExp = isObjectOfType("RegExp" /* RegExp */); | |
| 84 | + is.date = isObjectOfType("Date" /* Date */); | |
| 85 | + is.error = isObjectOfType("Error" /* Error */); | |
| 86 | + is.map = isObjectOfType("Map" /* Map */); | |
| 87 | + is.set = isObjectOfType("Set" /* Set */); | |
| 88 | + is.weakMap = isObjectOfType("WeakMap" /* WeakMap */); | |
| 89 | + is.weakSet = isObjectOfType("WeakSet" /* WeakSet */); | |
| 90 | + is.int8Array = isObjectOfType("Int8Array" /* Int8Array */); | |
| 91 | + is.uint8Array = isObjectOfType("Uint8Array" /* Uint8Array */); | |
| 92 | + is.uint8ClampedArray = isObjectOfType("Uint8ClampedArray" /* Uint8ClampedArray */); | |
| 93 | + is.int16Array = isObjectOfType("Int16Array" /* Int16Array */); | |
| 94 | + is.uint16Array = isObjectOfType("Uint16Array" /* Uint16Array */); | |
| 95 | + is.int32Array = isObjectOfType("Int32Array" /* Int32Array */); | |
| 96 | + is.uint32Array = isObjectOfType("Uint32Array" /* Uint32Array */); | |
| 97 | + is.float32Array = isObjectOfType("Float32Array" /* Float32Array */); | |
| 98 | + is.float64Array = isObjectOfType("Float64Array" /* Float64Array */); | |
| 99 | + is.arrayBuffer = isObjectOfType("ArrayBuffer" /* ArrayBuffer */); | |
| 100 | + is.sharedArrayBuffer = isObjectOfType("SharedArrayBuffer" /* SharedArrayBuffer */); | |
| 101 | + is.dataView = isObjectOfType("DataView" /* DataView */); | |
| 102 | + // TODO: Remove `object` checks when targeting ES2015 or higher | |
| 103 | + // See `Notes`: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf | |
| 104 | + is.directInstanceOf = (instance, klass) => is.object(instance) && is.object(klass) && Object.getPrototypeOf(instance) === klass.prototype; | |
| 105 | + is.truthy = (value) => Boolean(value); | |
| 106 | + is.falsy = (value) => !value; | |
| 107 | + is.nan = (value) => Number.isNaN(value); | |
| 108 | + const primitiveTypes = new Set([ | |
| 109 | + 'undefined', | |
| 110 | + 'string', | |
| 111 | + 'number', | |
| 112 | + 'boolean', | |
| 113 | + 'symbol' | |
| 114 | + ]); | |
| 115 | + is.primitive = (value) => is.null_(value) || primitiveTypes.has(typeof value); | |
| 116 | + is.integer = (value) => Number.isInteger(value); | |
| 117 | + is.safeInteger = (value) => Number.isSafeInteger(value); | |
| 118 | + is.plainObject = (value) => { | |
| 119 | + // From: https://github.com/sindresorhus/is-plain-obj/blob/master/index.js | |
| 120 | + let prototype; | |
| 121 | + return getObjectType(value) === "Object" /* Object */ && | |
| 122 | + (prototype = Object.getPrototypeOf(value), prototype === null || // tslint:disable-line:ban-comma-operator | |
| 123 | + prototype === Object.getPrototypeOf({})); | |
| 124 | + }; | |
| 125 | + const typedArrayTypes = new Set([ | |
| 126 | + "Int8Array" /* Int8Array */, | |
| 127 | + "Uint8Array" /* Uint8Array */, | |
| 128 | + "Uint8ClampedArray" /* Uint8ClampedArray */, | |
| 129 | + "Int16Array" /* Int16Array */, | |
| 130 | + "Uint16Array" /* Uint16Array */, | |
| 131 | + "Int32Array" /* Int32Array */, | |
| 132 | + "Uint32Array" /* Uint32Array */, | |
| 133 | + "Float32Array" /* Float32Array */, | |
| 134 | + "Float64Array" /* Float64Array */ | |
| 135 | + ]); | |
| 136 | + is.typedArray = (value) => { | |
| 137 | + const objectType = getObjectType(value); | |
| 138 | + if (objectType === null) { | |
| 139 | + return false; | |
| 140 | + } | |
| 141 | + return typedArrayTypes.has(objectType); | |
| 142 | + }; | |
| 143 | + const isValidLength = (value) => is.safeInteger(value) && value > -1; | |
| 144 | + is.arrayLike = (value) => !is.nullOrUndefined(value) && !is.function_(value) && isValidLength(value.length); | |
| 145 | + is.inRange = (value, range) => { | |
| 146 | + if (is.number(range)) { | |
| 147 | + return value >= Math.min(0, range) && value <= Math.max(range, 0); | |
| 148 | + } | |
| 149 | + if (is.array(range) && range.length === 2) { | |
| 150 | + // TODO: Use spread operator here when targeting Node.js 6 or higher | |
| 151 | + return value >= Math.min.apply(null, range) && value <= Math.max.apply(null, range); | |
| 152 | + } | |
| 153 | + throw new TypeError(`Invalid range: ${util.inspect(range)}`); | |
| 154 | + }; | |
| 155 | + const NODE_TYPE_ELEMENT = 1; | |
| 156 | + const DOM_PROPERTIES_TO_CHECK = [ | |
| 157 | + 'innerHTML', | |
| 158 | + 'ownerDocument', | |
| 159 | + 'style', | |
| 160 | + 'attributes', | |
| 161 | + 'nodeValue' | |
| 162 | + ]; | |
| 163 | + is.domElement = (value) => is.object(value) && value.nodeType === NODE_TYPE_ELEMENT && is.string(value.nodeName) && | |
| 164 | + !is.plainObject(value) && DOM_PROPERTIES_TO_CHECK.every(property => property in value); | |
| 165 | + is.nodeStream = (value) => !is.nullOrUndefined(value) && isObject(value) && is.function_(value.pipe); | |
| 166 | + is.infinite = (value) => value === Infinity || value === -Infinity; | |
| 167 | + const isAbsoluteMod2 = (value) => (rem) => is.integer(rem) && Math.abs(rem % 2) === value; | |
| 168 | + is.even = isAbsoluteMod2(0); | |
| 169 | + is.odd = isAbsoluteMod2(1); | |
| 170 | + const isWhiteSpaceString = (value) => is.string(value) && /\S/.test(value) === false; | |
| 171 | + const isEmptyStringOrArray = (value) => (is.string(value) || is.array(value)) && value.length === 0; | |
| 172 | + const isEmptyObject = (value) => !is.map(value) && !is.set(value) && is.object(value) && Object.keys(value).length === 0; | |
| 173 | + const isEmptyMapOrSet = (value) => (is.map(value) || is.set(value)) && value.size === 0; | |
| 174 | + is.empty = (value) => is.falsy(value) || isEmptyStringOrArray(value) || isEmptyObject(value) || isEmptyMapOrSet(value); | |
| 175 | + is.emptyOrWhitespace = (value) => is.empty(value) || isWhiteSpaceString(value); | |
| 176 | + const predicateOnArray = (method, predicate, args) => { | |
| 177 | + // `args` is the calling function's "arguments object". | |
| 178 | + // We have to do it this way to keep node v4 support. | |
| 179 | + // So here we convert it to an array and slice off the first item. | |
| 180 | + const values = Array.prototype.slice.call(args, 1); | |
| 181 | + if (is.function_(predicate) === false) { | |
| 182 | + throw new TypeError(`Invalid predicate: ${util.inspect(predicate)}`); | |
| 183 | + } | |
| 184 | + if (values.length === 0) { | |
| 185 | + throw new TypeError('Invalid number of values'); | |
| 186 | + } | |
| 187 | + return method.call(values, predicate); | |
| 188 | + }; | |
| 189 | + function any(predicate) { | |
| 190 | + return predicateOnArray(Array.prototype.some, predicate, arguments); | |
| 191 | + } | |
| 192 | + is.any = any; | |
| 193 | + function all(predicate) { | |
| 194 | + return predicateOnArray(Array.prototype.every, predicate, arguments); | |
| 195 | + } | |
| 196 | + is.all = all; | |
| 197 | + // tslint:enable:only-arrow-functions no-function-expression | |
| 198 | +})(is || (is = {})); | |
| 199 | +// Some few keywords are reserved, but we'll populate them for Node.js users | |
| 200 | +// See https://github.com/Microsoft/TypeScript/issues/2536 | |
| 201 | +Object.defineProperties(is, { | |
| 202 | + class: { | |
| 203 | + value: is.class_ | |
| 204 | + }, | |
| 205 | + function: { | |
| 206 | + value: is.function_ | |
| 207 | + }, | |
| 208 | + null: { | |
| 209 | + value: is.null_ | |
| 210 | + } | |
| 211 | +}); | |
| 212 | +exports.default = is; | |
| 213 | +// For CommonJS default export support | |
| 214 | +module.exports = is; | |
| 215 | +module.exports.default = is; | ... | ... |
| 1 | +++ a/node_modules/@sindresorhus/is/dist/index.js.map | |
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAE7B,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;AAC3C,MAAM,aAAa,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAW,CAAC;AAClF,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC;AACzE,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,KAAU,EAA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AG,EAAE,CAAC"} | |
| 0 | 2 | \ No newline at end of file | ... | ... |
| 1 | +++ a/node_modules/@sindresorhus/is/dist/source/index.d.ts | |
| ... | ... | @@ -0,0 +1,59 @@ |
| 1 | +/// <reference types="node" /> | |
| 2 | +declare function is(value: any): string; | |
| 3 | +declare namespace is { | |
| 4 | + const undefined: (value: any) => boolean; | |
| 5 | + const string: (value: any) => boolean; | |
| 6 | + const number: (value: any) => boolean; | |
| 7 | + const function_: (value: any) => boolean; | |
| 8 | + const null_: (value: any) => boolean; | |
| 9 | + const class_: (value: any) => any; | |
| 10 | + const boolean: (value: any) => boolean; | |
| 11 | + const symbol: (value: any) => boolean; | |
| 12 | + const array: (arg: any) => arg is any[]; | |
| 13 | + const buffer: (obj: any) => obj is Buffer; | |
| 14 | + const nullOrUndefined: (value: any) => boolean; | |
| 15 | + const object: (value: any) => boolean; | |
| 16 | + const iterable: (value: any) => boolean; | |
| 17 | + const generator: (value: any) => boolean; | |
| 18 | + const nativePromise: (value: any) => boolean; | |
| 19 | + const promise: (value: any) => boolean; | |
| 20 | + const generatorFunction: (value: any) => boolean; | |
| 21 | + const asyncFunction: (value: any) => boolean; | |
| 22 | + const regExp: (value: any) => boolean; | |
| 23 | + const date: (value: any) => boolean; | |
| 24 | + const error: (value: any) => boolean; | |
| 25 | + const map: (value: any) => boolean; | |
| 26 | + const set: (value: any) => boolean; | |
| 27 | + const weakMap: (value: any) => boolean; | |
| 28 | + const weakSet: (value: any) => boolean; | |
| 29 | + const int8Array: (value: any) => boolean; | |
| 30 | + const uint8Array: (value: any) => boolean; | |
| 31 | + const uint8ClampedArray: (value: any) => boolean; | |
| 32 | + const int16Array: (value: any) => boolean; | |
| 33 | + const uint16Array: (value: any) => boolean; | |
| 34 | + const int32Array: (value: any) => boolean; | |
| 35 | + const uint32Array: (value: any) => boolean; | |
| 36 | + const float32Array: (value: any) => boolean; | |
| 37 | + const float64Array: (value: any) => boolean; | |
| 38 | + const arrayBuffer: (value: any) => boolean; | |
| 39 | + const sharedArrayBuffer: (value: any) => boolean; | |
| 40 | + const truthy: (value: any) => boolean; | |
| 41 | + const falsy: (value: any) => boolean; | |
| 42 | + const nan: (value: any) => boolean; | |
| 43 | + const primitive: (value: any) => boolean; | |
| 44 | + const integer: (value: any) => boolean; | |
| 45 | + const safeInteger: (value: any) => boolean; | |
| 46 | + const plainObject: (value: any) => boolean; | |
| 47 | + const typedArray: (value: any) => boolean; | |
| 48 | + const arrayLike: (value: any) => boolean; | |
| 49 | + const inRange: (value: number, range: number | number[]) => boolean; | |
| 50 | + const domElement: (value: any) => boolean; | |
| 51 | + const infinite: (value: any) => boolean; | |
| 52 | + const even: (rem: number) => boolean; | |
| 53 | + const odd: (rem: number) => boolean; | |
| 54 | + const empty: (value: any) => boolean; | |
| 55 | + const emptyOrWhitespace: (value: any) => boolean; | |
| 56 | + function any(...predicate: any[]): any; | |
| 57 | + function all(...predicate: any[]): any; | |
| 58 | +} | |
| 59 | +export default is; | ... | ... |
| 1 | +++ a/node_modules/@sindresorhus/is/dist/source/index.js | |
| ... | ... | @@ -0,0 +1,182 @@ |
| 1 | +"use strict"; | |
| 2 | +Object.defineProperty(exports, "__esModule", { value: true }); | |
| 3 | +const util = require("util"); | |
| 4 | +const toString = Object.prototype.toString; | |
| 5 | +const getObjectType = (value) => toString.call(value).slice(8, -1); | |
| 6 | +const isOfType = (type) => (value) => typeof value === type; | |
| 7 | +const isObjectOfType = (type) => (value) => getObjectType(value) === type; | |
| 8 | +function is(value) { | |
| 9 | + if (value === null) { | |
| 10 | + return 'null'; | |
| 11 | + } | |
| 12 | + if (value === true || value === false) { | |
| 13 | + return 'boolean'; | |
| 14 | + } | |
| 15 | + const type = typeof value; | |
| 16 | + if (type === 'undefined') { | |
| 17 | + return 'undefined'; | |
| 18 | + } | |
| 19 | + if (type === 'string') { | |
| 20 | + return 'string'; | |
| 21 | + } | |
| 22 | + if (type === 'number') { | |
| 23 | + return 'number'; | |
| 24 | + } | |
| 25 | + if (type === 'symbol') { | |
| 26 | + return 'symbol'; | |
| 27 | + } | |
| 28 | + if (is.function_(value)) { | |
| 29 | + return 'Function'; | |
| 30 | + } | |
| 31 | + if (Array.isArray(value)) { | |
| 32 | + return 'Array'; | |
| 33 | + } | |
| 34 | + if (Buffer.isBuffer(value)) { | |
| 35 | + return 'Buffer'; | |
| 36 | + } | |
| 37 | + const tagType = getObjectType(value); | |
| 38 | + if (tagType) { | |
| 39 | + return tagType; | |
| 40 | + } | |
| 41 | + if (value instanceof String || value instanceof Boolean || value instanceof Number) { | |
| 42 | + throw new TypeError('Please don\'t use object wrappers for primitive types'); | |
| 43 | + } | |
| 44 | + return 'Object'; | |
| 45 | +} | |
| 46 | +(function (is) { | |
| 47 | + const isObject = (value) => typeof value === 'object'; | |
| 48 | + is.undefined = isOfType('undefined'); | |
| 49 | + is.string = isOfType('string'); | |
| 50 | + is.number = isOfType('number'); | |
| 51 | + is.function_ = isOfType('function'); | |
| 52 | + is.null_ = (value) => value === null; | |
| 53 | + is.class_ = (value) => is.function_(value) && value.toString().startsWith('class '); | |
| 54 | + is.boolean = (value) => value === true || value === false; | |
| 55 | + is.symbol = isOfType('symbol'); | |
| 56 | + is.array = Array.isArray; | |
| 57 | + is.buffer = Buffer.isBuffer; | |
| 58 | + is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value); | |
| 59 | + is.object = (value) => !is.nullOrUndefined(value) && (is.function_(value) || isObject(value)); | |
| 60 | + is.iterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.iterator]); | |
| 61 | + is.generator = (value) => is.iterable(value) && is.function_(value.next) && is.function_(value.throw); | |
| 62 | + is.nativePromise = isObjectOfType('Promise'); | |
| 63 | + const hasPromiseAPI = (value) => !is.null_(value) && | |
| 64 | + isObject(value) && | |
| 65 | + is.function_(value.then) && | |
| 66 | + is.function_(value.catch); | |
| 67 | + is.promise = (value) => is.nativePromise(value) || hasPromiseAPI(value); | |
| 68 | + const isFunctionOfType = (type) => (value) => is.function_(value) && is.function_(value.constructor) && value.constructor.name === type; | |
| 69 | + is.generatorFunction = isFunctionOfType('GeneratorFunction'); | |
| 70 | + is.asyncFunction = isFunctionOfType('AsyncFunction'); | |
| 71 | + is.regExp = isObjectOfType('RegExp'); | |
| 72 | + is.date = isObjectOfType('Date'); | |
| 73 | + is.error = isObjectOfType('Error'); | |
| 74 | + is.map = isObjectOfType('Map'); | |
| 75 | + is.set = isObjectOfType('Set'); | |
| 76 | + is.weakMap = isObjectOfType('WeakMap'); | |
| 77 | + is.weakSet = isObjectOfType('WeakSet'); | |
| 78 | + is.int8Array = isObjectOfType('Int8Array'); | |
| 79 | + is.uint8Array = isObjectOfType('Uint8Array'); | |
| 80 | + is.uint8ClampedArray = isObjectOfType('Uint8ClampedArray'); | |
| 81 | + is.int16Array = isObjectOfType('Int16Array'); | |
| 82 | + is.uint16Array = isObjectOfType('Uint16Array'); | |
| 83 | + is.int32Array = isObjectOfType('Int32Array'); | |
| 84 | + is.uint32Array = isObjectOfType('Uint32Array'); | |
| 85 | + is.float32Array = isObjectOfType('Float32Array'); | |
| 86 | + is.float64Array = isObjectOfType('Float64Array'); | |
| 87 | + is.arrayBuffer = isObjectOfType('ArrayBuffer'); | |
| 88 | + is.sharedArrayBuffer = isObjectOfType('SharedArrayBuffer'); | |
| 89 | + is.truthy = (value) => Boolean(value); | |
| 90 | + is.falsy = (value) => !value; | |
| 91 | + is.nan = (value) => Number.isNaN(value); | |
| 92 | + const primitiveTypes = new Set([ | |
| 93 | + 'undefined', | |
| 94 | + 'string', | |
| 95 | + 'number', | |
| 96 | + 'boolean', | |
| 97 | + 'symbol' | |
| 98 | + ]); | |
| 99 | + is.primitive = (value) => is.null_(value) || primitiveTypes.has(typeof value); | |
| 100 | + is.integer = (value) => Number.isInteger(value); | |
| 101 | + is.safeInteger = (value) => Number.isSafeInteger(value); | |
| 102 | + is.plainObject = (value) => { | |
| 103 | + let prototype; | |
| 104 | + return getObjectType(value) === 'Object' && | |
| 105 | + (prototype = Object.getPrototypeOf(value), prototype === null || | |
| 106 | + prototype === Object.getPrototypeOf({})); | |
| 107 | + }; | |
| 108 | + const typedArrayTypes = new Set([ | |
| 109 | + 'Int8Array', | |
| 110 | + 'Uint8Array', | |
| 111 | + 'Uint8ClampedArray', | |
| 112 | + 'Int16Array', | |
| 113 | + 'Uint16Array', | |
| 114 | + 'Int32Array', | |
| 115 | + 'Uint32Array', | |
| 116 | + 'Float32Array', | |
| 117 | + 'Float64Array' | |
| 118 | + ]); | |
| 119 | + is.typedArray = (value) => typedArrayTypes.has(getObjectType(value)); | |
| 120 | + const isValidLength = (value) => is.safeInteger(value) && value > -1; | |
| 121 | + is.arrayLike = (value) => !is.nullOrUndefined(value) && !is.function_(value) && isValidLength(value.length); | |
| 122 | + is.inRange = (value, range) => { | |
| 123 | + if (is.number(range)) { | |
| 124 | + return value >= Math.min(0, range) && value <= Math.max(range, 0); | |
| 125 | + } | |
| 126 | + if (is.array(range) && range.length === 2) { | |
| 127 | + return value >= Math.min.apply(null, range) && value <= Math.max.apply(null, range); | |
| 128 | + } | |
| 129 | + throw new TypeError(`Invalid range: ${util.inspect(range)}`); | |
| 130 | + }; | |
| 131 | + const NODE_TYPE_ELEMENT = 1; | |
| 132 | + const DOM_PROPERTIES_TO_CHECK = [ | |
| 133 | + 'innerHTML', | |
| 134 | + 'ownerDocument', | |
| 135 | + 'style', | |
| 136 | + 'attributes', | |
| 137 | + 'nodeValue' | |
| 138 | + ]; | |
| 139 | + is.domElement = (value) => is.object(value) && value.nodeType === NODE_TYPE_ELEMENT && is.string(value.nodeName) && | |
| 140 | + !is.plainObject(value) && DOM_PROPERTIES_TO_CHECK.every(property => property in value); | |
| 141 | + is.infinite = (value) => value === Infinity || value === -Infinity; | |
| 142 | + const isAbsoluteMod2 = (value) => (rem) => is.integer(rem) && Math.abs(rem % 2) === value; | |
| 143 | + is.even = isAbsoluteMod2(0); | |
| 144 | + is.odd = isAbsoluteMod2(1); | |
| 145 | + const isWhiteSpaceString = (value) => is.string(value) && /\S/.test(value) === false; | |
| 146 | + const isEmptyStringOrArray = (value) => (is.string(value) || is.array(value)) && value.length === 0; | |
| 147 | + const isEmptyObject = (value) => !is.map(value) && !is.set(value) && is.object(value) && Object.keys(value).length === 0; | |
| 148 | + const isEmptyMapOrSet = (value) => (is.map(value) || is.set(value)) && value.size === 0; | |
| 149 | + is.empty = (value) => is.falsy(value) || isEmptyStringOrArray(value) || isEmptyObject(value) || isEmptyMapOrSet(value); | |
| 150 | + is.emptyOrWhitespace = (value) => is.empty(value) || isWhiteSpaceString(value); | |
| 151 | + const predicateOnArray = (method, predicate, args) => { | |
| 152 | + const values = Array.prototype.slice.call(args, 1); | |
| 153 | + if (is.function_(predicate) === false) { | |
| 154 | + throw new TypeError(`Invalid predicate: ${util.inspect(predicate)}`); | |
| 155 | + } | |
| 156 | + if (values.length === 0) { | |
| 157 | + throw new TypeError('Invalid number of values'); | |
| 158 | + } | |
| 159 | + return method.call(values, predicate); | |
| 160 | + }; | |
| 161 | + function any(predicate) { | |
| 162 | + return predicateOnArray(Array.prototype.some, predicate, arguments); | |
| 163 | + } | |
| 164 | + is.any = any; | |
| 165 | + function all(predicate) { | |
| 166 | + return predicateOnArray(Array.prototype.every, predicate, arguments); | |
| 167 | + } | |
| 168 | + is.all = all; | |
| 169 | +})(is || (is = {})); | |
| 170 | +Object.defineProperties(is, { | |
| 171 | + class: { | |
| 172 | + value: is.class_ | |
| 173 | + }, | |
| 174 | + function: { | |
| 175 | + value: is.function_ | |
| 176 | + }, | |
| 177 | + null: { | |
| 178 | + value: is.null_ | |
| 179 | + } | |
| 180 | +}); | |
| 181 | +exports.default = is; | |
| 182 | +//# sourceMappingURL=index.js.map | |
| 0 | 183 | \ No newline at end of file | ... | ... |
| 1 | +++ a/node_modules/@sindresorhus/is/dist/source/index.js.map | |
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/index.ts"],"names":[],"mappings":";;AAAA,6BAA6B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ElB,CAAA;AAEF,CAAC,EA9KS,EAAE,KAAF,EAAE,QA8KX;AAID,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE;IAC3B,KAAK,EAAE;QACN,KAAK,EAAE,EAAE,CAAC,MAAM;KAChB;IACD,QAAQ,EAAE;QACT,KAAK,EAAE,EAAE,CAAC,SAAS;KACnB;IACD,IAAI,EAAE;QACL,KAAK,EAAE,EAAE,CAAC,KAAK;KACf;CACD,CAAC,CAAC;AAEH,kBAAe,EAAE,CAAC"} | |
| 0 | 2 | \ No newline at end of file | ... | ... |
node_modules/@sindresorhus/is/dist/source/tests/test.d.ts
0 → 100644
| 1 | +++ a/node_modules/@sindresorhus/is/dist/source/tests/test.d.ts | ... | ... |
| 1 | +++ a/node_modules/@sindresorhus/is/dist/source/tests/test.js | |
| ... | ... | @@ -0,0 +1,622 @@ |
| 1 | +"use strict"; | |
| 2 | +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | |
| 3 | + return new (P || (P = Promise))(function (resolve, reject) { | |
| 4 | + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | |
| 5 | + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | |
| 6 | + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | |
| 7 | + step((generator = generator.apply(thisArg, _arguments || [])).next()); | |
| 8 | + }); | |
| 9 | +}; | |
| 10 | +Object.defineProperty(exports, "__esModule", { value: true }); | |
| 11 | +const util = require("util"); | |
| 12 | +const ava_1 = require("ava"); | |
| 13 | +const jsdom_1 = require("jsdom"); | |
| 14 | +const __1 = require(".."); | |
| 15 | +const isNode8orHigher = Number(process.versions.node.split('.')[0]) >= 8; | |
| 16 | +class ErrorSubclassFixture extends Error { | |
| 17 | +} | |
| 18 | +const document = jsdom_1.jsdom(); | |
| 19 | +const createDomElement = (el) => document.createElement(el); | |
| 20 | +const types = new Map([ | |
| 21 | + ['undefined', { | |
| 22 | + is: __1.default.undefined, | |
| 23 | + fixtures: [ | |
| 24 | + undefined | |
| 25 | + ] | |
| 26 | + }], | |
| 27 | + ['null', { | |
| 28 | + is: __1.default.null_, | |
| 29 | + fixtures: [ | |
| 30 | + null | |
| 31 | + ] | |
| 32 | + }], | |
| 33 | + ['string', { | |
| 34 | + is: __1.default.string, | |
| 35 | + fixtures: [ | |
| 36 | + '🦄', | |
| 37 | + 'hello world', | |
| 38 | + '' | |
| 39 | + ] | |
| 40 | + }], | |
| 41 | + ['number', { | |
| 42 | + is: __1.default.number, | |
| 43 | + fixtures: [ | |
| 44 | + 6, | |
| 45 | + 1.4, | |
| 46 | + 0, | |
| 47 | + -0, | |
| 48 | + Infinity, | |
| 49 | + -Infinity | |
| 50 | + ] | |
| 51 | + }], | |
| 52 | + ['boolean', { | |
| 53 | + is: __1.default.boolean, | |
| 54 | + fixtures: [ | |
| 55 | + true, false | |
| 56 | + ] | |
| 57 | + }], | |
| 58 | + ['symbol', { | |
| 59 | + is: __1.default.symbol, | |
| 60 | + fixtures: [ | |
| 61 | + Symbol('🦄') | |
| 62 | + ] | |
| 63 | + }], | |
| 64 | + ['array', { | |
| 65 | + is: __1.default.array, | |
| 66 | + fixtures: [ | |
| 67 | + [1, 2], | |
| 68 | + new Array(2) | |
| 69 | + ] | |
| 70 | + }], | |
| 71 | + ['function', { | |
| 72 | + is: __1.default.function_, | |
| 73 | + fixtures: [ | |
| 74 | + function foo() { }, | |
| 75 | + function () { }, | |
| 76 | + () => { }, | |
| 77 | + function () { | |
| 78 | + return __awaiter(this, void 0, void 0, function* () { }); | |
| 79 | + }, | |
| 80 | + function* () { } | |
| 81 | + ] | |
| 82 | + }], | |
| 83 | + ['buffer', { | |
| 84 | + is: __1.default.buffer, | |
| 85 | + fixtures: [ | |
| 86 | + Buffer.from('🦄') | |
| 87 | + ] | |
| 88 | + }], | |
| 89 | + ['object', { | |
| 90 | + is: __1.default.object, | |
| 91 | + fixtures: [ | |
| 92 | + { x: 1 }, | |
| 93 | + Object.create({ x: 1 }) | |
| 94 | + ] | |
| 95 | + }], | |
| 96 | + ['regExp', { | |
| 97 | + is: __1.default.regExp, | |
| 98 | + fixtures: [ | |
| 99 | + /\w/, | |
| 100 | + new RegExp('\\w') | |
| 101 | + ] | |
| 102 | + }], | |
| 103 | + ['date', { | |
| 104 | + is: __1.default.date, | |
| 105 | + fixtures: [ | |
| 106 | + new Date() | |
| 107 | + ] | |
| 108 | + }], | |
| 109 | + ['error', { | |
| 110 | + is: __1.default.error, | |
| 111 | + fixtures: [ | |
| 112 | + new Error('🦄'), | |
| 113 | + new ErrorSubclassFixture() | |
| 114 | + ] | |
| 115 | + }], | |
| 116 | + ['nativePromise', { | |
| 117 | + is: __1.default.nativePromise, | |
| 118 | + fixtures: [ | |
| 119 | + Promise.resolve(), | |
| 120 | + ] | |
| 121 | + }], | |
| 122 | + ['promise', { | |
| 123 | + is: __1.default.promise, | |
| 124 | + fixtures: [ | |
| 125 | + { then() { }, catch() { } } | |
| 126 | + ] | |
| 127 | + }], | |
| 128 | + ['generator', { | |
| 129 | + is: __1.default.generator, | |
| 130 | + fixtures: [ | |
| 131 | + (function* () { yield 4; })() | |
| 132 | + ] | |
| 133 | + }], | |
| 134 | + ['generatorFunction', { | |
| 135 | + is: __1.default.generatorFunction, | |
| 136 | + fixtures: [ | |
| 137 | + function* () { yield 4; } | |
| 138 | + ] | |
| 139 | + }], | |
| 140 | + ['asyncFunction', { | |
| 141 | + is: __1.default.asyncFunction, | |
| 142 | + fixtures: [ | |
| 143 | + function () { | |
| 144 | + return __awaiter(this, void 0, void 0, function* () { }); | |
| 145 | + }, | |
| 146 | + () => __awaiter(this, void 0, void 0, function* () { }) | |
| 147 | + ] | |
| 148 | + }], | |
| 149 | + ['map', { | |
| 150 | + is: __1.default.map, | |
| 151 | + fixtures: [ | |
| 152 | + new Map() | |
| 153 | + ] | |
| 154 | + }], | |
| 155 | + ['set', { | |
| 156 | + is: __1.default.set, | |
| 157 | + fixtures: [ | |
| 158 | + new Set() | |
| 159 | + ] | |
| 160 | + }], | |
| 161 | + ['weakSet', { | |
| 162 | + is: __1.default.weakSet, | |
| 163 | + fixtures: [ | |
| 164 | + new WeakSet() | |
| 165 | + ] | |
| 166 | + }], | |
| 167 | + ['weakMap', { | |
| 168 | + is: __1.default.weakMap, | |
| 169 | + fixtures: [ | |
| 170 | + new WeakMap() | |
| 171 | + ] | |
| 172 | + }], | |
| 173 | + ['int8Array', { | |
| 174 | + is: __1.default.int8Array, | |
| 175 | + fixtures: [ | |
| 176 | + new Int8Array(0) | |
| 177 | + ] | |
| 178 | + }], | |
| 179 | + ['uint8Array', { | |
| 180 | + is: __1.default.uint8Array, | |
| 181 | + fixtures: [ | |
| 182 | + new Uint8Array(0) | |
| 183 | + ] | |
| 184 | + }], | |
| 185 | + ['uint8ClampedArray', { | |
| 186 | + is: __1.default.uint8ClampedArray, | |
| 187 | + fixtures: [ | |
| 188 | + new Uint8ClampedArray(0) | |
| 189 | + ] | |
| 190 | + }], | |
| 191 | + ['int16Array', { | |
| 192 | + is: __1.default.int16Array, | |
| 193 | + fixtures: [ | |
| 194 | + new Int16Array(0) | |
| 195 | + ] | |
| 196 | + }], | |
| 197 | + ['uint16Array', { | |
| 198 | + is: __1.default.uint16Array, | |
| 199 | + fixtures: [ | |
| 200 | + new Uint16Array(0) | |
| 201 | + ] | |
| 202 | + }], | |
| 203 | + ['int32Array', { | |
| 204 | + is: __1.default.int32Array, | |
| 205 | + fixtures: [ | |
| 206 | + new Int32Array(0) | |
| 207 | + ] | |
| 208 | + }], | |
| 209 | + ['uint32Array', { | |
| 210 | + is: __1.default.uint32Array, | |
| 211 | + fixtures: [ | |
| 212 | + new Uint32Array(0) | |
| 213 | + ] | |
| 214 | + }], | |
| 215 | + ['float32Array', { | |
| 216 | + is: __1.default.float32Array, | |
| 217 | + fixtures: [ | |
| 218 | + new Float32Array(0) | |
| 219 | + ] | |
| 220 | + }], | |
| 221 | + ['float64Array', { | |
| 222 | + is: __1.default.float64Array, | |
| 223 | + fixtures: [ | |
| 224 | + new Float64Array(0) | |
| 225 | + ] | |
| 226 | + }], | |
| 227 | + ['arrayBuffer', { | |
| 228 | + is: __1.default.arrayBuffer, | |
| 229 | + fixtures: [ | |
| 230 | + new ArrayBuffer(10) | |
| 231 | + ] | |
| 232 | + }], | |
| 233 | + ['nan', { | |
| 234 | + is: __1.default.nan, | |
| 235 | + fixtures: [ | |
| 236 | + NaN, | |
| 237 | + Number.NaN | |
| 238 | + ] | |
| 239 | + }], | |
| 240 | + ['nullOrUndefined', { | |
| 241 | + is: __1.default.nullOrUndefined, | |
| 242 | + fixtures: [ | |
| 243 | + null, | |
| 244 | + undefined | |
| 245 | + ] | |
| 246 | + }], | |
| 247 | + ['plainObject', { | |
| 248 | + is: __1.default.plainObject, | |
| 249 | + fixtures: [ | |
| 250 | + { x: 1 }, | |
| 251 | + Object.create(null), | |
| 252 | + new Object() | |
| 253 | + ] | |
| 254 | + }], | |
| 255 | + ['integer', { | |
| 256 | + is: __1.default.integer, | |
| 257 | + fixtures: [ | |
| 258 | + 6 | |
| 259 | + ] | |
| 260 | + }], | |
| 261 | + ['safeInteger', { | |
| 262 | + is: __1.default.safeInteger, | |
| 263 | + fixtures: [ | |
| 264 | + Math.pow(2, 53) - 1, | |
| 265 | + -Math.pow(2, 53) + 1 | |
| 266 | + ] | |
| 267 | + }], | |
| 268 | + ['domElement', { | |
| 269 | + is: __1.default.domElement, | |
| 270 | + fixtures: [ | |
| 271 | + 'div', | |
| 272 | + 'input', | |
| 273 | + 'span', | |
| 274 | + 'img', | |
| 275 | + 'canvas', | |
| 276 | + 'script' | |
| 277 | + ].map(createDomElement) | |
| 278 | + } | |
| 279 | + ], ['non-domElements', { | |
| 280 | + is: value => !__1.default.domElement(value), | |
| 281 | + fixtures: [ | |
| 282 | + document.createTextNode('data'), | |
| 283 | + document.createProcessingInstruction('xml-stylesheet', 'href="mycss.css" type="text/css"'), | |
| 284 | + document.createComment('This is a comment'), | |
| 285 | + document, | |
| 286 | + document.implementation.createDocumentType('svg:svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'), | |
| 287 | + document.createDocumentFragment() | |
| 288 | + ] | |
| 289 | + }], | |
| 290 | + ['infinite', { | |
| 291 | + is: __1.default.infinite, | |
| 292 | + fixtures: [ | |
| 293 | + Infinity, | |
| 294 | + -Infinity | |
| 295 | + ] | |
| 296 | + }] | |
| 297 | +]); | |
| 298 | +const testType = (t, type, exclude) => { | |
| 299 | + const testData = types.get(type); | |
| 300 | + if (testData === undefined) { | |
| 301 | + t.fail(`is.${type} not defined`); | |
| 302 | + return; | |
| 303 | + } | |
| 304 | + const { is } = testData; | |
| 305 | + for (const [key, { fixtures }] of types) { | |
| 306 | + if (exclude && exclude.indexOf(key) !== -1) { | |
| 307 | + continue; | |
| 308 | + } | |
| 309 | + const assert = key === type ? t.true.bind(t) : t.false.bind(t); | |
| 310 | + for (const fixture of fixtures) { | |
| 311 | + assert(is(fixture), `Value: ${util.inspect(fixture)}`); | |
| 312 | + } | |
| 313 | + } | |
| 314 | +}; | |
| 315 | +ava_1.default('is', t => { | |
| 316 | + t.is(__1.default(null), 'null'); | |
| 317 | + t.is(__1.default(undefined), 'undefined'); | |
| 318 | +}); | |
| 319 | +ava_1.default('is.undefined', t => { | |
| 320 | + testType(t, 'undefined', ['nullOrUndefined']); | |
| 321 | +}); | |
| 322 | +ava_1.default('is.null', t => { | |
| 323 | + testType(t, 'null', ['nullOrUndefined']); | |
| 324 | +}); | |
| 325 | +ava_1.default('is.string', t => { | |
| 326 | + testType(t, 'string'); | |
| 327 | +}); | |
| 328 | +ava_1.default('is.number', t => { | |
| 329 | + testType(t, 'number', ['nan', 'integer', 'safeInteger', 'infinite']); | |
| 330 | +}); | |
| 331 | +ava_1.default('is.boolean', t => { | |
| 332 | + testType(t, 'boolean'); | |
| 333 | +}); | |
| 334 | +ava_1.default('is.symbol', t => { | |
| 335 | + testType(t, 'symbol'); | |
| 336 | +}); | |
| 337 | +ava_1.default('is.array', t => { | |
| 338 | + testType(t, 'array'); | |
| 339 | +}); | |
| 340 | +ava_1.default('is.function', t => { | |
| 341 | + testType(t, 'function', ['generatorFunction', 'asyncFunction']); | |
| 342 | +}); | |
| 343 | +ava_1.default('is.buffer', t => { | |
| 344 | + testType(t, 'buffer'); | |
| 345 | +}); | |
| 346 | +ava_1.default('is.object', t => { | |
| 347 | + const testData = types.get('object'); | |
| 348 | + if (testData === undefined) { | |
| 349 | + t.fail('is.object not defined'); | |
| 350 | + return; | |
| 351 | + } | |
| 352 | + for (const el of testData.fixtures) { | |
| 353 | + t.true(__1.default.object(el)); | |
| 354 | + } | |
| 355 | +}); | |
| 356 | +ava_1.default('is.regExp', t => { | |
| 357 | + testType(t, 'regExp'); | |
| 358 | +}); | |
| 359 | +ava_1.default('is.date', t => { | |
| 360 | + testType(t, 'date'); | |
| 361 | +}); | |
| 362 | +ava_1.default('is.error', t => { | |
| 363 | + testType(t, 'error'); | |
| 364 | +}); | |
| 365 | +if (isNode8orHigher) { | |
| 366 | + ava_1.default('is.nativePromise', t => { | |
| 367 | + testType(t, 'nativePromise'); | |
| 368 | + }); | |
| 369 | + ava_1.default('is.promise', t => { | |
| 370 | + testType(t, 'promise', ['nativePromise']); | |
| 371 | + }); | |
| 372 | +} | |
| 373 | +ava_1.default('is.generator', t => { | |
| 374 | + testType(t, 'generator'); | |
| 375 | +}); | |
| 376 | +ava_1.default('is.generatorFunction', t => { | |
| 377 | + testType(t, 'generatorFunction', ['function']); | |
| 378 | +}); | |
| 379 | +ava_1.default('is.map', t => { | |
| 380 | + testType(t, 'map'); | |
| 381 | +}); | |
| 382 | +ava_1.default('is.set', t => { | |
| 383 | + testType(t, 'set'); | |
| 384 | +}); | |
| 385 | +ava_1.default('is.weakMap', t => { | |
| 386 | + testType(t, 'weakMap'); | |
| 387 | +}); | |
| 388 | +ava_1.default('is.weakSet', t => { | |
| 389 | + testType(t, 'weakSet'); | |
| 390 | +}); | |
| 391 | +ava_1.default('is.int8Array', t => { | |
| 392 | + testType(t, 'int8Array'); | |
| 393 | +}); | |
| 394 | +ava_1.default('is.uint8Array', t => { | |
| 395 | + testType(t, 'uint8Array', ['buffer']); | |
| 396 | +}); | |
| 397 | +ava_1.default('is.uint8ClampedArray', t => { | |
| 398 | + testType(t, 'uint8ClampedArray'); | |
| 399 | +}); | |
| 400 | +ava_1.default('is.int16Array', t => { | |
| 401 | + testType(t, 'int16Array'); | |
| 402 | +}); | |
| 403 | +ava_1.default('is.uint16Array', t => { | |
| 404 | + testType(t, 'uint16Array'); | |
| 405 | +}); | |
| 406 | +ava_1.default('is.int32Array', t => { | |
| 407 | + testType(t, 'int32Array'); | |
| 408 | +}); | |
| 409 | +ava_1.default('is.uint32Array', t => { | |
| 410 | + testType(t, 'uint32Array'); | |
| 411 | +}); | |
| 412 | +ava_1.default('is.float32Array', t => { | |
| 413 | + testType(t, 'float32Array'); | |
| 414 | +}); | |
| 415 | +ava_1.default('is.float64Array', t => { | |
| 416 | + testType(t, 'float64Array'); | |
| 417 | +}); | |
| 418 | +ava_1.default('is.arrayBuffer', t => { | |
| 419 | + testType(t, 'arrayBuffer'); | |
| 420 | +}); | |
| 421 | +ava_1.default('is.dataView', t => { | |
| 422 | + testType(t, 'arrayBuffer'); | |
| 423 | +}); | |
| 424 | +ava_1.default('is.truthy', t => { | |
| 425 | + t.true(__1.default.truthy('unicorn')); | |
| 426 | + t.true(__1.default.truthy('🦄')); | |
| 427 | + t.true(__1.default.truthy(new Set())); | |
| 428 | + t.true(__1.default.truthy(Symbol('🦄'))); | |
| 429 | + t.true(__1.default.truthy(true)); | |
| 430 | +}); | |
| 431 | +ava_1.default('is.falsy', t => { | |
| 432 | + t.true(__1.default.falsy(false)); | |
| 433 | + t.true(__1.default.falsy(0)); | |
| 434 | + t.true(__1.default.falsy('')); | |
| 435 | + t.true(__1.default.falsy(null)); | |
| 436 | + t.true(__1.default.falsy(undefined)); | |
| 437 | + t.true(__1.default.falsy(NaN)); | |
| 438 | +}); | |
| 439 | +ava_1.default('is.nan', t => { | |
| 440 | + testType(t, 'nan'); | |
| 441 | +}); | |
| 442 | +ava_1.default('is.nullOrUndefined', t => { | |
| 443 | + testType(t, 'nullOrUndefined', ['undefined', 'null']); | |
| 444 | +}); | |
| 445 | +ava_1.default('is.primitive', t => { | |
| 446 | + const primitives = [ | |
| 447 | + undefined, | |
| 448 | + null, | |
| 449 | + '🦄', | |
| 450 | + 6, | |
| 451 | + Infinity, | |
| 452 | + -Infinity, | |
| 453 | + true, | |
| 454 | + false, | |
| 455 | + Symbol('🦄') | |
| 456 | + ]; | |
| 457 | + for (const el of primitives) { | |
| 458 | + t.true(__1.default.primitive(el)); | |
| 459 | + } | |
| 460 | +}); | |
| 461 | +ava_1.default('is.integer', t => { | |
| 462 | + testType(t, 'integer', ['number', 'safeInteger']); | |
| 463 | + t.false(__1.default.integer(1.4)); | |
| 464 | +}); | |
| 465 | +ava_1.default('is.safeInteger', t => { | |
| 466 | + testType(t, 'safeInteger', ['number', 'integer']); | |
| 467 | + t.false(__1.default.safeInteger(Math.pow(2, 53))); | |
| 468 | + t.false(__1.default.safeInteger(-Math.pow(2, 53))); | |
| 469 | +}); | |
| 470 | +ava_1.default('is.plainObject', t => { | |
| 471 | + testType(t, 'plainObject', ['object', 'promise']); | |
| 472 | +}); | |
| 473 | +ava_1.default('is.iterable', t => { | |
| 474 | + t.true(__1.default.iterable('')); | |
| 475 | + t.true(__1.default.iterable([])); | |
| 476 | + t.true(__1.default.iterable(new Map())); | |
| 477 | + t.false(__1.default.iterable(null)); | |
| 478 | + t.false(__1.default.iterable(undefined)); | |
| 479 | + t.false(__1.default.iterable(0)); | |
| 480 | + t.false(__1.default.iterable(NaN)); | |
| 481 | + t.false(__1.default.iterable(Infinity)); | |
| 482 | + t.false(__1.default.iterable({})); | |
| 483 | +}); | |
| 484 | +ava_1.default('is.class', t => { | |
| 485 | + class Foo { | |
| 486 | + } | |
| 487 | + const classDeclarations = [ | |
| 488 | + Foo, | |
| 489 | + class Bar extends Foo { | |
| 490 | + } | |
| 491 | + ]; | |
| 492 | + for (const x of classDeclarations) { | |
| 493 | + t.true(__1.default.class_(x)); | |
| 494 | + } | |
| 495 | +}); | |
| 496 | +ava_1.default('is.typedArray', t => { | |
| 497 | + const typedArrays = [ | |
| 498 | + new Int8Array(0), | |
| 499 | + new Uint8Array(0), | |
| 500 | + new Uint8ClampedArray(0), | |
| 501 | + new Uint16Array(0), | |
| 502 | + new Int32Array(0), | |
| 503 | + new Uint32Array(0), | |
| 504 | + new Float32Array(0), | |
| 505 | + new Float64Array(0) | |
| 506 | + ]; | |
| 507 | + for (const el of typedArrays) { | |
| 508 | + t.true(__1.default.typedArray(el)); | |
| 509 | + } | |
| 510 | + t.false(__1.default.typedArray(new ArrayBuffer(1))); | |
| 511 | + t.false(__1.default.typedArray([])); | |
| 512 | + t.false(__1.default.typedArray({})); | |
| 513 | +}); | |
| 514 | +ava_1.default('is.arrayLike', t => { | |
| 515 | + (() => { | |
| 516 | + t.true(__1.default.arrayLike(arguments)); | |
| 517 | + })(); | |
| 518 | + t.true(__1.default.arrayLike([])); | |
| 519 | + t.true(__1.default.arrayLike('unicorn')); | |
| 520 | + t.false(__1.default.arrayLike({})); | |
| 521 | + t.false(__1.default.arrayLike(() => { })); | |
| 522 | + t.false(__1.default.arrayLike(new Map())); | |
| 523 | +}); | |
| 524 | +ava_1.default('is.inRange', t => { | |
| 525 | + const x = 3; | |
| 526 | + t.true(__1.default.inRange(x, [0, 5])); | |
| 527 | + t.true(__1.default.inRange(x, [5, 0])); | |
| 528 | + t.true(__1.default.inRange(x, [-5, 5])); | |
| 529 | + t.true(__1.default.inRange(x, [5, -5])); | |
| 530 | + t.false(__1.default.inRange(x, [4, 8])); | |
| 531 | + t.true(__1.default.inRange(-7, [-5, -10])); | |
| 532 | + t.true(__1.default.inRange(-5, [-5, -10])); | |
| 533 | + t.true(__1.default.inRange(-10, [-5, -10])); | |
| 534 | + t.true(__1.default.inRange(x, 10)); | |
| 535 | + t.true(__1.default.inRange(0, 0)); | |
| 536 | + t.true(__1.default.inRange(-2, -3)); | |
| 537 | + t.false(__1.default.inRange(x, 2)); | |
| 538 | + t.false(__1.default.inRange(-3, -2)); | |
| 539 | + t.throws(() => { | |
| 540 | + __1.default.inRange(0, []); | |
| 541 | + }); | |
| 542 | + t.throws(() => { | |
| 543 | + __1.default.inRange(0, [5]); | |
| 544 | + }); | |
| 545 | + t.throws(() => { | |
| 546 | + __1.default.inRange(0, [1, 2, 3]); | |
| 547 | + }); | |
| 548 | +}); | |
| 549 | +ava_1.default('is.domElement', t => { | |
| 550 | + testType(t, 'domElement'); | |
| 551 | + t.false(__1.default.domElement({ nodeType: 1, nodeName: 'div' })); | |
| 552 | +}); | |
| 553 | +ava_1.default('is.infinite', t => { | |
| 554 | + testType(t, 'infinite', ['number']); | |
| 555 | +}); | |
| 556 | +ava_1.default('is.even', t => { | |
| 557 | + for (const el of [-6, 2, 4]) { | |
| 558 | + t.true(__1.default.even(el)); | |
| 559 | + } | |
| 560 | + for (const el of [-3, 1, 5]) { | |
| 561 | + t.false(__1.default.even(el)); | |
| 562 | + } | |
| 563 | +}); | |
| 564 | +ava_1.default('is.odd', t => { | |
| 565 | + for (const el of [-5, 7, 13]) { | |
| 566 | + t.true(__1.default.odd(el)); | |
| 567 | + } | |
| 568 | + for (const el of [-8, 8, 10]) { | |
| 569 | + t.false(__1.default.odd(el)); | |
| 570 | + } | |
| 571 | +}); | |
| 572 | +ava_1.default('is.empty', t => { | |
| 573 | + t.true(__1.default.empty(null)); | |
| 574 | + t.true(__1.default.empty(undefined)); | |
| 575 | + t.true(__1.default.empty(false)); | |
| 576 | + t.false(__1.default.empty(true)); | |
| 577 | + t.true(__1.default.empty('')); | |
| 578 | + t.false(__1.default.empty('🦄')); | |
| 579 | + t.true(__1.default.empty([])); | |
| 580 | + t.false(__1.default.empty(['🦄'])); | |
| 581 | + t.true(__1.default.empty({})); | |
| 582 | + t.false(__1.default.empty({ unicorn: '🦄' })); | |
| 583 | + const tempMap = new Map(); | |
| 584 | + t.true(__1.default.empty(tempMap)); | |
| 585 | + tempMap.set('unicorn', '🦄'); | |
| 586 | + t.false(__1.default.empty(tempMap)); | |
| 587 | + const tempSet = new Set(); | |
| 588 | + t.true(__1.default.empty(tempSet)); | |
| 589 | + tempSet.add(1); | |
| 590 | + t.false(__1.default.empty(tempSet)); | |
| 591 | +}); | |
| 592 | +ava_1.default('is.emptyOrWhitespace', t => { | |
| 593 | + t.true(__1.default.emptyOrWhitespace('')); | |
| 594 | + t.true(__1.default.emptyOrWhitespace(' ')); | |
| 595 | + t.false(__1.default.emptyOrWhitespace('🦄')); | |
| 596 | + t.false(__1.default.emptyOrWhitespace('unicorn')); | |
| 597 | +}); | |
| 598 | +ava_1.default('is.any', t => { | |
| 599 | + t.true(__1.default.any(__1.default.string, {}, true, '🦄')); | |
| 600 | + t.true(__1.default.any(__1.default.object, false, {}, 'unicorns')); | |
| 601 | + t.false(__1.default.any(__1.default.boolean, '🦄', [], 3)); | |
| 602 | + t.false(__1.default.any(__1.default.integer, true, 'lol', {})); | |
| 603 | + t.throws(() => { | |
| 604 | + __1.default.any(null, true); | |
| 605 | + }); | |
| 606 | + t.throws(() => { | |
| 607 | + __1.default.any(__1.default.string); | |
| 608 | + }); | |
| 609 | +}); | |
| 610 | +ava_1.default('is.all', t => { | |
| 611 | + t.true(__1.default.all(__1.default.object, {}, new Set(), new Map())); | |
| 612 | + t.true(__1.default.all(__1.default.boolean, true, false)); | |
| 613 | + t.false(__1.default.all(__1.default.string, '🦄', [])); | |
| 614 | + t.false(__1.default.all(__1.default.set, new Map(), {})); | |
| 615 | + t.throws(() => { | |
| 616 | + __1.default.all(null, true); | |
| 617 | + }); | |
| 618 | + t.throws(() => { | |
| 619 | + __1.default.all(__1.default.string); | |
| 620 | + }); | |
| 621 | +}); | |
| 622 | +//# sourceMappingURL=test.js.map | |
| 0 | 623 | \ No newline at end of file | ... | ... |
node_modules/@sindresorhus/is/dist/source/tests/test.js.map
0 → 100644
| 1 | +++ a/node_modules/@sindresorhus/is/dist/source/tests/test.js.map | |
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../source/tests/test.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6BAA6B;AAC7B,6BAA+C;AAC/C,iCAA4B;AAC5B,0BAAmB;AAEnB,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAKzE,0BAA2B,SAAQ,KAAK;CAAG;AAE3C,MAAM,QAAQ,GAAG,aAAK,EAAE,CAAC;AACzB,MAAM,gBAAgB,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;AAOpE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAe;IACnC,CAAC,WAAW,EAAE;YACb,EAAE,EAAE,WAAC,CAAC,SAAS;YACf,QAAQ,EAAE;gBACT,SAAS;aACT;SACD,CAAC;IACF,CAAC,MAAM,EAAE;YACR,EAAE,EAAE,WAAC,CAAC,KAAK;YACX,QAAQ,EAAE;gBACT,IAAI;aACJ;SACD,CAAC;IACF,CAAC,QAAQ,EAAE;YACV,EAAE,EAAE,WAAC,CAAC,MAAM;YACZ,QAAQ,EAAE;gBACT,IAAI;gBACJ,aAAa;gBACb,EAAE;aACF;SACD,CAAC;IACF,CAAC,QAAQ,EAAE;YACV,EAAE,EAAE,WAAC,CAAC,MAAM;YACZ,QAAQ,EAAE;gBACT,CAAC;gBACD,GAAG;gBACH,CAAC;gBACD,CAAC,CAAC;gBACF,QAAQ;gBACR,CAAC,QAAQ;aACT;SACD,CAAC;IACF,CAAC,SAAS,EAAE;YACX,EAAE,EAAE,WAAC,CAAC,OAAO;YACb,QAAQ,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AC,GAAG,CAAC,WAAC,CAAC,MAAM,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE;IAClB,CAAC,CAAC,IAAI,CAAC,WAAC,CAAC,GAAG,CAAC,WAAC,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,IAAI,CAAC,WAAC,CAAC,GAAG,CAAC,WAAC,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC,KAAK,CAAC,WAAC,CAAC,GAAG,CAAC,WAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,KAAK,CAAC,WAAC,CAAC,GAAG,CAAC,WAAC,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAErC,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE;QACb,WAAC,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE;QACb,WAAC,CAAC,GAAG,CAAC,WAAC,CAAC,MAAM,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} | |
| 0 | 2 | \ No newline at end of file | ... | ... |
| 1 | +++ a/node_modules/@sindresorhus/is/license | |
| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | +MIT License | |
| 2 | + | |
| 3 | +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) | |
| 4 | + | |
| 5 | +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: | |
| 6 | + | |
| 7 | +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| 8 | + | |
| 9 | +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. | ... | ... |
| 1 | +++ a/node_modules/@sindresorhus/is/package.json | |
| ... | ... | @@ -0,0 +1,95 @@ |
| 1 | +{ | |
| 2 | + "_from": "@sindresorhus/is@^0.7.0", | |
| 3 | + "_id": "@sindresorhus/is@0.7.0", | |
| 4 | + "_inBundle": false, | |
| 5 | + "_integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==", | |
| 6 | + "_location": "/@sindresorhus/is", | |
| 7 | + "_phantomChildren": {}, | |
| 8 | + "_requested": { | |
| 9 | + "type": "range", | |
| 10 | + "registry": true, | |
| 11 | + "raw": "@sindresorhus/is@^0.7.0", | |
| 12 | + "name": "@sindresorhus/is", | |
| 13 | + "escapedName": "@sindresorhus%2fis", | |
| 14 | + "scope": "@sindresorhus", | |
| 15 | + "rawSpec": "^0.7.0", | |
| 16 | + "saveSpec": null, | |
| 17 | + "fetchSpec": "^0.7.0" | |
| 18 | + }, | |
| 19 | + "_requiredBy": [ | |
| 20 | + "/p-series" | |
| 21 | + ], | |
| 22 | + "_resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", | |
| 23 | + "_shasum": "9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd", | |
| 24 | + "_spec": "@sindresorhus/is@^0.7.0", | |
| 25 | + "_where": "C:\\Users\\admin\\Documents\\express-project\\node_modules\\p-series", | |
| 26 | + "author": { | |
| 27 | + "name": "Sindre Sorhus", | |
| 28 | + "email": "sindresorhus@gmail.com", | |
| 29 | + "url": "sindresorhus.com" | |
| 30 | + }, | |
| 31 | + "bugs": { | |
| 32 | + "url": "https://github.com/sindresorhus/is/issues" | |
| 33 | + }, | |
| 34 | + "bundleDependencies": false, | |
| 35 | + "deprecated": false, | |
| 36 | + "description": "Type check values: `is.string('🦄') //=> true`", | |
| 37 | + "devDependencies": { | |
| 38 | + "@types/jsdom": "^2.0.31", | |
| 39 | + "@types/node": "^8.0.47", | |
| 40 | + "@types/tempy": "^0.1.0", | |
| 41 | + "ava": "*", | |
| 42 | + "del-cli": "^1.1.0", | |
| 43 | + "jsdom": "^9.12.0", | |
| 44 | + "tempy": "^0.2.1", | |
| 45 | + "tslint": "^5.8.0", | |
| 46 | + "tslint-xo": "^0.3.0", | |
| 47 | + "typescript": "^2.6.1" | |
| 48 | + }, | |
| 49 | + "engines": { | |
| 50 | + "node": ">=4" | |
| 51 | + }, | |
| 52 | + "files": [ | |
| 53 | + "dist" | |
| 54 | + ], | |
| 55 | + "homepage": "https://github.com/sindresorhus/is#readme", | |
| 56 | + "keywords": [ | |
| 57 | + "type", | |
| 58 | + "types", | |
| 59 | + "is", | |
| 60 | + "check", | |
| 61 | + "checking", | |
| 62 | + "validate", | |
| 63 | + "validation", | |
| 64 | + "utility", | |
| 65 | + "util", | |
| 66 | + "typeof", | |
| 67 | + "instanceof", | |
| 68 | + "object", | |
| 69 | + "assert", | |
| 70 | + "assertion", | |
| 71 | + "test", | |
| 72 | + "kind", | |
| 73 | + "primitive", | |
| 74 | + "verify", | |
| 75 | + "compare" | |
| 76 | + ], | |
| 77 | + "license": "MIT", | |
| 78 | + "main": "dist/index.js", | |
| 79 | + "name": "@sindresorhus/is", | |
| 80 | + "publishConfig": { | |
| 81 | + "access": "public" | |
| 82 | + }, | |
| 83 | + "repository": { | |
| 84 | + "type": "git", | |
| 85 | + "url": "git+https://github.com/sindresorhus/is.git" | |
| 86 | + }, | |
| 87 | + "scripts": { | |
| 88 | + "build": "tsc", | |
| 89 | + "lint": "tslint --format stylish --project .", | |
| 90 | + "prepublish": "npm run build && del dist/tests", | |
| 91 | + "test": "npm run lint && npm run build && ava dist/tests" | |
| 92 | + }, | |
| 93 | + "types": "dist/index.d.ts", | |
| 94 | + "version": "0.7.0" | |
| 95 | +} | ... | ... |
| 1 | +++ a/node_modules/@sindresorhus/is/readme.md | |
| ... | ... | @@ -0,0 +1,323 @@ |
| 1 | +# is [](https://travis-ci.org/sindresorhus/is) | |
| 2 | + | |
| 3 | +> Type check values: `is.string('🦄') //=> true` | |
| 4 | + | |
| 5 | +<img src="header.gif" width="182" align="right"> | |
| 6 | + | |
| 7 | + | |
| 8 | +## Install | |
| 9 | + | |
| 10 | +``` | |
| 11 | +$ npm install @sindresorhus/is | |
| 12 | +``` | |
| 13 | + | |
| 14 | + | |
| 15 | +## Usage | |
| 16 | + | |
| 17 | +```js | |
| 18 | +const is = require('@sindresorhus/is'); | |
| 19 | + | |
| 20 | +is('🦄'); | |
| 21 | +//=> 'string' | |
| 22 | + | |
| 23 | +is(new Map()); | |
| 24 | +//=> 'Map' | |
| 25 | + | |
| 26 | +is.number(6); | |
| 27 | +//=> true | |
| 28 | +``` | |
| 29 | + | |
| 30 | + | |
| 31 | +## API | |
| 32 | + | |
| 33 | +### is(value) | |
| 34 | + | |
| 35 | +Returns the type of `value`. | |
| 36 | + | |
| 37 | +Primitives are lowercase and object types are camelcase. | |
| 38 | + | |
| 39 | +Example: | |
| 40 | + | |
| 41 | +- `'undefined'` | |
| 42 | +- `'null'` | |
| 43 | +- `'string'` | |
| 44 | +- `'symbol'` | |
| 45 | +- `'Array'` | |
| 46 | +- `'Function'` | |
| 47 | +- `'Object'` | |
| 48 | + | |
| 49 | +Note: It will throw if you try to feed it object-wrapped primitives, as that's a bad practice. For example `new String('foo')`. | |
| 50 | + | |
| 51 | +### is.{method} | |
| 52 | + | |
| 53 | +All the below methods accept a value and returns a boolean for whether the value is of the desired type. | |
| 54 | + | |
| 55 | +#### Primitives | |
| 56 | + | |
| 57 | +##### .undefined(value) | |
| 58 | +##### .null(value) | |
| 59 | +##### .string(value) | |
| 60 | +##### .number(value) | |
| 61 | +##### .boolean(value) | |
| 62 | +##### .symbol(value) | |
| 63 | + | |
| 64 | +#### Built-in types | |
| 65 | + | |
| 66 | +##### .array(value) | |
| 67 | +##### .function(value) | |
| 68 | +##### .buffer(value) | |
| 69 | +##### .object(value) | |
| 70 | + | |
| 71 | +Keep in mind that [functions are objects too](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions). | |
| 72 | + | |
| 73 | +##### .regExp(value) | |
| 74 | +##### .date(value) | |
| 75 | +##### .error(value) | |
| 76 | +##### .nativePromise(value) | |
| 77 | +##### .promise(value) | |
| 78 | + | |
| 79 | +Returns `true` for any object with a `.then()` and `.catch()` method. Prefer this one over `.nativePromise()` as you usually want to allow userland promise implementations too. | |
| 80 | + | |
| 81 | +##### .generator(value) | |
| 82 | + | |
| 83 | +Returns `true` for any object that implements its own `.next()` and `.throw()` methods and has a function definition for `Symbol.iterator`. | |
| 84 | + | |
| 85 | +##### .generatorFunction(value) | |
| 86 | + | |
| 87 | +##### .asyncFunction(value) | |
| 88 | + | |
| 89 | +Returns `true` for any `async` function that can be called with the `await` operator. | |
| 90 | + | |
| 91 | +```js | |
| 92 | +is.asyncFunction(async () => {}); | |
| 93 | +// => true | |
| 94 | + | |
| 95 | +is.asyncFunction(() => {}); | |
| 96 | +// => false | |
| 97 | +``` | |
| 98 | + | |
| 99 | +##### .boundFunction(value) | |
| 100 | + | |
| 101 | +Returns `true` for any `bound` function. | |
| 102 | + | |
| 103 | +```js | |
| 104 | +is.boundFunction(() => {}); | |
| 105 | +// => true | |
| 106 | + | |
| 107 | +is.boundFunction(function () {}.bind(null)); | |
| 108 | +// => true | |
| 109 | + | |
| 110 | +is.boundFunction(function () {}); | |
| 111 | +// => false | |
| 112 | +``` | |
| 113 | + | |
| 114 | +##### .map(value) | |
| 115 | +##### .set(value) | |
| 116 | +##### .weakMap(value) | |
| 117 | +##### .weakSet(value) | |
| 118 | + | |
| 119 | +#### Typed arrays | |
| 120 | + | |
| 121 | +##### .int8Array(value) | |
| 122 | +##### .uint8Array(value) | |
| 123 | +##### .uint8ClampedArray(value) | |
| 124 | +##### .int16Array(value) | |
| 125 | +##### .uint16Array(value) | |
| 126 | +##### .int32Array(value) | |
| 127 | +##### .uint32Array(value) | |
| 128 | +##### .float32Array(value) | |
| 129 | +##### .float64Array(value) | |
| 130 | + | |
| 131 | +#### Structured data | |
| 132 | + | |
| 133 | +##### .arrayBuffer(value) | |
| 134 | +##### .sharedArrayBuffer(value) | |
| 135 | +##### .dataView(value) | |
| 136 | + | |
| 137 | +#### Miscellaneous | |
| 138 | + | |
| 139 | +##### .directInstanceOf(value, class) | |
| 140 | + | |
| 141 | +Returns `true` if `value` is a direct instance of `class`. | |
| 142 | + | |
| 143 | +```js | |
| 144 | +is.directInstanceOf(new Error(), Error); | |
| 145 | +//=> true | |
| 146 | + | |
| 147 | +class UnicornError extends Error {}; | |
| 148 | + | |
| 149 | +is.directInstanceOf(new UnicornError(), Error); | |
| 150 | +//=> false | |
| 151 | +``` | |
| 152 | + | |
| 153 | +##### .truthy(value) | |
| 154 | + | |
| 155 | +Returns `true` for all values that evaluate to true in a boolean context: | |
| 156 | + | |
| 157 | +```js | |
| 158 | +is.truthy('🦄'); | |
| 159 | +//=> true | |
| 160 | + | |
| 161 | +is.truthy(undefined); | |
| 162 | +//=> false | |
| 163 | +``` | |
| 164 | + | |
| 165 | +##### .falsy(value) | |
| 166 | + | |
| 167 | +Returns `true` if `value` is one of: `false`, `0`, `''`, `null`, `undefined`, `NaN`. | |
| 168 | + | |
| 169 | +##### .nan(value) | |
| 170 | +##### .nullOrUndefined(value) | |
| 171 | +##### .primitive(value) | |
| 172 | + | |
| 173 | +JavaScript primitives are as follows: `null`, `undefined`, `string`, `number`, `boolean`, `symbol`. | |
| 174 | + | |
| 175 | +##### .integer(value) | |
| 176 | + | |
| 177 | +##### .safeInteger(value) | |
| 178 | + | |
| 179 | +Returns `true` if `value` is a [safe integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger). | |
| 180 | + | |
| 181 | +##### .plainObject(value) | |
| 182 | + | |
| 183 | +An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`. | |
| 184 | + | |
| 185 | +##### .iterable(value) | |
| 186 | +##### .class(value) | |
| 187 | + | |
| 188 | +Returns `true` for instances created by a ES2015 class. | |
| 189 | + | |
| 190 | +##### .typedArray(value) | |
| 191 | + | |
| 192 | +##### .arrayLike(value) | |
| 193 | + | |
| 194 | +A `value` is array-like if it is not a function and has a `value.length` that is a safe integer greater than or equal to 0. | |
| 195 | + | |
| 196 | +```js | |
| 197 | +is.arrayLike(document.forms); | |
| 198 | +//=> true | |
| 199 | + | |
| 200 | +function () { | |
| 201 | + is.arrayLike(arguments); | |
| 202 | + //=> true | |
| 203 | +} | |
| 204 | +``` | |
| 205 | + | |
| 206 | +##### .inRange(value, range) | |
| 207 | + | |
| 208 | +Check if `value` (number) is in the given `range`. The range is an array of two values, lower bound and upper bound, in no specific order. | |
| 209 | + | |
| 210 | +```js | |
| 211 | +is.inRange(3, [0, 5]); | |
| 212 | +is.inRange(3, [5, 0]); | |
| 213 | +is.inRange(0, [-2, 2]); | |
| 214 | +``` | |
| 215 | + | |
| 216 | +##### .inRange(value, upperBound) | |
| 217 | + | |
| 218 | +Check if `value` (number) is in the range of `0` to `upperBound`. | |
| 219 | + | |
| 220 | +```js | |
| 221 | +is.inRange(3, 10); | |
| 222 | +``` | |
| 223 | + | |
| 224 | +##### .domElement(value) | |
| 225 | + | |
| 226 | +Returns `true` if `value` is a DOM Element. | |
| 227 | + | |
| 228 | +##### .nodeStream(value) | |
| 229 | + | |
| 230 | +Returns `true` if `value` is a Node.js [stream](https://nodejs.org/api/stream.html). | |
| 231 | + | |
| 232 | +```js | |
| 233 | +const fs = require('fs'); | |
| 234 | +is.nodeStream(fs.createReadStream('unicorn.png')); | |
| 235 | +//=> true | |
| 236 | +``` | |
| 237 | + | |
| 238 | +##### .infinite(value) | |
| 239 | + | |
| 240 | +Check if `value` is `Infinity` or `-Infinity`. | |
| 241 | + | |
| 242 | +##### .even(value) | |
| 243 | + | |
| 244 | +Returns `true` if `value` is an even integer. | |
| 245 | + | |
| 246 | +##### .odd(value) | |
| 247 | + | |
| 248 | +Returns `true` if `value` is an odd integer. | |
| 249 | + | |
| 250 | +##### .empty(value) | |
| 251 | + | |
| 252 | +Returns `true` if `value` is falsy or an empty string, array, object, map, or set. | |
| 253 | + | |
| 254 | +##### .emptyOrWhitespace(value) | |
| 255 | + | |
| 256 | +Returns `true` if `is.empty(value)` or a string that is all whitespace. | |
| 257 | + | |
| 258 | + | |
| 259 | +##### .any(predicate, ...values) | |
| 260 | + | |
| 261 | +Returns `true` if **any** of the input `values` returns true in the `predicate`: | |
| 262 | + | |
| 263 | +```js | |
| 264 | +is.any(is.string, {}, true, '🦄'); | |
| 265 | +//=> true | |
| 266 | + | |
| 267 | +is.any(is.boolean, 'unicorns', [], new Map()); | |
| 268 | +//=> false | |
| 269 | +``` | |
| 270 | + | |
| 271 | +##### .all(predicate, ...values) | |
| 272 | + | |
| 273 | +Returns `true` if **all** of the input `values` returns true in the `predicate`: | |
| 274 | + | |
| 275 | +```js | |
| 276 | +is.all(is.object, {}, new Map(), new Set()); | |
| 277 | +//=> true | |
| 278 | + | |
| 279 | +is.all(is.string, '🦄', [], 'unicorns'); | |
| 280 | +//=> false | |
| 281 | +``` | |
| 282 | + | |
| 283 | +## FAQ | |
| 284 | + | |
| 285 | +### Why yet another type checking module? | |
| 286 | + | |
| 287 | +There are hundreds of type checking modules on npm, unfortunately, I couldn't find any that fit my needs: | |
| 288 | + | |
| 289 | +- Includes both type methods and ability to get the type | |
| 290 | +- Types of primitives returned as lowercase and object types as camelcase | |
| 291 | +- Covers all built-ins | |
| 292 | +- Unsurprising behavior | |
| 293 | +- Well-maintained | |
| 294 | +- Comprehensive test suite | |
| 295 | + | |
| 296 | +For the ones I found, pick 3 of these. | |
| 297 | + | |
| 298 | +The most common mistakes I noticed in these modules was using `instanceof` for type checking, forgetting that functions are objects, and omitting `symbol` as a primitive. | |
| 299 | + | |
| 300 | + | |
| 301 | +## Related | |
| 302 | + | |
| 303 | +- [is-stream](https://github.com/sindresorhus/is-stream) - Check if something is a Node.js stream | |
| 304 | +- [is-observable](https://github.com/sindresorhus/is-observable) - Check if a value is an Observable | |
| 305 | +- [file-type](https://github.com/sindresorhus/file-type) - Detect the file type of a Buffer/Uint8Array | |
| 306 | +- [is-ip](https://github.com/sindresorhus/is-ip) - Check if a string is an IP address | |
| 307 | +- [is-array-sorted](https://github.com/sindresorhus/is-array-sorted) - Check if an Array is sorted | |
| 308 | +- [is-error-constructor](https://github.com/sindresorhus/is-error-constructor) - Check if a value is an error constructor | |
| 309 | +- [is-empty-iterable](https://github.com/sindresorhus/is-empty-iterable) - Check if an Iterable is empty | |
| 310 | +- [is-blob](https://github.com/sindresorhus/is-blob) - Check if a value is a Blob - File-like object of immutable, raw data | |
| 311 | +- [has-emoji](https://github.com/sindresorhus/has-emoji) - Check whether a string has any emoji | |
| 312 | + | |
| 313 | + | |
| 314 | +## Created by | |
| 315 | + | |
| 316 | +- [Sindre Sorhus](https://github.com/sindresorhus) | |
| 317 | +- [Giora Guttsait](https://github.com/gioragutt) | |
| 318 | +- [Brandon Smith](https://github.com/brandon93s) | |
| 319 | + | |
| 320 | + | |
| 321 | +## License | |
| 322 | + | |
| 323 | +MIT | ... | ... |
| 1 | +++ a/node_modules/@slynova/slug/README.md | |
| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | +# node-slug | |
| 2 | + | |
| 3 | +Transforms any text into an uri-safe string. | |
| 4 | + | |
| 5 | +--- | |
| 6 | + | |
| 7 | +## Getting Started | |
| 8 | + | |
| 9 | +This package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com). | |
| 10 | + | |
| 11 | +```bash | |
| 12 | +$ npm i @slynova/slug | |
| 13 | +# or | |
| 14 | +$ yarn add @slynova/slug | |
| 15 | +``` | |
| 16 | + | |
| 17 | +Then require the `slug()` method directly from the package. | |
| 18 | + | |
| 19 | +```javascript | |
| 20 | +const slug = require('@slynova/slug') | |
| 21 | + | |
| 22 | +slug('1 < 2') // 1-less-2 | |
| 23 | +slug('Hey! How are you') // hey-how-are-you | |
| 24 | +slug('tôi tên là đức tạ') // toi-ten-la-duc-ta | |
| 25 | +slug('learn adonis in 30minutes') // learn-adonis-in-30-minutes | |
| 26 | +``` | |
| 27 | + | |
| 28 | +## Extending char map | |
| 29 | + | |
| 30 | +To extend the char map you can use the static method `extends` | |
| 31 | + | |
| 32 | +```javascript | |
| 33 | +const slug = require('@slynova/slug') | |
| 34 | + | |
| 35 | +slug.extends({'💙': 'love'}) | |
| 36 | +slug('i 💙 you') // i-love-you | |
| 37 | +``` | |
| 38 | + | |
| 39 | +## Contribution Guidelines | |
| 40 | + | |
| 41 | +Any pull requests or discussions are welcome.<br> | |
| 42 | +Note that every pull request providing a new feature or correcting a bug should be created with appropriate unit tests. | ... | ... |
| 1 | +++ a/node_modules/@slynova/slug/package.json | |
| ... | ... | @@ -0,0 +1,59 @@ |
| 1 | +{ | |
| 2 | + "_from": "@slynova/slug@^1.0.0", | |
| 3 | + "_id": "@slynova/slug@1.1.2", | |
| 4 | + "_inBundle": false, | |
| 5 | + "_integrity": "sha512-lFJRP4rqRxqxMjEnIih84jvQC6Xc4a3Yi0Z3gbemWOJX60HBBqEFfFrudmYYA+ga46b6Gxv7ofguZ9+ghl1EMg==", | |
| 6 | + "_location": "/@slynova/slug", | |
| 7 | + "_phantomChildren": {}, | |
| 8 | + "_requested": { | |
| 9 | + "type": "range", | |
| 10 | + "registry": true, | |
| 11 | + "raw": "@slynova/slug@^1.0.0", | |
| 12 | + "name": "@slynova/slug", | |
| 13 | + "escapedName": "@slynova%2fslug", | |
| 14 | + "scope": "@slynova", | |
| 15 | + "rawSpec": "^1.0.0", | |
| 16 | + "saveSpec": null, | |
| 17 | + "fetchSpec": "^1.0.0" | |
| 18 | + }, | |
| 19 | + "_requiredBy": [ | |
| 20 | + "/indicative" | |
| 21 | + ], | |
| 22 | + "_resolved": "https://registry.npmjs.org/@slynova/slug/-/slug-1.1.2.tgz", | |
| 23 | + "_shasum": "c6289781da191b3ea386d678843cb7a7db7844e8", | |
| 24 | + "_spec": "@slynova/slug@^1.0.0", | |
| 25 | + "_where": "C:\\Users\\admin\\Documents\\express-project\\node_modules\\indicative", | |
| 26 | + "author": { | |
| 27 | + "name": "Romain Lanz", | |
| 28 | + "email": "romain.lanz@slynova.ch" | |
| 29 | + }, | |
| 30 | + "bugs": { | |
| 31 | + "url": "https://github.com/Slynova-Org/slug/issues" | |
| 32 | + }, | |
| 33 | + "bundleDependencies": false, | |
| 34 | + "dependencies": { | |
| 35 | + "charmap": "^1.1.6", | |
| 36 | + "lodash.kebabcase": "^4.1.1" | |
| 37 | + }, | |
| 38 | + "deprecated": false, | |
| 39 | + "description": "Transforms any text into an uri-safe string.", | |
| 40 | + "devDependencies": { | |
| 41 | + "japa": "^1.0.6", | |
| 42 | + "japa-cli": "^1.0.1", | |
| 43 | + "nyc": "^11.9.0" | |
| 44 | + }, | |
| 45 | + "homepage": "https://github.com/Slynova-Org/slug#readme", | |
| 46 | + "license": "MIT", | |
| 47 | + "main": "src/index.js", | |
| 48 | + "name": "@slynova/slug", | |
| 49 | + "repository": { | |
| 50 | + "type": "git", | |
| 51 | + "url": "git+https://github.com/Slynova-Org/slug.git" | |
| 52 | + }, | |
| 53 | + "scripts": { | |
| 54 | + "test": "npm run test:coverage", | |
| 55 | + "test:coverage": "nyc npm run test:local", | |
| 56 | + "test:local": "japa" | |
| 57 | + }, | |
| 58 | + "version": "1.1.2" | |
| 59 | +} | ... | ... |
| 1 | +++ a/node_modules/@slynova/slug/src/index.js | |
| ... | ... | @@ -0,0 +1,59 @@ |
| 1 | +'use strict' | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * node-slug | |
| 5 | + * | |
| 6 | + * @license MIT | |
| 7 | + * @copyright Slynova - Romain Lanz <romain.lanz@slynova.ch> | |
| 8 | + */ | |
| 9 | + | |
| 10 | +var kebabCase = require('lodash.kebabcase') | |
| 11 | +var transform = require('charmap').transform | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Slugify any given characters. | |
| 15 | + * | |
| 16 | + * @method slug | |
| 17 | + * | |
| 18 | + * @param {string|number} text Text to Slugify | |
| 19 | + * | |
| 20 | + * @return {string} | |
| 21 | + */ | |
| 22 | +function slug (text) { | |
| 23 | + if (text === void 0) return '' | |
| 24 | + | |
| 25 | + return kebabCase( | |
| 26 | + removeNonAsciiChar( | |
| 27 | + transform( | |
| 28 | + text.toString() | |
| 29 | + ) | |
| 30 | + ) | |
| 31 | + ) | |
| 32 | +} | |
| 33 | + | |
| 34 | +/** | |
| 35 | + * Remove non-ascii character. | |
| 36 | + * | |
| 37 | + * @method removeNonAsciiChar | |
| 38 | + * | |
| 39 | + * @param {string} text Text to remove non-ascii character | |
| 40 | + * | |
| 41 | + * @return {string} | |
| 42 | + */ | |
| 43 | +function removeNonAsciiChar (text) { | |
| 44 | + var newText = '' | |
| 45 | + | |
| 46 | + for (var i = 0; i <= text.length; i++) { | |
| 47 | + if (text.charCodeAt(i) < 128) { | |
| 48 | + newText += text[i] | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + return newText | |
| 53 | +} | |
| 54 | + | |
| 55 | +slug.extends = function (customMap) { | |
| 56 | + transform.extends(customMap) | |
| 57 | +} | |
| 58 | + | |
| 59 | +module.exports = slug | |
| 0 | 60 | \ No newline at end of file | ... | ... |
| 1 | +++ a/node_modules/accepts/HISTORY.md | |
| ... | ... | @@ -0,0 +1,224 @@ |
| 1 | +1.3.5 / 2018-02-28 | |
| 2 | +================== | |
| 3 | + | |
| 4 | + * deps: mime-types@~2.1.18 | |
| 5 | + - deps: mime-db@~1.33.0 | |
| 6 | + | |
| 7 | +1.3.4 / 2017-08-22 | |
| 8 | +================== | |
| 9 | + | |
| 10 | + * deps: mime-types@~2.1.16 | |
| 11 | + - deps: mime-db@~1.29.0 | |
| 12 | + | |
| 13 | +1.3.3 / 2016-05-02 | |
| 14 | +================== | |
| 15 | + | |
| 16 | + * deps: mime-types@~2.1.11 | |
| 17 | + - deps: mime-db@~1.23.0 | |
| 18 | + * deps: negotiator@0.6.1 | |
| 19 | + - perf: improve `Accept` parsing speed | |
| 20 | + - perf: improve `Accept-Charset` parsing speed | |
| 21 | + - perf: improve `Accept-Encoding` parsing speed | |
| 22 | + - perf: improve `Accept-Language` parsing speed | |
| 23 | + | |
| 24 | +1.3.2 / 2016-03-08 | |
| 25 | +================== | |
| 26 | + | |
| 27 | + * deps: mime-types@~2.1.10 | |
| 28 | + - Fix extension of `application/dash+xml` | |
| 29 | + - Update primary extension for `audio/mp4` | |
| 30 | + - deps: mime-db@~1.22.0 | |
| 31 | + | |
| 32 | +1.3.1 / 2016-01-19 | |
| 33 | +================== | |
| 34 | + | |
| 35 | + * deps: mime-types@~2.1.9 | |
| 36 | + - deps: mime-db@~1.21.0 | |
| 37 | + | |
| 38 | +1.3.0 / 2015-09-29 | |
| 39 | +================== | |
| 40 | + | |
| 41 | + * deps: mime-types@~2.1.7 | |
| 42 | + - deps: mime-db@~1.19.0 | |
| 43 | + * deps: negotiator@0.6.0 | |
| 44 | + - Fix including type extensions in parameters in `Accept` parsing | |
| 45 | + - Fix parsing `Accept` parameters with quoted equals | |
| 46 | + - Fix parsing `Accept` parameters with quoted semicolons | |
| 47 | + - Lazy-load modules from main entry point | |
| 48 | + - perf: delay type concatenation until needed | |
| 49 | + - perf: enable strict mode | |
| 50 | + - perf: hoist regular expressions | |
| 51 | + - perf: remove closures getting spec properties | |
| 52 | + - perf: remove a closure from media type parsing | |
| 53 | + - perf: remove property delete from media type parsing | |
| 54 | + | |
| 55 | +1.2.13 / 2015-09-06 | |
| 56 | +=================== | |
| 57 | + | |
| 58 | + * deps: mime-types@~2.1.6 | |
| 59 | + - deps: mime-db@~1.18.0 | |
| 60 | + | |
| 61 | +1.2.12 / 2015-07-30 | |
| 62 | +=================== | |
| 63 | + | |
| 64 | + * deps: mime-types@~2.1.4 | |
| 65 | + - deps: mime-db@~1.16.0 | |
| 66 | + | |
| 67 | +1.2.11 / 2015-07-16 | |
| 68 | +=================== | |
| 69 | + | |
| 70 | + * deps: mime-types@~2.1.3 | |
| 71 | + - deps: mime-db@~1.15.0 | |
| 72 | + | |
| 73 | +1.2.10 / 2015-07-01 | |
| 74 | +=================== | |
| 75 | + | |
| 76 | + * deps: mime-types@~2.1.2 | |
| 77 | + - deps: mime-db@~1.14.0 | |
| 78 | + | |
| 79 | +1.2.9 / 2015-06-08 | |
| 80 | +================== | |
| 81 | + | |
| 82 | + * deps: mime-types@~2.1.1 | |
| 83 | + - perf: fix deopt during mapping | |
| 84 | + | |
| 85 | +1.2.8 / 2015-06-07 | |
| 86 | +================== | |
| 87 | + | |
| 88 | + * deps: mime-types@~2.1.0 | |
| 89 | + - deps: mime-db@~1.13.0 | |
| 90 | + * perf: avoid argument reassignment & argument slice | |
| 91 | + * perf: avoid negotiator recursive construction | |
| 92 | + * perf: enable strict mode | |
| 93 | + * perf: remove unnecessary bitwise operator | |
| 94 | + | |
| 95 | +1.2.7 / 2015-05-10 | |
| 96 | +================== | |
| 97 | + | |
| 98 | + * deps: negotiator@0.5.3 | |
| 99 | + - Fix media type parameter matching to be case-insensitive | |
| 100 | + | |
| 101 | +1.2.6 / 2015-05-07 | |
| 102 | +================== | |
| 103 | + | |
| 104 | + * deps: mime-types@~2.0.11 | |
| 105 | + - deps: mime-db@~1.9.1 | |
| 106 | + * deps: negotiator@0.5.2 | |
| 107 | + - Fix comparing media types with quoted values | |
| 108 | + - Fix splitting media types with quoted commas | |
| 109 | + | |
| 110 | +1.2.5 / 2015-03-13 | |
| 111 | +================== | |
| 112 | + | |
| 113 | + * deps: mime-types@~2.0.10 | |
| 114 | + - deps: mime-db@~1.8.0 | |
| 115 | + | |
| 116 | +1.2.4 / 2015-02-14 | |
| 117 | +================== | |
| 118 | + | |
| 119 | + * Support Node.js 0.6 | |
| 120 | + * deps: mime-types@~2.0.9 | |
| 121 | + - deps: mime-db@~1.7.0 | |
| 122 | + * deps: negotiator@0.5.1 | |
| 123 | + - Fix preference sorting to be stable for long acceptable lists | |
| 124 | + | |
| 125 | +1.2.3 / 2015-01-31 | |
| 126 | +================== | |
| 127 | + | |
| 128 | + * deps: mime-types@~2.0.8 | |
| 129 | + - deps: mime-db@~1.6.0 | |
| 130 | + | |
| 131 | +1.2.2 / 2014-12-30 | |
| 132 | +================== | |
| 133 | + | |
| 134 | + * deps: mime-types@~2.0.7 | |
| 135 | + - deps: mime-db@~1.5.0 | |
| 136 | + | |
| 137 | +1.2.1 / 2014-12-30 | |
| 138 | +================== | |
| 139 | + | |
| 140 | + * deps: mime-types@~2.0.5 | |
| 141 | + - deps: mime-db@~1.3.1 | |
| 142 | + | |
| 143 | +1.2.0 / 2014-12-19 | |
| 144 | +================== | |
| 145 | + | |
| 146 | + * deps: negotiator@0.5.0 | |
| 147 | + - Fix list return order when large accepted list | |
| 148 | + - Fix missing identity encoding when q=0 exists | |
| 149 | + - Remove dynamic building of Negotiator class | |
| 150 | + | |
| 151 | +1.1.4 / 2014-12-10 | |
| 152 | +================== | |
| 153 | + | |
| 154 | + * deps: mime-types@~2.0.4 | |
| 155 | + - deps: mime-db@~1.3.0 | |
| 156 | + | |
| 157 | +1.1.3 / 2014-11-09 | |
| 158 | +================== | |
| 159 | + | |
| 160 | + * deps: mime-types@~2.0.3 | |
| 161 | + - deps: mime-db@~1.2.0 | |
| 162 | + | |
| 163 | +1.1.2 / 2014-10-14 | |
| 164 | +================== | |
| 165 | + | |
| 166 | + * deps: negotiator@0.4.9 | |
| 167 | + - Fix error when media type has invalid parameter | |
| 168 | + | |
| 169 | +1.1.1 / 2014-09-28 | |
| 170 | +================== | |
| 171 | + | |
| 172 | + * deps: mime-types@~2.0.2 | |
| 173 | + - deps: mime-db@~1.1.0 | |
| 174 | + * deps: negotiator@0.4.8 | |
| 175 | + - Fix all negotiations to be case-insensitive | |
| 176 | + - Stable sort preferences of same quality according to client order | |
| 177 | + | |
| 178 | +1.1.0 / 2014-09-02 | |
| 179 | +================== | |
| 180 | + | |
| 181 | + * update `mime-types` | |
| 182 | + | |
| 183 | +1.0.7 / 2014-07-04 | |
| 184 | +================== | |
| 185 | + | |
| 186 | + * Fix wrong type returned from `type` when match after unknown extension | |
| 187 | + | |
| 188 | +1.0.6 / 2014-06-24 | |
| 189 | +================== | |
| 190 | + | |
| 191 | + * deps: negotiator@0.4.7 | |
| 192 | + | |
| 193 | +1.0.5 / 2014-06-20 | |
| 194 | +================== | |
| 195 | + | |
| 196 | + * fix crash when unknown extension given | |
| 197 | + | |
| 198 | +1.0.4 / 2014-06-19 | |
| 199 | +================== | |
| 200 | + | |
| 201 | + * use `mime-types` | |
| 202 | + | |
| 203 | +1.0.3 / 2014-06-11 | |
| 204 | +================== | |
| 205 | + | |
| 206 | + * deps: negotiator@0.4.6 | |
| 207 | + - Order by specificity when quality is the same | |
| 208 | + | |
| 209 | +1.0.2 / 2014-05-29 | |
| 210 | +================== | |
| 211 | + | |
| 212 | + * Fix interpretation when header not in request | |
| 213 | + * deps: pin negotiator@0.4.5 | |
| 214 | + | |
| 215 | +1.0.1 / 2014-01-18 | |
| 216 | +================== | |
| 217 | + | |
| 218 | + * Identity encoding isn't always acceptable | |
| 219 | + * deps: negotiator@~0.4.0 | |
| 220 | + | |
| 221 | +1.0.0 / 2013-12-27 | |
| 222 | +================== | |
| 223 | + | |
| 224 | + * Genesis | ... | ... |
| 1 | +++ a/node_modules/accepts/LICENSE | |
| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | +(The MIT License) | |
| 2 | + | |
| 3 | +Copyright (c) 2014 Jonathan Ong <me@jongleberry.com> | |
| 4 | +Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com> | |
| 5 | + | |
| 6 | +Permission is hereby granted, free of charge, to any person obtaining | |
| 7 | +a copy of this software and associated documentation files (the | |
| 8 | +'Software'), to deal in the Software without restriction, including | |
| 9 | +without limitation the rights to use, copy, modify, merge, publish, | |
| 10 | +distribute, sublicense, and/or sell copies of the Software, and to | |
| 11 | +permit persons to whom the Software is furnished to do so, subject to | |
| 12 | +the following conditions: | |
| 13 | + | |
| 14 | +The above copyright notice and this permission notice shall be | |
| 15 | +included in all copies or substantial portions of the Software. | |
| 16 | + | |
| 17 | +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | |
| 18 | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
| 19 | +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
| 20 | +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
| 21 | +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
| 22 | +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
| 23 | +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ... | ... |
| 1 | +++ a/node_modules/accepts/README.md | |
| ... | ... | @@ -0,0 +1,143 @@ |
| 1 | +# accepts | |
| 2 | + | |
| 3 | +[![NPM Version][npm-image]][npm-url] | |
| 4 | +[![NPM Downloads][downloads-image]][downloads-url] | |
| 5 | +[![Node.js Version][node-version-image]][node-version-url] | |
| 6 | +[![Build Status][travis-image]][travis-url] | |
| 7 | +[![Test Coverage][coveralls-image]][coveralls-url] | |
| 8 | + | |
| 9 | +Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator). | |
| 10 | +Extracted from [koa](https://www.npmjs.com/package/koa) for general use. | |
| 11 | + | |
| 12 | +In addition to negotiator, it allows: | |
| 13 | + | |
| 14 | +- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])` | |
| 15 | + as well as `('text/html', 'application/json')`. | |
| 16 | +- Allows type shorthands such as `json`. | |
| 17 | +- Returns `false` when no types match | |
| 18 | +- Treats non-existent headers as `*` | |
| 19 | + | |
| 20 | +## Installation | |
| 21 | + | |
| 22 | +This is a [Node.js](https://nodejs.org/en/) module available through the | |
| 23 | +[npm registry](https://www.npmjs.com/). Installation is done using the | |
| 24 | +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): | |
| 25 | + | |
| 26 | +```sh | |
| 27 | +$ npm install accepts | |
| 28 | +``` | |
| 29 | + | |
| 30 | +## API | |
| 31 | + | |
| 32 | +<!-- eslint-disable no-unused-vars --> | |
| 33 | + | |
| 34 | +```js | |
| 35 | +var accepts = require('accepts') | |
| 36 | +``` | |
| 37 | + | |
| 38 | +### accepts(req) | |
| 39 | + | |
| 40 | +Create a new `Accepts` object for the given `req`. | |
| 41 | + | |
| 42 | +#### .charset(charsets) | |
| 43 | + | |
| 44 | +Return the first accepted charset. If nothing in `charsets` is accepted, | |
| 45 | +then `false` is returned. | |
| 46 | + | |
| 47 | +#### .charsets() | |
| 48 | + | |
| 49 | +Return the charsets that the request accepts, in the order of the client's | |
| 50 | +preference (most preferred first). | |
| 51 | + | |
| 52 | +#### .encoding(encodings) | |
| 53 | + | |
| 54 | +Return the first accepted encoding. If nothing in `encodings` is accepted, | |
| 55 | +then `false` is returned. | |
| 56 | + | |
| 57 | +#### .encodings() | |
| 58 | + | |
| 59 | +Return the encodings that the request accepts, in the order of the client's | |
| 60 | +preference (most preferred first). | |
| 61 | + | |
| 62 | +#### .language(languages) | |
| 63 | + | |
| 64 | +Return the first accepted language. If nothing in `languages` is accepted, | |
| 65 | +then `false` is returned. | |
| 66 | + | |
| 67 | +#### .languages() | |
| 68 | + | |
| 69 | +Return the languages that the request accepts, in the order of the client's | |
| 70 | +preference (most preferred first). | |
| 71 | + | |
| 72 | +#### .type(types) | |
| 73 | + | |
| 74 | +Return the first accepted type (and it is returned as the same text as what | |
| 75 | +appears in the `types` array). If nothing in `types` is accepted, then `false` | |
| 76 | +is returned. | |
| 77 | + | |
| 78 | +The `types` array can contain full MIME types or file extensions. Any value | |
| 79 | +that is not a full MIME types is passed to `require('mime-types').lookup`. | |
| 80 | + | |
| 81 | +#### .types() | |
| 82 | + | |
| 83 | +Return the types that the request accepts, in the order of the client's | |
| 84 | +preference (most preferred first). | |
| 85 | + | |
| 86 | +## Examples | |
| 87 | + | |
| 88 | +### Simple type negotiation | |
| 89 | + | |
| 90 | +This simple example shows how to use `accepts` to return a different typed | |
| 91 | +respond body based on what the client wants to accept. The server lists it's | |
| 92 | +preferences in order and will get back the best match between the client and | |
| 93 | +server. | |
| 94 | + | |
| 95 | +```js | |
| 96 | +var accepts = require('accepts') | |
| 97 | +var http = require('http') | |
| 98 | + | |
| 99 | +function app (req, res) { | |
| 100 | + var accept = accepts(req) | |
| 101 | + | |
| 102 | + // the order of this list is significant; should be server preferred order | |
| 103 | + switch (accept.type(['json', 'html'])) { | |
| 104 | + case 'json': | |
| 105 | + res.setHeader('Content-Type', 'application/json') | |
| 106 | + res.write('{"hello":"world!"}') | |
| 107 | + break | |
| 108 | + case 'html': | |
| 109 | + res.setHeader('Content-Type', 'text/html') | |
| 110 | + res.write('<b>hello, world!</b>') | |
| 111 | + break | |
| 112 | + default: | |
| 113 | + // the fallback is text/plain, so no need to specify it above | |
| 114 | + res.setHeader('Content-Type', 'text/plain') | |
| 115 | + res.write('hello, world!') | |
| 116 | + break | |
| 117 | + } | |
| 118 | + | |
| 119 | + res.end() | |
| 120 | +} | |
| 121 | + | |
| 122 | +http.createServer(app).listen(3000) | |
| 123 | +``` | |
| 124 | + | |
| 125 | +You can test this out with the cURL program: | |
| 126 | +```sh | |
| 127 | +curl -I -H'Accept: text/html' http://localhost:3000/ | |
| 128 | +``` | |
| 129 | + | |
| 130 | +## License | |
| 131 | + | |
| 132 | +[MIT](LICENSE) | |
| 133 | + | |
| 134 | +[npm-image]: https://img.shields.io/npm/v/accepts.svg | |
| 135 | +[npm-url]: https://npmjs.org/package/accepts | |
| 136 | +[node-version-image]: https://img.shields.io/node/v/accepts.svg | |
| 137 | +[node-version-url]: https://nodejs.org/en/download/ | |
| 138 | +[travis-image]: https://img.shields.io/travis/jshttp/accepts/master.svg | |
| 139 | +[travis-url]: https://travis-ci.org/jshttp/accepts | |
| 140 | +[coveralls-image]: https://img.shields.io/coveralls/jshttp/accepts/master.svg | |
| 141 | +[coveralls-url]: https://coveralls.io/r/jshttp/accepts | |
| 142 | +[downloads-image]: https://img.shields.io/npm/dm/accepts.svg | |
| 143 | +[downloads-url]: https://npmjs.org/package/accepts | ... | ... |
| 1 | +++ a/node_modules/accepts/index.js | |
| ... | ... | @@ -0,0 +1,238 @@ |
| 1 | +/*! | |
| 2 | + * accepts | |
| 3 | + * Copyright(c) 2014 Jonathan Ong | |
| 4 | + * Copyright(c) 2015 Douglas Christopher Wilson | |
| 5 | + * MIT Licensed | |
| 6 | + */ | |
| 7 | + | |
| 8 | +'use strict' | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * Module dependencies. | |
| 12 | + * @private | |
| 13 | + */ | |
| 14 | + | |
| 15 | +var Negotiator = require('negotiator') | |
| 16 | +var mime = require('mime-types') | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * Module exports. | |
| 20 | + * @public | |
| 21 | + */ | |
| 22 | + | |
| 23 | +module.exports = Accepts | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * Create a new Accepts object for the given req. | |
| 27 | + * | |
| 28 | + * @param {object} req | |
| 29 | + * @public | |
| 30 | + */ | |
| 31 | + | |
| 32 | +function Accepts (req) { | |
| 33 | + if (!(this instanceof Accepts)) { | |
| 34 | + return new Accepts(req) | |
| 35 | + } | |
| 36 | + | |
| 37 | + this.headers = req.headers | |
| 38 | + this.negotiator = new Negotiator(req) | |
| 39 | +} | |
| 40 | + | |
| 41 | +/** | |
| 42 | + * Check if the given `type(s)` is acceptable, returning | |
| 43 | + * the best match when true, otherwise `undefined`, in which | |
| 44 | + * case you should respond with 406 "Not Acceptable". | |
| 45 | + * | |
| 46 | + * The `type` value may be a single mime type string | |
| 47 | + * such as "application/json", the extension name | |
| 48 | + * such as "json" or an array `["json", "html", "text/plain"]`. When a list | |
| 49 | + * or array is given the _best_ match, if any is returned. | |
| 50 | + * | |
| 51 | + * Examples: | |
| 52 | + * | |
| 53 | + * // Accept: text/html | |
| 54 | + * this.types('html'); | |
| 55 | + * // => "html" | |
| 56 | + * | |
| 57 | + * // Accept: text/*, application/json | |
| 58 | + * this.types('html'); | |
| 59 | + * // => "html" | |
| 60 | + * this.types('text/html'); | |
| 61 | + * // => "text/html" | |
| 62 | + * this.types('json', 'text'); | |
| 63 | + * // => "json" | |
| 64 | + * this.types('application/json'); | |
| 65 | + * // => "application/json" | |
| 66 | + * | |
| 67 | + * // Accept: text/*, application/json | |
| 68 | + * this.types('image/png'); | |
| 69 | + * this.types('png'); | |
| 70 | + * // => undefined | |
| 71 | + * | |
| 72 | + * // Accept: text/*;q=.5, application/json | |
| 73 | + * this.types(['html', 'json']); | |
| 74 | + * this.types('html', 'json'); | |
| 75 | + * // => "json" | |
| 76 | + * | |
| 77 | + * @param {String|Array} types... | |
| 78 | + * @return {String|Array|Boolean} | |
| 79 | + * @public | |
| 80 | + */ | |
| 81 | + | |
| 82 | +Accepts.prototype.type = | |
| 83 | +Accepts.prototype.types = function (types_) { | |
| 84 | + var types = types_ | |
| 85 | + | |
| 86 | + // support flattened arguments | |
| 87 | + if (types && !Array.isArray(types)) { | |
| 88 | + types = new Array(arguments.length) | |
| 89 | + for (var i = 0; i < types.length; i++) { | |
| 90 | + types[i] = arguments[i] | |
| 91 | + } | |
| 92 | + } | |
| 93 | + | |
| 94 | + // no types, return all requested types | |
| 95 | + if (!types || types.length === 0) { | |
| 96 | + return this.negotiator.mediaTypes() | |
| 97 | + } | |
| 98 | + | |
| 99 | + // no accept header, return first given type | |
| 100 | + if (!this.headers.accept) { | |
| 101 | + return types[0] | |
| 102 | + } | |
| 103 | + | |
| 104 | + var mimes = types.map(extToMime) | |
| 105 | + var accepts = this.negotiator.mediaTypes(mimes.filter(validMime)) | |
| 106 | + var first = accepts[0] | |
| 107 | + | |
| 108 | + return first | |
| 109 | + ? types[mimes.indexOf(first)] | |
| 110 | + : false | |
| 111 | +} | |
| 112 | + | |
| 113 | +/** | |
| 114 | + * Return accepted encodings or best fit based on `encodings`. | |
| 115 | + * | |
| 116 | + * Given `Accept-Encoding: gzip, deflate` | |
| 117 | + * an array sorted by quality is returned: | |
| 118 | + * | |
| 119 | + * ['gzip', 'deflate'] | |
| 120 | + * | |
| 121 | + * @param {String|Array} encodings... | |
| 122 | + * @return {String|Array} | |
| 123 | + * @public | |
| 124 | + */ | |
| 125 | + | |
| 126 | +Accepts.prototype.encoding = | |
| 127 | +Accepts.prototype.encodings = function (encodings_) { | |
| 128 | + var encodings = encodings_ | |
| 129 | + | |
| 130 | + // support flattened arguments | |
| 131 | + if (encodings && !Array.isArray(encodings)) { | |
| 132 | + encodings = new Array(arguments.length) | |
| 133 | + for (var i = 0; i < encodings.length; i++) { | |
| 134 | + encodings[i] = arguments[i] | |
| 135 | + } | |
| 136 | + } | |
| 137 | + | |
| 138 | + // no encodings, return all requested encodings | |
| 139 | + if (!encodings || encodings.length === 0) { | |
| 140 | + return this.negotiator.encodings() | |
| 141 | + } | |
| 142 | + | |
| 143 | + return this.negotiator.encodings(encodings)[0] || false | |
| 144 | +} | |
| 145 | + | |
| 146 | +/** | |
| 147 | + * Return accepted charsets or best fit based on `charsets`. | |
| 148 | + * | |
| 149 | + * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5` | |
| 150 | + * an array sorted by quality is returned: | |
| 151 | + * | |
| 152 | + * ['utf-8', 'utf-7', 'iso-8859-1'] | |
| 153 | + * | |
| 154 | + * @param {String|Array} charsets... | |
| 155 | + * @return {String|Array} | |
| 156 | + * @public | |
| 157 | + */ | |
| 158 | + | |
| 159 | +Accepts.prototype.charset = | |
| 160 | +Accepts.prototype.charsets = function (charsets_) { | |
| 161 | + var charsets = charsets_ | |
| 162 | + | |
| 163 | + // support flattened arguments | |
| 164 | + if (charsets && !Array.isArray(charsets)) { | |
| 165 | + charsets = new Array(arguments.length) | |
| 166 | + for (var i = 0; i < charsets.length; i++) { | |
| 167 | + charsets[i] = arguments[i] | |
| 168 | + } | |
| 169 | + } | |
| 170 | + | |
| 171 | + // no charsets, return all requested charsets | |
| 172 | + if (!charsets || charsets.length === 0) { | |
| 173 | + return this.negotiator.charsets() | |
| 174 | + } | |
| 175 | + | |
| 176 | + return this.negotiator.charsets(charsets)[0] || false | |
| 177 | +} | |
| 178 | + | |
| 179 | +/** | |
| 180 | + * Return accepted languages or best fit based on `langs`. | |
| 181 | + * | |
| 182 | + * Given `Accept-Language: en;q=0.8, es, pt` | |
| 183 | + * an array sorted by quality is returned: | |
| 184 | + * | |
| 185 | + * ['es', 'pt', 'en'] | |
| 186 | + * | |
| 187 | + * @param {String|Array} langs... | |
| 188 | + * @return {Array|String} | |
| 189 | + * @public | |
| 190 | + */ | |
| 191 | + | |
| 192 | +Accepts.prototype.lang = | |
| 193 | +Accepts.prototype.langs = | |
| 194 | +Accepts.prototype.language = | |
| 195 | +Accepts.prototype.languages = function (languages_) { | |
| 196 | + var languages = languages_ | |
| 197 | + | |
| 198 | + // support flattened arguments | |
| 199 | + if (languages && !Array.isArray(languages)) { | |
| 200 | + languages = new Array(arguments.length) | |
| 201 | + for (var i = 0; i < languages.length; i++) { | |
| 202 | + languages[i] = arguments[i] | |
| 203 | + } | |
| 204 | + } | |
| 205 | + | |
| 206 | + // no languages, return all requested languages | |
| 207 | + if (!languages || languages.length === 0) { | |
| 208 | + return this.negotiator.languages() | |
| 209 | + } | |
| 210 | + | |
| 211 | + return this.negotiator.languages(languages)[0] || false | |
| 212 | +} | |
| 213 | + | |
| 214 | +/** | |
| 215 | + * Convert extnames to mime. | |
| 216 | + * | |
| 217 | + * @param {String} type | |
| 218 | + * @return {String} | |
| 219 | + * @private | |
| 220 | + */ | |
| 221 | + | |
| 222 | +function extToMime (type) { | |
| 223 | + return type.indexOf('/') === -1 | |
| 224 | + ? mime.lookup(type) | |
| 225 | + : type | |
| 226 | +} | |
| 227 | + | |
| 228 | +/** | |
| 229 | + * Check if mime is valid. | |
| 230 | + * | |
| 231 | + * @param {String} type | |
| 232 | + * @return {String} | |
| 233 | + * @private | |
| 234 | + */ | |
| 235 | + | |
| 236 | +function validMime (type) { | |
| 237 | + return typeof type === 'string' | |
| 238 | +} | ... | ... |
| 1 | +++ a/node_modules/accepts/package.json | |
| ... | ... | @@ -0,0 +1,85 @@ |
| 1 | +{ | |
| 2 | + "_from": "accepts@~1.3.5", | |
| 3 | + "_id": "accepts@1.3.5", | |
| 4 | + "_inBundle": false, | |
| 5 | + "_integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", | |
| 6 | + "_location": "/accepts", | |
| 7 | + "_phantomChildren": {}, | |
| 8 | + "_requested": { | |
| 9 | + "type": "range", | |
| 10 | + "registry": true, | |
| 11 | + "raw": "accepts@~1.3.5", | |
| 12 | + "name": "accepts", | |
| 13 | + "escapedName": "accepts", | |
| 14 | + "rawSpec": "~1.3.5", | |
| 15 | + "saveSpec": null, | |
| 16 | + "fetchSpec": "~1.3.5" | |
| 17 | + }, | |
| 18 | + "_requiredBy": [ | |
| 19 | + "/express" | |
| 20 | + ], | |
| 21 | + "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", | |
| 22 | + "_shasum": "eb777df6011723a3b14e8a72c0805c8e86746bd2", | |
| 23 | + "_spec": "accepts@~1.3.5", | |
| 24 | + "_where": "C:\\Users\\admin\\Documents\\express-project\\node_modules\\express", | |
| 25 | + "bugs": { | |
| 26 | + "url": "https://github.com/jshttp/accepts/issues" | |
| 27 | + }, | |
| 28 | + "bundleDependencies": false, | |
| 29 | + "contributors": [ | |
| 30 | + { | |
| 31 | + "name": "Douglas Christopher Wilson", | |
| 32 | + "email": "doug@somethingdoug.com" | |
| 33 | + }, | |
| 34 | + { | |
| 35 | + "name": "Jonathan Ong", | |
| 36 | + "email": "me@jongleberry.com", | |
| 37 | + "url": "http://jongleberry.com" | |
| 38 | + } | |
| 39 | + ], | |
| 40 | + "dependencies": { | |
| 41 | + "mime-types": "~2.1.18", | |
| 42 | + "negotiator": "0.6.1" | |
| 43 | + }, | |
| 44 | + "deprecated": false, | |
| 45 | + "description": "Higher-level content negotiation", | |
| 46 | + "devDependencies": { | |
| 47 | + "eslint": "4.18.1", | |
| 48 | + "eslint-config-standard": "11.0.0", | |
| 49 | + "eslint-plugin-import": "2.9.0", | |
| 50 | + "eslint-plugin-markdown": "1.0.0-beta.6", | |
| 51 | + "eslint-plugin-node": "6.0.1", | |
| 52 | + "eslint-plugin-promise": "3.6.0", | |
| 53 | + "eslint-plugin-standard": "3.0.1", | |
| 54 | + "istanbul": "0.4.5", | |
| 55 | + "mocha": "~1.21.5" | |
| 56 | + }, | |
| 57 | + "engines": { | |
| 58 | + "node": ">= 0.6" | |
| 59 | + }, | |
| 60 | + "files": [ | |
| 61 | + "LICENSE", | |
| 62 | + "HISTORY.md", | |
| 63 | + "index.js" | |
| 64 | + ], | |
| 65 | + "homepage": "https://github.com/jshttp/accepts#readme", | |
| 66 | + "keywords": [ | |
| 67 | + "content", | |
| 68 | + "negotiation", | |
| 69 | + "accept", | |
| 70 | + "accepts" | |
| 71 | + ], | |
| 72 | + "license": "MIT", | |
| 73 | + "name": "accepts", | |
| 74 | + "repository": { | |
| 75 | + "type": "git", | |
| 76 | + "url": "git+https://github.com/jshttp/accepts.git" | |
| 77 | + }, | |
| 78 | + "scripts": { | |
| 79 | + "lint": "eslint --plugin markdown --ext js,md .", | |
| 80 | + "test": "mocha --reporter spec --check-leaks --bail test/", | |
| 81 | + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", | |
| 82 | + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" | |
| 83 | + }, | |
| 84 | + "version": "1.3.5" | |
| 85 | +} | ... | ... |
| 1 | +++ a/node_modules/align-text/LICENSE | |
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +The MIT License (MIT) | |
| 2 | + | |
| 3 | +Copyright (c) 2015, Jon Schlinkert. | |
| 4 | + | |
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | +of this software and associated documentation files (the "Software"), to deal | |
| 7 | +in the Software without restriction, including without limitation the rights | |
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 9 | +copies of the Software, and to permit persons to whom the Software is | |
| 10 | +furnished to do so, subject to the following conditions: | |
| 11 | + | |
| 12 | +The above copyright notice and this permission notice shall be included in | |
| 13 | +all copies or substantial portions of the Software. | |
| 14 | + | |
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
| 21 | +THE SOFTWARE. | ... | ... |
| 1 | +++ a/node_modules/align-text/README.md | |
| ... | ... | @@ -0,0 +1,236 @@ |
| 1 | +# align-text [](http://badge.fury.io/js/align-text) [](https://travis-ci.org/jonschlinkert/align-text) | |
| 2 | + | |
| 3 | +> Align the text in a string. | |
| 4 | + | |
| 5 | +**Examples** | |
| 6 | + | |
| 7 | +Align text values in an array: | |
| 8 | + | |
| 9 | +```js | |
| 10 | +align([1, 2, 3, 100]); | |
| 11 | +//=> [' 1', ' 2', ' 3', '100'] | |
| 12 | +``` | |
| 13 | + | |
| 14 | +Or [do stuff like this](./example.js): | |
| 15 | + | |
| 16 | +[](./example.js) | |
| 17 | + | |
| 18 | +Visit [the example](./example.js) to see how this works. | |
| 19 | + | |
| 20 | +## Install | |
| 21 | + | |
| 22 | +Install with [npm](https://www.npmjs.com/) | |
| 23 | + | |
| 24 | +```sh | |
| 25 | +$ npm i align-text --save | |
| 26 | +``` | |
| 27 | + | |
| 28 | +## Usage | |
| 29 | + | |
| 30 | +```js | |
| 31 | +var align = require('align-text'); | |
| 32 | +align(text, callback_function_or_integer); | |
| 33 | +``` | |
| 34 | + | |
| 35 | +**Params** | |
| 36 | + | |
| 37 | +* `text` can be a **string or array**. If a string is passed, a string will be returned. If an array is passed, an array will be returned. | |
| 38 | +* `callback|integer`: if an integer, the text will be indented by that amount. If a function, it must return an integer representing the amount of leading indentation to use as `align` loops over each line. | |
| 39 | + | |
| 40 | +**Example** | |
| 41 | + | |
| 42 | +```js | |
| 43 | +align(text, 4); | |
| 44 | +``` | |
| 45 | + | |
| 46 | +Would align: | |
| 47 | + | |
| 48 | +``` | |
| 49 | +abc | |
| 50 | +abc | |
| 51 | +abc | |
| 52 | +``` | |
| 53 | + | |
| 54 | +To: | |
| 55 | + | |
| 56 | +``` | |
| 57 | + abc | |
| 58 | + abc | |
| 59 | + abc | |
| 60 | +``` | |
| 61 | + | |
| 62 | +## callback | |
| 63 | + | |
| 64 | +### params | |
| 65 | + | |
| 66 | +The callback is used to determine the indentation of each line and gets the following params: | |
| 67 | + | |
| 68 | +* `len` the length of the "current" line | |
| 69 | +* `longest` the length of the longest line | |
| 70 | +* `line` the current line (string) being aligned | |
| 71 | +* `lines` the array of all lines | |
| 72 | + | |
| 73 | +### return | |
| 74 | + | |
| 75 | +The callback may return: | |
| 76 | + | |
| 77 | +* an integer that represents the number of spaces to use for padding, | |
| 78 | +* or an object with the following properties: | |
| 79 | + - `indent`: **{Number}** the amount of indentation to use. Default is `0` when an object is returned. | |
| 80 | + - `character`: **{String}** the character to use for indentation. Default is `''` (empty string) when an object is returned. | |
| 81 | + - `prefix`: **{String}** leading characters to use at the beginning of each line. `''` (empty string) when an object is returned. | |
| 82 | + | |
| 83 | +**Integer example:** | |
| 84 | + | |
| 85 | +```js | |
| 86 | +// calculate half the difference between the length | |
| 87 | +// of the current line and the longest line | |
| 88 | +function centerAlign(len, longest, line, lines) { | |
| 89 | + return Math.floor((longest - len) / 2); | |
| 90 | +} | |
| 91 | +``` | |
| 92 | + | |
| 93 | +**Object example:** | |
| 94 | + | |
| 95 | +```js | |
| 96 | +function centerAlign(len, longest, line, lines) { | |
| 97 | + return { | |
| 98 | + character: '\t', | |
| 99 | + indent: Math.floor((longest - len) / 2), | |
| 100 | + prefix: '~ ', | |
| 101 | + } | |
| 102 | +} | |
| 103 | +``` | |
| 104 | + | |
| 105 | +## Usage examples | |
| 106 | + | |
| 107 | +### Center align | |
| 108 | + | |
| 109 | +Using the `centerAlign` function from above: | |
| 110 | + | |
| 111 | +```js | |
| 112 | +align(text, centerAlign); | |
| 113 | +``` | |
| 114 | + | |
| 115 | +Would align this text: | |
| 116 | + | |
| 117 | +```js | |
| 118 | +Lorem ipsum dolor sit amet | |
| 119 | +consectetur adipiscin | |
| 120 | +elit, sed do eiusmod tempor incididun | |
| 121 | +ut labore et dolor | |
| 122 | +magna aliqua. Ut enim ad mini | |
| 123 | +veniam, quis | |
| 124 | +``` | |
| 125 | + | |
| 126 | +Resulting in this: | |
| 127 | + | |
| 128 | +``` | |
| 129 | + Lorem ipsum dolor sit amet, | |
| 130 | + consectetur adipiscing | |
| 131 | +elit, sed do eiusmod tempor incididunt | |
| 132 | + ut labore et dolore | |
| 133 | + magna aliqua. Ut enim ad minim | |
| 134 | + veniam, quis | |
| 135 | +``` | |
| 136 | + | |
| 137 | +**Customize** | |
| 138 | + | |
| 139 | +If you wanted to add more padding on the left, just pass the number in the callback. | |
| 140 | + | |
| 141 | +For example, to add 4 spaces before every line: | |
| 142 | + | |
| 143 | +```js | |
| 144 | +function centerAlign(len, longest, line, lines) { | |
| 145 | + return 4 + Math.floor((longest - len) / 2); | |
| 146 | +} | |
| 147 | +``` | |
| 148 | + | |
| 149 | +Would result in: | |
| 150 | + | |
| 151 | +``` | |
| 152 | + Lorem ipsum dolor sit amet, | |
| 153 | + consectetur adipiscing | |
| 154 | + elit, sed do eiusmod tempor incididunt | |
| 155 | + ut labore et dolore | |
| 156 | + magna aliqua. Ut enim ad minim | |
| 157 | + veniam, quis | |
| 158 | +``` | |
| 159 | + | |
| 160 | +### Bullets | |
| 161 | + | |
| 162 | +```js | |
| 163 | +align(text, function (len, max, line, lines) { | |
| 164 | + return {prefix: ' - '}; | |
| 165 | +}); | |
| 166 | +``` | |
| 167 | + | |
| 168 | +Would return: | |
| 169 | + | |
| 170 | +``` | |
| 171 | +- Lorem ipsum dolor sit amet, | |
| 172 | +- consectetur adipiscing | |
| 173 | +- elit, sed do eiusmod tempor incididunt | |
| 174 | +- ut labore et dolore | |
| 175 | +- magna aliqua. Ut enim ad minim | |
| 176 | +- veniam, quis | |
| 177 | +``` | |
| 178 | + | |
| 179 | +### Different indent character | |
| 180 | + | |
| 181 | +```js | |
| 182 | +align(text, function (len, max, line, lines) { | |
| 183 | + return { | |
| 184 | + indent: Math.floor((max - len) / 2), | |
| 185 | + character: '~', | |
| 186 | + }; | |
| 187 | +}); | |
| 188 | +``` | |
| 189 | + | |
| 190 | +Would return | |
| 191 | + | |
| 192 | +``` | |
| 193 | +~~~~~Lorem ipsum dolor sit amet, | |
| 194 | +~~~~~~~~consectetur adipiscing | |
| 195 | +elit, sed do eiusmod tempor incididunt | |
| 196 | +~~~~~~~~~ut labore et dolore | |
| 197 | +~~~~magna aliqua. Ut enim ad minim | |
| 198 | +~~~~~~~~~~~~~veniam, quis | |
| 199 | +``` | |
| 200 | + | |
| 201 | +## Related projects | |
| 202 | + | |
| 203 | +* [center-align](https://github.com/jonschlinkert/center-align): Center-align the text in a string. | |
| 204 | +* [justify](https://github.com/bahamas10/node-justify): Left or right (or both) justify text using a custom width and character | |
| 205 | +* [longest](https://github.com/jonschlinkert/longest): Get the longest item in an array. | |
| 206 | +* [right-align](https://github.com/jonschlinkert/right-align): Right-align the text in a string. | |
| 207 | +* [repeat-string](https://github.com/jonschlinkert/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. | |
| 208 | +* [word-wrap](https://github.com/jonschlinkert/word-wrap): Wrap words to a specified length. | |
| 209 | + | |
| 210 | +## Running tests | |
| 211 | + | |
| 212 | +Install dev dependencies: | |
| 213 | + | |
| 214 | +```sh | |
| 215 | +$ npm i -d && npm test | |
| 216 | +``` | |
| 217 | + | |
| 218 | +## Contributing | |
| 219 | + | |
| 220 | +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/align-text/issues/new) | |
| 221 | + | |
| 222 | +## Author | |
| 223 | + | |
| 224 | +**Jon Schlinkert** | |
| 225 | + | |
| 226 | ++ [github/jonschlinkert](https://github.com/jonschlinkert) | |
| 227 | ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | |
| 228 | + | |
| 229 | +## License | |
| 230 | + | |
| 231 | +Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert) | |
| 232 | +Released under the MIT license. | |
| 233 | + | |
| 234 | +*** | |
| 235 | + | |
| 236 | +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 09, 2015._ | ... | ... |
| 1 | +++ a/node_modules/align-text/index.js | |
| ... | ... | @@ -0,0 +1,52 @@ |
| 1 | +/*! | |
| 2 | + * align-text <https://github.com/jonschlinkert/align-text> | |
| 3 | + * | |
| 4 | + * Copyright (c) 2015, Jon Schlinkert. | |
| 5 | + * Licensed under the MIT License. | |
| 6 | + */ | |
| 7 | + | |
| 8 | +'use strict'; | |
| 9 | + | |
| 10 | +var typeOf = require('kind-of'); | |
| 11 | +var repeat = require('repeat-string'); | |
| 12 | +var longest = require('longest'); | |
| 13 | + | |
| 14 | +module.exports = function alignText(val, fn) { | |
| 15 | + var lines, type = typeOf(val); | |
| 16 | + | |
| 17 | + if (type === 'array') { | |
| 18 | + lines = val; | |
| 19 | + } else if (type === 'string') { | |
| 20 | + lines = val.split(/(?:\r\n|\n)/); | |
| 21 | + } else { | |
| 22 | + throw new TypeError('align-text expects a string or array.'); | |
| 23 | + } | |
| 24 | + | |
| 25 | + var fnType = typeOf(fn); | |
| 26 | + var len = lines.length; | |
| 27 | + var max = longest(lines); | |
| 28 | + var res = [], i = 0; | |
| 29 | + | |
| 30 | + while (len--) { | |
| 31 | + var line = String(lines[i++]); | |
| 32 | + var diff; | |
| 33 | + | |
| 34 | + if (fnType === 'function') { | |
| 35 | + diff = fn(line.length, max.length, line, lines, i); | |
| 36 | + } else if (fnType === 'number') { | |
| 37 | + diff = fn; | |
| 38 | + } else { | |
| 39 | + diff = max.length - line.length; | |
| 40 | + } | |
| 41 | + | |
| 42 | + if (typeOf(diff) === 'number') { | |
| 43 | + res.push(repeat(' ', diff) + line); | |
| 44 | + } else if (typeOf(diff) === 'object') { | |
| 45 | + var result = repeat(diff.character || ' ', diff.indent || 0); | |
| 46 | + res.push((diff.prefix || '') + result + line); | |
| 47 | + } | |
| 48 | + } | |
| 49 | + | |
| 50 | + if (type === 'array') return res; | |
| 51 | + return res.join('\n'); | |
| 52 | +}; | ... | ... |
| 1 | +++ a/node_modules/align-text/package.json | |
| ... | ... | @@ -0,0 +1,78 @@ |
| 1 | +{ | |
| 2 | + "_from": "align-text@^0.1.3", | |
| 3 | + "_id": "align-text@0.1.4", | |
| 4 | + "_inBundle": false, | |
| 5 | + "_integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", | |
| 6 | + "_location": "/align-text", | |
| 7 | + "_phantomChildren": {}, | |
| 8 | + "_requested": { | |
| 9 | + "type": "range", | |
| 10 | + "registry": true, | |
| 11 | + "raw": "align-text@^0.1.3", | |
| 12 | + "name": "align-text", | |
| 13 | + "escapedName": "align-text", | |
| 14 | + "rawSpec": "^0.1.3", | |
| 15 | + "saveSpec": null, | |
| 16 | + "fetchSpec": "^0.1.3" | |
| 17 | + }, | |
| 18 | + "_requiredBy": [ | |
| 19 | + "/center-align", | |
| 20 | + "/right-align" | |
| 21 | + ], | |
| 22 | + "_resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", | |
| 23 | + "_shasum": "0cd90a561093f35d0a99256c22b7069433fad117", | |
| 24 | + "_spec": "align-text@^0.1.3", | |
| 25 | + "_where": "C:\\Users\\admin\\Documents\\express-project\\node_modules\\center-align", | |
| 26 | + "author": { | |
| 27 | + "name": "Jon Schlinkert", | |
| 28 | + "url": "https://github.com/jonschlinkert" | |
| 29 | + }, | |
| 30 | + "bugs": { | |
| 31 | + "url": "https://github.com/jonschlinkert/align-text/issues" | |
| 32 | + }, | |
| 33 | + "bundleDependencies": false, | |
| 34 | + "dependencies": { | |
| 35 | + "kind-of": "^3.0.2", | |
| 36 | + "longest": "^1.0.1", | |
| 37 | + "repeat-string": "^1.5.2" | |
| 38 | + }, | |
| 39 | + "deprecated": false, | |
| 40 | + "description": "Align the text in a string.", | |
| 41 | + "devDependencies": { | |
| 42 | + "mocha": "*", | |
| 43 | + "should": "*", | |
| 44 | + "word-wrap": "^1.0.3" | |
| 45 | + }, | |
| 46 | + "engines": { | |
| 47 | + "node": ">=0.10.0" | |
| 48 | + }, | |
| 49 | + "files": [ | |
| 50 | + "index.js" | |
| 51 | + ], | |
| 52 | + "homepage": "https://github.com/jonschlinkert/align-text", | |
| 53 | + "keywords": [ | |
| 54 | + "align", | |
| 55 | + "align-center", | |
| 56 | + "alignment", | |
| 57 | + "center", | |
| 58 | + "center-align", | |
| 59 | + "indent", | |
| 60 | + "pad", | |
| 61 | + "padding", | |
| 62 | + "right", | |
| 63 | + "right-align", | |
| 64 | + "text", | |
| 65 | + "typography" | |
| 66 | + ], | |
| 67 | + "license": "MIT", | |
| 68 | + "main": "index.js", | |
| 69 | + "name": "align-text", | |
| 70 | + "repository": { | |
| 71 | + "type": "git", | |
| 72 | + "url": "git://github.com/jonschlinkert/align-text.git" | |
| 73 | + }, | |
| 74 | + "scripts": { | |
| 75 | + "test": "mocha" | |
| 76 | + }, | |
| 77 | + "version": "0.1.4" | |
| 78 | +} | ... | ... |
| 1 | +++ a/node_modules/ansi-regex/license | |
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +The MIT License (MIT) | |
| 2 | + | |
| 3 | +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) | |
| 4 | + | |
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | +of this software and associated documentation files (the "Software"), to deal | |
| 7 | +in the Software without restriction, including without limitation the rights | |
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 9 | +copies of the Software, and to permit persons to whom the Software is | |
| 10 | +furnished to do so, subject to the following conditions: | |
| 11 | + | |
| 12 | +The above copyright notice and this permission notice shall be included in | |
| 13 | +all copies or substantial portions of the Software. | |
| 14 | + | |
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
| 21 | +THE SOFTWARE. | ... | ... |
| 1 | +++ a/node_modules/ansi-regex/package.json | |
| ... | ... | @@ -0,0 +1,109 @@ |
| 1 | +{ | |
| 2 | + "_from": "ansi-regex@^2.0.0", | |
| 3 | + "_id": "ansi-regex@2.1.1", | |
| 4 | + "_inBundle": false, | |
| 5 | + "_integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", | |
| 6 | + "_location": "/ansi-regex", | |
| 7 | + "_phantomChildren": {}, | |
| 8 | + "_requested": { | |
| 9 | + "type": "range", | |
| 10 | + "registry": true, | |
| 11 | + "raw": "ansi-regex@^2.0.0", | |
| 12 | + "name": "ansi-regex", | |
| 13 | + "escapedName": "ansi-regex", | |
| 14 | + "rawSpec": "^2.0.0", | |
| 15 | + "saveSpec": null, | |
| 16 | + "fetchSpec": "^2.0.0" | |
| 17 | + }, | |
| 18 | + "_requiredBy": [ | |
| 19 | + "/has-ansi", | |
| 20 | + "/strip-ansi" | |
| 21 | + ], | |
| 22 | + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", | |
| 23 | + "_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df", | |
| 24 | + "_spec": "ansi-regex@^2.0.0", | |
| 25 | + "_where": "C:\\Users\\admin\\Documents\\express-project\\node_modules\\has-ansi", | |
| 26 | + "author": { | |
| 27 | + "name": "Sindre Sorhus", | |
| 28 | + "email": "sindresorhus@gmail.com", | |
| 29 | + "url": "sindresorhus.com" | |
| 30 | + }, | |
| 31 | + "bugs": { | |
| 32 | + "url": "https://github.com/chalk/ansi-regex/issues" | |
| 33 | + }, | |
| 34 | + "bundleDependencies": false, | |
| 35 | + "deprecated": false, | |
| 36 | + "description": "Regular expression for matching ANSI escape codes", | |
| 37 | + "devDependencies": { | |
| 38 | + "ava": "0.17.0", | |
| 39 | + "xo": "0.16.0" | |
| 40 | + }, | |
| 41 | + "engines": { | |
| 42 | + "node": ">=0.10.0" | |
| 43 | + }, | |
| 44 | + "files": [ | |
| 45 | + "index.js" | |
| 46 | + ], | |
| 47 | + "homepage": "https://github.com/chalk/ansi-regex#readme", | |
| 48 | + "keywords": [ | |
| 49 | + "ansi", | |
| 50 | + "styles", | |
| 51 | + "color", | |
| 52 | + "colour", | |
| 53 | + "colors", | |
| 54 | + "terminal", | |
| 55 | + "console", | |
| 56 | + "cli", | |
| 57 | + "string", | |
| 58 | + "tty", | |
| 59 | + "escape", | |
| 60 | + "formatting", | |
| 61 | + "rgb", | |
| 62 | + "256", | |
| 63 | + "shell", | |
| 64 | + "xterm", | |
| 65 | + "command-line", | |
| 66 | + "text", | |
| 67 | + "regex", | |
| 68 | + "regexp", | |
| 69 | + "re", | |
| 70 | + "match", | |
| 71 | + "test", | |
| 72 | + "find", | |
| 73 | + "pattern" | |
| 74 | + ], | |
| 75 | + "license": "MIT", | |
| 76 | + "maintainers": [ | |
| 77 | + { | |
| 78 | + "name": "Sindre Sorhus", | |
| 79 | + "email": "sindresorhus@gmail.com", | |
| 80 | + "url": "sindresorhus.com" | |
| 81 | + }, | |
| 82 | + { | |
| 83 | + "name": "Joshua Appelman", | |
| 84 | + "email": "jappelman@xebia.com", | |
| 85 | + "url": "jbnicolai.com" | |
| 86 | + }, | |
| 87 | + { | |
| 88 | + "name": "JD Ballard", | |
| 89 | + "email": "i.am.qix@gmail.com", | |
| 90 | + "url": "github.com/qix-" | |
| 91 | + } | |
| 92 | + ], | |
| 93 | + "name": "ansi-regex", | |
| 94 | + "repository": { | |
| 95 | + "type": "git", | |
| 96 | + "url": "git+https://github.com/chalk/ansi-regex.git" | |
| 97 | + }, | |
| 98 | + "scripts": { | |
| 99 | + "test": "xo && ava --verbose", | |
| 100 | + "view-supported": "node fixtures/view-codes.js" | |
| 101 | + }, | |
| 102 | + "version": "2.1.1", | |
| 103 | + "xo": { | |
| 104 | + "rules": { | |
| 105 | + "guard-for-in": 0, | |
| 106 | + "no-loop-func": 0 | |
| 107 | + } | |
| 108 | + } | |
| 109 | +} | ... | ... |
| 1 | +++ a/node_modules/ansi-regex/readme.md | |
| ... | ... | @@ -0,0 +1,39 @@ |
| 1 | +# ansi-regex [](https://travis-ci.org/chalk/ansi-regex) | |
| 2 | + | |
| 3 | +> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) | |
| 4 | + | |
| 5 | + | |
| 6 | +## Install | |
| 7 | + | |
| 8 | +``` | |
| 9 | +$ npm install --save ansi-regex | |
| 10 | +``` | |
| 11 | + | |
| 12 | + | |
| 13 | +## Usage | |
| 14 | + | |
| 15 | +```js | |
| 16 | +const ansiRegex = require('ansi-regex'); | |
| 17 | + | |
| 18 | +ansiRegex().test('\u001b[4mcake\u001b[0m'); | |
| 19 | +//=> true | |
| 20 | + | |
| 21 | +ansiRegex().test('cake'); | |
| 22 | +//=> false | |
| 23 | + | |
| 24 | +'\u001b[4mcake\u001b[0m'.match(ansiRegex()); | |
| 25 | +//=> ['\u001b[4m', '\u001b[0m'] | |
| 26 | +``` | |
| 27 | + | |
| 28 | +## FAQ | |
| 29 | + | |
| 30 | +### Why do you test for codes not in the ECMA 48 standard? | |
| 31 | + | |
| 32 | +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. | |
| 33 | + | |
| 34 | +On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. | |
| 35 | + | |
| 36 | + | |
| 37 | +## License | |
| 38 | + | |
| 39 | +MIT © [Sindre Sorhus](http://sindresorhus.com) | ... | ... |
| 1 | +++ a/node_modules/ansi-styles/index.js | |
| ... | ... | @@ -0,0 +1,65 @@ |
| 1 | +'use strict'; | |
| 2 | + | |
| 3 | +function assembleStyles () { | |
| 4 | + var styles = { | |
| 5 | + modifiers: { | |
| 6 | + reset: [0, 0], | |
| 7 | + bold: [1, 22], // 21 isn't widely supported and 22 does the same thing | |
| 8 | + dim: [2, 22], | |
| 9 | + italic: [3, 23], | |
| 10 | + underline: [4, 24], | |
| 11 | + inverse: [7, 27], | |
| 12 | + hidden: [8, 28], | |
| 13 | + strikethrough: [9, 29] | |
| 14 | + }, | |
| 15 | + colors: { | |
| 16 | + black: [30, 39], | |
| 17 | + red: [31, 39], | |
| 18 | + green: [32, 39], | |
| 19 | + yellow: [33, 39], | |
| 20 | + blue: [34, 39], | |
| 21 | + magenta: [35, 39], | |
| 22 | + cyan: [36, 39], | |
| 23 | + white: [37, 39], | |
| 24 | + gray: [90, 39] | |
| 25 | + }, | |
| 26 | + bgColors: { | |
| 27 | + bgBlack: [40, 49], | |
| 28 | + bgRed: [41, 49], | |
| 29 | + bgGreen: [42, 49], | |
| 30 | + bgYellow: [43, 49], | |
| 31 | + bgBlue: [44, 49], | |
| 32 | + bgMagenta: [45, 49], | |
| 33 | + bgCyan: [46, 49], | |
| 34 | + bgWhite: [47, 49] | |
| 35 | + } | |
| 36 | + }; | |
| 37 | + | |
| 38 | + // fix humans | |
| 39 | + styles.colors.grey = styles.colors.gray; | |
| 40 | + | |
| 41 | + Object.keys(styles).forEach(function (groupName) { | |
| 42 | + var group = styles[groupName]; | |
| 43 | + | |
| 44 | + Object.keys(group).forEach(function (styleName) { | |
| 45 | + var style = group[styleName]; | |
| 46 | + | |
| 47 | + styles[styleName] = group[styleName] = { | |
| 48 | + open: '\u001b[' + style[0] + 'm', | |
| 49 | + close: '\u001b[' + style[1] + 'm' | |
| 50 | + }; | |
| 51 | + }); | |
| 52 | + | |
| 53 | + Object.defineProperty(styles, groupName, { | |
| 54 | + value: group, | |
| 55 | + enumerable: false | |
| 56 | + }); | |
| 57 | + }); | |
| 58 | + | |
| 59 | + return styles; | |
| 60 | +} | |
| 61 | + | |
| 62 | +Object.defineProperty(module, 'exports', { | |
| 63 | + enumerable: true, | |
| 64 | + get: assembleStyles | |
| 65 | +}); | ... | ... |
| 1 | +++ a/node_modules/ansi-styles/license | |
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +The MIT License (MIT) | |
| 2 | + | |
| 3 | +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) | |
| 4 | + | |
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | +of this software and associated documentation files (the "Software"), to deal | |
| 7 | +in the Software without restriction, including without limitation the rights | |
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 9 | +copies of the Software, and to permit persons to whom the Software is | |
| 10 | +furnished to do so, subject to the following conditions: | |
| 11 | + | |
| 12 | +The above copyright notice and this permission notice shall be included in | |
| 13 | +all copies or substantial portions of the Software. | |
| 14 | + | |
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
| 21 | +THE SOFTWARE. | ... | ... |
| 1 | +++ a/node_modules/ansi-styles/package.json | |
| ... | ... | @@ -0,0 +1,90 @@ |
| 1 | +{ | |
| 2 | + "_from": "ansi-styles@^2.2.1", | |
| 3 | + "_id": "ansi-styles@2.2.1", | |
| 4 | + "_inBundle": false, | |
| 5 | + "_integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", | |
| 6 | + "_location": "/ansi-styles", | |
| 7 | + "_phantomChildren": {}, | |
| 8 | + "_requested": { | |
| 9 | + "type": "range", | |
| 10 | + "registry": true, | |
| 11 | + "raw": "ansi-styles@^2.2.1", | |
| 12 | + "name": "ansi-styles", | |
| 13 | + "escapedName": "ansi-styles", | |
| 14 | + "rawSpec": "^2.2.1", | |
| 15 | + "saveSpec": null, | |
| 16 | + "fetchSpec": "^2.2.1" | |
| 17 | + }, | |
| 18 | + "_requiredBy": [ | |
| 19 | + "/chalk" | |
| 20 | + ], | |
| 21 | + "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", | |
| 22 | + "_shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe", | |
| 23 | + "_spec": "ansi-styles@^2.2.1", | |
| 24 | + "_where": "C:\\Users\\admin\\Documents\\express-project\\node_modules\\chalk", | |
| 25 | + "author": { | |
| 26 | + "name": "Sindre Sorhus", | |
| 27 | + "email": "sindresorhus@gmail.com", | |
| 28 | + "url": "sindresorhus.com" | |
| 29 | + }, | |
| 30 | + "bugs": { | |
| 31 | + "url": "https://github.com/chalk/ansi-styles/issues" | |
| 32 | + }, | |
| 33 | + "bundleDependencies": false, | |
| 34 | + "deprecated": false, | |
| 35 | + "description": "ANSI escape codes for styling strings in the terminal", | |
| 36 | + "devDependencies": { | |
| 37 | + "mocha": "*" | |
| 38 | + }, | |
| 39 | + "engines": { | |
| 40 | + "node": ">=0.10.0" | |
| 41 | + }, | |
| 42 | + "files": [ | |
| 43 | + "index.js" | |
| 44 | + ], | |
| 45 | + "homepage": "https://github.com/chalk/ansi-styles#readme", | |
| 46 | + "keywords": [ | |
| 47 | + "ansi", | |
| 48 | + "styles", | |
| 49 | + "color", | |
| 50 | + "colour", | |
| 51 | + "colors", | |
| 52 | + "terminal", | |
| 53 | + "console", | |
| 54 | + "cli", | |
| 55 | + "string", | |
| 56 | + "tty", | |
| 57 | + "escape", | |
| 58 | + "formatting", | |
| 59 | + "rgb", | |
| 60 | + "256", | |
| 61 | + "shell", | |
| 62 | + "xterm", | |
| 63 | + "log", | |
| 64 | + "logging", | |
| 65 | + "command-line", | |
| 66 | + "text" | |
| 67 | + ], | |
| 68 | + "license": "MIT", | |
| 69 | + "maintainers": [ | |
| 70 | + { | |
| 71 | + "name": "Sindre Sorhus", | |
| 72 | + "email": "sindresorhus@gmail.com", | |
| 73 | + "url": "sindresorhus.com" | |
| 74 | + }, | |
| 75 | + { | |
| 76 | + "name": "Joshua Appelman", | |
| 77 | + "email": "jappelman@xebia.com", | |
| 78 | + "url": "jbnicolai.com" | |
| 79 | + } | |
| 80 | + ], | |
| 81 | + "name": "ansi-styles", | |
| 82 | + "repository": { | |
| 83 | + "type": "git", | |
| 84 | + "url": "git+https://github.com/chalk/ansi-styles.git" | |
| 85 | + }, | |
| 86 | + "scripts": { | |
| 87 | + "test": "mocha" | |
| 88 | + }, | |
| 89 | + "version": "2.2.1" | |
| 90 | +} | ... | ... |
| 1 | +++ a/node_modules/ansi-styles/readme.md | |
| ... | ... | @@ -0,0 +1,86 @@ |
| 1 | +# ansi-styles [](https://travis-ci.org/chalk/ansi-styles) | |
| 2 | + | |
| 3 | +> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal | |
| 4 | + | |
| 5 | +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | +## Install | |
| 11 | + | |
| 12 | +``` | |
| 13 | +$ npm install --save ansi-styles | |
| 14 | +``` | |
| 15 | + | |
| 16 | + | |
| 17 | +## Usage | |
| 18 | + | |
| 19 | +```js | |
| 20 | +var ansi = require('ansi-styles'); | |
| 21 | + | |
| 22 | +console.log(ansi.green.open + 'Hello world!' + ansi.green.close); | |
| 23 | +``` | |
| 24 | + | |
| 25 | + | |
| 26 | +## API | |
| 27 | + | |
| 28 | +Each style has an `open` and `close` property. | |
| 29 | + | |
| 30 | + | |
| 31 | +## Styles | |
| 32 | + | |
| 33 | +### Modifiers | |
| 34 | + | |
| 35 | +- `reset` | |
| 36 | +- `bold` | |
| 37 | +- `dim` | |
| 38 | +- `italic` *(not widely supported)* | |
| 39 | +- `underline` | |
| 40 | +- `inverse` | |
| 41 | +- `hidden` | |
| 42 | +- `strikethrough` *(not widely supported)* | |
| 43 | + | |
| 44 | +### Colors | |
| 45 | + | |
| 46 | +- `black` | |
| 47 | +- `red` | |
| 48 | +- `green` | |
| 49 | +- `yellow` | |
| 50 | +- `blue` | |
| 51 | +- `magenta` | |
| 52 | +- `cyan` | |
| 53 | +- `white` | |
| 54 | +- `gray` | |
| 55 | + | |
| 56 | +### Background colors | |
| 57 | + | |
| 58 | +- `bgBlack` | |
| 59 | +- `bgRed` | |
| 60 | +- `bgGreen` | |
| 61 | +- `bgYellow` | |
| 62 | +- `bgBlue` | |
| 63 | +- `bgMagenta` | |
| 64 | +- `bgCyan` | |
| 65 | +- `bgWhite` | |
| 66 | + | |
| 67 | + | |
| 68 | +## Advanced usage | |
| 69 | + | |
| 70 | +By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. | |
| 71 | + | |
| 72 | +- `ansi.modifiers` | |
| 73 | +- `ansi.colors` | |
| 74 | +- `ansi.bgColors` | |
| 75 | + | |
| 76 | + | |
| 77 | +###### Example | |
| 78 | + | |
| 79 | +```js | |
| 80 | +console.log(ansi.colors.green.open); | |
| 81 | +``` | |
| 82 | + | |
| 83 | + | |
| 84 | +## License | |
| 85 | + | |
| 86 | +MIT © [Sindre Sorhus](http://sindresorhus.com) | ... | ... |
| 1 | +++ a/node_modules/app-module-path/.jshintrc | |
| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | +{ | |
| 2 | + "node" : true, | |
| 3 | + "es5" : false, | |
| 4 | + "browser" : true, | |
| 5 | + "boss" : false, | |
| 6 | + "curly": false, | |
| 7 | + "debug": false, | |
| 8 | + "devel": false, | |
| 9 | + "eqeqeq": true, | |
| 10 | + "evil": true, | |
| 11 | + "forin": false, | |
| 12 | + "immed": true, | |
| 13 | + "laxbreak": false, | |
| 14 | + "newcap": true, | |
| 15 | + "noarg": true, | |
| 16 | + "noempty": false, | |
| 17 | + "nonew": true, | |
| 18 | + "nomen": false, | |
| 19 | + "onevar": false, | |
| 20 | + "plusplus": false, | |
| 21 | + "regexp": false, | |
| 22 | + "undef": true, | |
| 23 | + "sub": false, | |
| 24 | + "white": false, | |
| 25 | + "eqeqeq": false, | |
| 26 | + "latedef": "func", | |
| 27 | + "unused": "vars", | |
| 28 | + "strict": false, | |
| 29 | + "eqnull": true | |
| 30 | +} | ... | ... |
| 1 | +++ a/node_modules/app-module-path/README.md | |
| ... | ... | @@ -0,0 +1,133 @@ |
| 1 | +[](https://nodei.co/npm/app-module-path/) | |
| 2 | + | |
| 3 | +app-module-path | |
| 4 | +===================== | |
| 5 | + | |
| 6 | +This simple module enables you to add additional directories to the Node.js module search path (for top-level app modules only). This allows application-level modules to be required as if they were installed into the `node_modules` directory. | |
| 7 | + | |
| 8 | +## Installation | |
| 9 | + | |
| 10 | +`npm install app-module-path --save` | |
| 11 | + | |
| 12 | +## Usage | |
| 13 | +```javascript | |
| 14 | +// ***IMPORTANT**: The following line should be added to the very | |
| 15 | +// beginning of your main script! | |
| 16 | +require('app-module-path').addPath(baseDir); | |
| 17 | +``` | |
| 18 | + | |
| 19 | +__IMPORTANT:__ | |
| 20 | +The search path should be modified before any modules are loaded! | |
| 21 | + | |
| 22 | +__Example:__ | |
| 23 | + | |
| 24 | +In your `my-app/index.js` (or `my-app/server.js`) file: | |
| 25 | +```javascript | |
| 26 | +// Add the root project directory to the app module search path: | |
| 27 | +require('app-module-path').addPath(__dirname); | |
| 28 | +``` | |
| 29 | + | |
| 30 | +Given the following example directory structure: | |
| 31 | + | |
| 32 | +- **my-app/** | |
| 33 | + - **src/** - Source code and application modules directory | |
| 34 | + - **foo/** - A module directory | |
| 35 | + - index.js | |
| 36 | + - **bar/** - Another module directory | |
| 37 | + - index.js | |
| 38 | + - **node_modules/** - Installed modules | |
| 39 | + - **installed-baz/** - An installed module | |
| 40 | + - index.js | |
| 41 | + - index.js - Main script | |
| 42 | + | |
| 43 | +The following will work for any modules under the `src` directory: | |
| 44 | +```javascript | |
| 45 | +// All of the following lines will work in "src/foo/index.js" and "src/bar/index.js": | |
| 46 | +var foo = require('src/foo'); // Works | |
| 47 | +var bar = require('src/bar'); // Works | |
| 48 | +var baz = require('installed-baz'); // Works | |
| 49 | +``` | |
| 50 | + | |
| 51 | +Lastly, by design, installed modules (i.e. modules under the `node_modules` directory) will not be able to require application-level modules so the following will ___not___ work: | |
| 52 | + | |
| 53 | +```javascript | |
| 54 | +// All of the following lines will *not* work in "node_modules/installed-baz/index.js"! | |
| 55 | +var foo = require('src/foo'); // Fails | |
| 56 | +var bar = require('src/bar'); // Fails | |
| 57 | +``` | |
| 58 | + | |
| 59 | +## Alternate Usage (`app-module-path/register`) | |
| 60 | + | |
| 61 | +This module supports an alternate method of adding a path to the Node.js module search path that requires less code. Requiring or importing the `app-module-path/register` module will result in the directory of the calling module being added to the Node.js module search path as shown below: | |
| 62 | + | |
| 63 | +## Explicitly enabling a directory/package | |
| 64 | + | |
| 65 | +By default, `app-module-path` will not attempt to resolve app modules from a directory that is found to be within a `node_modules` directory. This behavior can be changed by explicitly enabling `app-module-path` to work for descendent modules of a specific directory. For example: | |
| 66 | + | |
| 67 | +```javascript | |
| 68 | +var packageDir = path.dirname(require.resolve('installed-module-allowed')); | |
| 69 | +require('../').enableForDir(packageDir); | |
| 70 | +``` | |
| 71 | + | |
| 72 | + | |
| 73 | +### ES5 | |
| 74 | + | |
| 75 | +```javascript | |
| 76 | +require('app-module-path/register'); | |
| 77 | + | |
| 78 | +// Is equivalent to: | |
| 79 | +require('app-module-path').addPath(__dirname); | |
| 80 | +``` | |
| 81 | + | |
| 82 | +### ES6 | |
| 83 | + | |
| 84 | +```javascript | |
| 85 | +import "app-module-path/register"; | |
| 86 | + | |
| 87 | +// Is equivalent to: | |
| 88 | +import { addPath } from 'app-module-path'; | |
| 89 | +addPath(__dirname); | |
| 90 | +``` | |
| 91 | + | |
| 92 | +## Alternative Usage (`app-module-path/cwd`) | |
| 93 | + | |
| 94 | +Additionally, requiring or importing `app-module-path/cwd` will result in the current working directory of the Node.js process being added to the module search path as shown below: | |
| 95 | + | |
| 96 | +### ES5 | |
| 97 | + | |
| 98 | +```javascript | |
| 99 | +require('app-module-path/cwd'); | |
| 100 | + | |
| 101 | +// Is equivalent to: | |
| 102 | +require('app-module-path').addPath(process.cwd()); | |
| 103 | +``` | |
| 104 | + | |
| 105 | +### ES6 | |
| 106 | + | |
| 107 | +```javascript | |
| 108 | +import "app-module-path/cwd"; | |
| 109 | + | |
| 110 | +// Is equivalent to: | |
| 111 | +import { addPath } from 'app-module-path'; | |
| 112 | +addPath(process.cwd()); | |
| 113 | +``` | |
| 114 | + | |
| 115 | +## Additional Notes | |
| 116 | + | |
| 117 | +* __Search path order:__ | |
| 118 | + * App module paths will be added to the end of the default module search path. That is, if a module with the same name exists in both a `node_modules` directory and an application module directory then the module in the `node_modules` directory will be loaded since it is found first. | |
| 119 | + *This behavior is new in v2.x. In v1.x, this search order was reversed* | |
| 120 | + | |
| 121 | +* __Node.js compatibility:__ | |
| 122 | + * This module depends on overriding/wrapping a built-in Node.js method, and it is possible (but unlikely) that this behavior could be broken in a future release of Node.js (at which point a workaround would need to be used) | |
| 123 | + * This module will _not_ change or break modules installed into the `node_modules` directory. | |
| 124 | +* __Recommendations:__ | |
| 125 | + * Since this module changes the Node.js convention of how non-relative modules are resolved, it is recommended (but not required) to put all app modules in a common directory below the application root (such as `my-app/src` or `my-app/app_modules`) and then to add the application root to the search path. The require calls would then be something like `require('src/foo')` or `require('app_modules/foo')`. The common prefix makes it more clear that the module can be found in the application's modules directory and not in the `node_modules` directory. | |
| 126 | + | |
| 127 | + | |
| 128 | +## Contribute | |
| 129 | +Pull requests, bug reports and feature requests welcome. | |
| 130 | + | |
| 131 | +## License | |
| 132 | + | |
| 133 | +BSD-2-Clause | ... | ... |
| 1 | +++ a/node_modules/app-module-path/cwd.js | |
| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | +var addPath = require('.').addPath; | |
| 2 | + | |
| 3 | +addPath(process.cwd()); | |
| 4 | + | |
| 5 | +// https://github.com/jhnns/rewire/blob/master/lib/index.js | |
| 6 | +delete require.cache[__filename]; // deleting self from module cache so the parent module is always up to date | ... | ... |
| 1 | +++ a/node_modules/app-module-path/lib/index.js | |
| ... | ... | @@ -0,0 +1,108 @@ |
| 1 | +var Module = require('module').Module; | |
| 2 | +var nodePath = require('path'); | |
| 3 | + | |
| 4 | +var appModulePaths = []; | |
| 5 | +var old_nodeModulePaths = Module._nodeModulePaths; | |
| 6 | +var allowedDirs = {}; | |
| 7 | + | |
| 8 | +function checkIfDirAllowed(from) { | |
| 9 | + var currentDir = from; | |
| 10 | + | |
| 11 | + while (currentDir) { | |
| 12 | + if (allowedDirs[currentDir]) { | |
| 13 | + return true; | |
| 14 | + } | |
| 15 | + | |
| 16 | + var basename = nodePath.basename(currentDir); | |
| 17 | + if (basename === 'node_modules') { | |
| 18 | + return false; | |
| 19 | + } | |
| 20 | + | |
| 21 | + var parentDir = nodePath.dirname(currentDir); | |
| 22 | + if (parentDir === currentDir) { | |
| 23 | + break; | |
| 24 | + } | |
| 25 | + currentDir = parentDir; | |
| 26 | + } | |
| 27 | + | |
| 28 | + return true; | |
| 29 | +} | |
| 30 | + | |
| 31 | +Module._nodeModulePaths = function(from) { | |
| 32 | + var paths = old_nodeModulePaths.call(this, from); | |
| 33 | + | |
| 34 | + // Only include the app module path for top-level modules | |
| 35 | + // that were not installed or that were explicitly allowed | |
| 36 | + if (checkIfDirAllowed(from)) { | |
| 37 | + paths = paths.concat(appModulePaths); | |
| 38 | + } | |
| 39 | + | |
| 40 | + return paths; | |
| 41 | +}; | |
| 42 | + | |
| 43 | +function enableForDir(dir) { | |
| 44 | + allowedDirs[dir] = true; | |
| 45 | +} | |
| 46 | + | |
| 47 | +function addPath(path, parent) { | |
| 48 | + // Anable app-module-path to work under any directories that are explicitly added | |
| 49 | + enableForDir(path); | |
| 50 | + | |
| 51 | + function addPathHelper(targetArray) { | |
| 52 | + path = nodePath.normalize(path); | |
| 53 | + if (targetArray && targetArray.indexOf(path) === -1) { | |
| 54 | + targetArray.push(path); | |
| 55 | + } | |
| 56 | + } | |
| 57 | + | |
| 58 | + path = nodePath.normalize(path); | |
| 59 | + | |
| 60 | + if (appModulePaths.indexOf(path) === -1) { | |
| 61 | + appModulePaths.push(path); | |
| 62 | + // Enable the search path for the current top-level module | |
| 63 | + if (require.main) { | |
| 64 | + addPathHelper(require.main.paths); | |
| 65 | + } | |
| 66 | + | |
| 67 | + parent = parent || module.parent; | |
| 68 | + | |
| 69 | + // Also modify the paths of the module that was used to load the app-module-paths module | |
| 70 | + // and all of it's parents | |
| 71 | + while(parent && parent !== require.main) { | |
| 72 | + addPathHelper(parent.paths); | |
| 73 | + parent = parent.parent; | |
| 74 | + } | |
| 75 | + } | |
| 76 | +} | |
| 77 | + | |
| 78 | +function removePath(path) { | |
| 79 | + function removePathHelper(targetArray) { | |
| 80 | + path = nodePath.normalize(path); | |
| 81 | + if (!targetArray) return; | |
| 82 | + var index = targetArray.indexOf(path); | |
| 83 | + if (index === -1) return; | |
| 84 | + targetArray.splice(index, 1); | |
| 85 | + } | |
| 86 | + | |
| 87 | + var parent; | |
| 88 | + path = nodePath.normalize(path); | |
| 89 | + var index = appModulePaths.indexOf(path); | |
| 90 | + | |
| 91 | + if (index > -1) { | |
| 92 | + appModulePaths.splice(index, 1); | |
| 93 | + // Enable the search path for the current top-level module | |
| 94 | + if (require.main) removePathHelper(require.main.paths); | |
| 95 | + parent = module.parent; | |
| 96 | + | |
| 97 | + // Also modify the paths of the module that was used to load the app-module-paths module | |
| 98 | + // and all of it's parents | |
| 99 | + while(parent && parent !== require.main) { | |
| 100 | + removePathHelper(parent.paths); | |
| 101 | + parent = parent.parent; | |
| 102 | + } | |
| 103 | + } | |
| 104 | +} | |
| 105 | + | |
| 106 | +exports.addPath = addPath; | |
| 107 | +exports.removePath = removePath; | |
| 108 | +exports.enableForDir = enableForDir; | ... | ... |
| 1 | +++ a/node_modules/app-module-path/package.json | |
| ... | ... | @@ -0,0 +1,63 @@ |
| 1 | +{ | |
| 2 | + "_from": "app-module-path@^2.2.0", | |
| 3 | + "_id": "app-module-path@2.2.0", | |
| 4 | + "_inBundle": false, | |
| 5 | + "_integrity": "sha1-ZBqlXft9am8KgUHEucCqULbCTdU=", | |
| 6 | + "_location": "/app-module-path", | |
| 7 | + "_phantomChildren": {}, | |
| 8 | + "_requested": { | |
| 9 | + "type": "range", | |
| 10 | + "registry": true, | |
| 11 | + "raw": "app-module-path@^2.2.0", | |
| 12 | + "name": "app-module-path", | |
| 13 | + "escapedName": "app-module-path", | |
| 14 | + "rawSpec": "^2.2.0", | |
| 15 | + "saveSpec": null, | |
| 16 | + "fetchSpec": "^2.2.0" | |
| 17 | + }, | |
| 18 | + "_requiredBy": [ | |
| 19 | + "#USER", | |
| 20 | + "/" | |
| 21 | + ], | |
| 22 | + "_resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", | |
| 23 | + "_shasum": "641aa55dfb7d6a6f0a8141c4b9c0aa50b6c24dd5", | |
| 24 | + "_spec": "app-module-path@^2.2.0", | |
| 25 | + "_where": "C:\\Users\\admin\\Documents\\express-project", | |
| 26 | + "author": { | |
| 27 | + "name": "Patrick Steele-Idem", | |
| 28 | + "email": "pnidem@gmail.com" | |
| 29 | + }, | |
| 30 | + "bugs": { | |
| 31 | + "url": "https://github.com/patrick-steele-idem/app-module-path-node/issues" | |
| 32 | + }, | |
| 33 | + "bundleDependencies": false, | |
| 34 | + "deprecated": false, | |
| 35 | + "description": "Simple module to add additional directories to the Node module search for top-level app modules", | |
| 36 | + "devDependencies": { | |
| 37 | + "chai": "^3.5.0", | |
| 38 | + "mocha": "^3.2.0" | |
| 39 | + }, | |
| 40 | + "ebay": {}, | |
| 41 | + "homepage": "https://github.com/patrick-steele-idem/app-module-path-node", | |
| 42 | + "keywords": [ | |
| 43 | + "modules", | |
| 44 | + "path", | |
| 45 | + "node", | |
| 46 | + "extend", | |
| 47 | + "resolve" | |
| 48 | + ], | |
| 49 | + "license": "BSD-2-Clause", | |
| 50 | + "main": "lib/index.js", | |
| 51 | + "name": "app-module-path", | |
| 52 | + "publishConfig": { | |
| 53 | + "registry": "https://registry.npmjs.org/" | |
| 54 | + }, | |
| 55 | + "repository": { | |
| 56 | + "type": "git", | |
| 57 | + "url": "git+https://github.com/patrick-steele-idem/app-module-path-node.git" | |
| 58 | + }, | |
| 59 | + "scripts": { | |
| 60 | + "test": "node test/test.js && ./node_modules/mocha/bin/mocha test/test2.js" | |
| 61 | + }, | |
| 62 | + "version": "2.2.0" | |
| 63 | +} | ... | ... |
| 1 | +++ a/node_modules/app-module-path/register.js | |
| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | +var dirname = require('path').dirname; | |
| 2 | +var addPath = require('.').addPath; | |
| 3 | + | |
| 4 | +addPath(dirname(module.parent.filename), module.parent); | |
| 5 | + | |
| 6 | +// https://github.com/jhnns/rewire/blob/master/lib/index.js | |
| 7 | +delete require.cache[__filename]; // deleting self from module cache so the parent module is always up to date | ... | ... |
| 1 | +++ a/node_modules/app-module-path/test/.jshintrc | |
| ... | ... | @@ -0,0 +1,43 @@ |
| 1 | +{ | |
| 2 | + "predef": [ | |
| 3 | + "it", | |
| 4 | + "xit", | |
| 5 | + "console", | |
| 6 | + "describe", | |
| 7 | + "xdescribe", | |
| 8 | + "beforeEach", | |
| 9 | + "before", | |
| 10 | + "after", | |
| 11 | + "waits", | |
| 12 | + "waitsFor", | |
| 13 | + "runs" | |
| 14 | + ], | |
| 15 | + "node" : true, | |
| 16 | + "es5" : false, | |
| 17 | + "esnext": true, | |
| 18 | + "browser" : true, | |
| 19 | + "boss" : false, | |
| 20 | + "curly": false, | |
| 21 | + "debug": false, | |
| 22 | + "devel": false, | |
| 23 | + "eqeqeq": true, | |
| 24 | + "evil": true, | |
| 25 | + "forin": false, | |
| 26 | + "immed": true, | |
| 27 | + "laxbreak": false, | |
| 28 | + "newcap": true, | |
| 29 | + "noarg": true, | |
| 30 | + "noempty": false, | |
| 31 | + "nonew": true, | |
| 32 | + "nomen": false, | |
| 33 | + "onevar": false, | |
| 34 | + "plusplus": false, | |
| 35 | + "regexp": false, | |
| 36 | + "undef": true, | |
| 37 | + "sub": false, | |
| 38 | + "white": false, | |
| 39 | + "eqeqeq": false, | |
| 40 | + "latedef": true, | |
| 41 | + "unused": "vars", | |
| 42 | + "eqnull": true | |
| 43 | +} | ... | ... |
node_modules/app-module-path/test/node_modules/installed-module-allowed-explicit/index.js
0 → 100644
node_modules/app-module-path/test/node_modules/installed-module-allowed-explicit/installed-module-allowed-explicit-foo/index.js
0 → 100644
node_modules/app-module-path/test/node_modules/installed-module-allowed/index.js
0 → 100644
node_modules/app-module-path/test/node_modules/installed-module-allowed/installed-module-allowed-foo/index.js
0 → 100644
node_modules/app-module-path/test/node_modules/installed-module/index.js
0 → 100644
| 1 | +++ a/node_modules/app-module-path/test/node_modules/installed-module/index.js | |
| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | +exports.sayHello = function() { | |
| 2 | + console.log('Hello from installed module'); | |
| 3 | + | |
| 4 | + var moduleA; | |
| 5 | + | |
| 6 | + try { | |
| 7 | + moduleA = require('module-a'); | |
| 8 | + } | |
| 9 | + catch(e) { | |
| 10 | + console.log('Not able to find module-a from ' + __filename + '... great!'); | |
| 11 | + } | |
| 12 | + | |
| 13 | + if (moduleA) { | |
| 14 | + throw new Error('module-a should not have been found from ' + __filename + '!'); | |
| 15 | + } | |
| 16 | +}; | |
| 0 | 17 | \ No newline at end of file | ... | ... |
node_modules/app-module-path/test/src/installed-module.js
0 → 100644
node_modules/app-module-path/test/src/module-a/lib/index.js
0 → 100644
| 1 | +++ a/node_modules/app-module-path/test/src/module-a/lib/index.js | |
| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | + | |
| 2 | +var moduleB = require('module-b'); | |
| 3 | +var installedModule = require('installed-module'); | |
| 4 | + | |
| 5 | +exports.sayHello = function() { | |
| 6 | + console.log('Hello from module-a'); | |
| 7 | + moduleB.sayHello(); | |
| 8 | + installedModule.sayHello(); | |
| 9 | +}; | |
| 0 | 10 | \ No newline at end of file | ... | ... |
node_modules/app-module-path/test/src/module-a/package.json
0 → 100644
| 1 | +++ a/node_modules/app-module-path/test/test-helper-code.js | |
| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | +var path = require('path'); | |
| 2 | + | |
| 3 | +require('../').addPath(path.join(__dirname, 'src')); | |
| 4 | + | |
| 5 | +// other common test setup, e.g. | |
| 6 | + | |
| 7 | +// var chai = require("chai"); | |
| 8 | +// var dirtyChai = require("dirty-chai"); | |
| 9 | + | |
| 10 | +// chai.use(dirtyChai); | |
| 11 | + | ... | ... |
| 1 | +++ a/node_modules/app-module-path/test/test.js | |
| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | +var path = require('path'); | |
| 2 | +var assert = require('assert'); | |
| 3 | +require('../').addPath(path.join(__dirname, 'src')); | |
| 4 | + | |
| 5 | +require('module-a').sayHello(); | |
| 6 | +require('module-b').sayHello(); | |
| 7 | +require('installed-module').sayHello(); | |
| 8 | + | |
| 9 | +assert(require('installed-module.js').isLocal); | |
| 10 | + | |
| 11 | +require('package.json'); | |
| 12 | + | |
| 13 | +console.log('All tests passed!'); | |
| 0 | 14 | \ No newline at end of file | ... | ... |
| 1 | +++ a/node_modules/app-module-path/test/test2.js | |
| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | +var path = require('path'); | |
| 2 | +var assert = require('assert'); | |
| 3 | +var expect = require('chai').expect; | |
| 4 | + | |
| 5 | +require('./test-helper-code.js'); | |
| 6 | + | |
| 7 | +describe("support for test code", function() { | |
| 8 | + it("should load up a module in a path defined in test helper code", function() { | |
| 9 | + | |
| 10 | + require('module-a').sayHello(); | |
| 11 | + require('module-b').sayHello(); | |
| 12 | + }); | |
| 13 | + it("should not search paths that have been removed", function() { | |
| 14 | + require('module-c').sayHello(); | |
| 15 | + require('../').removePath(path.join(__dirname, 'src')); | |
| 16 | + assert.throws(function() { | |
| 17 | + require('module-d').sayHello(); | |
| 18 | + }); | |
| 19 | + }); | |
| 20 | + | |
| 21 | + it("should allow specific directory to be enabled", function() { | |
| 22 | + var targetDir = path.dirname(require.resolve('installed-module-allowed-explicit')); | |
| 23 | + require('../').addPath(targetDir); | |
| 24 | + require('../').enableForDir(targetDir); | |
| 25 | + | |
| 26 | + var foo = require('installed-module-allowed-explicit').getFoo(); | |
| 27 | + expect(foo.name).to.equal('installed-module-allowed-explicit-foo'); | |
| 28 | + }); | |
| 29 | + | |
| 30 | + it("should allow directories where loaded", function() { | |
| 31 | + require('../').addPath(path.join(__dirname, 'src')); | |
| 32 | + var foo = require('installed-module-allowed').getFoo(); | |
| 33 | + expect(foo.name).to.equal('installed-module-allowed-foo'); | |
| 34 | + }); | |
| 35 | +}); | |
| 36 | + | |
| 37 | +console.log('All tests passed!'); | |
| 0 | 38 | \ No newline at end of file | ... | ... |
| 1 | +++ a/node_modules/array-flatten/LICENSE | |
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +The MIT License (MIT) | |
| 2 | + | |
| 3 | +Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) | |
| 4 | + | |
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | +of this software and associated documentation files (the "Software"), to deal | |
| 7 | +in the Software without restriction, including without limitation the rights | |
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 9 | +copies of the Software, and to permit persons to whom the Software is | |
| 10 | +furnished to do so, subject to the following conditions: | |
| 11 | + | |
| 12 | +The above copyright notice and this permission notice shall be included in | |
| 13 | +all copies or substantial portions of the Software. | |
| 14 | + | |
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
| 21 | +THE SOFTWARE. | ... | ... |
| 1 | +++ a/node_modules/array-flatten/README.md | |
| ... | ... | @@ -0,0 +1,43 @@ |
| 1 | +# Array Flatten | |
| 2 | + | |
| 3 | +[![NPM version][npm-image]][npm-url] | |
| 4 | +[![NPM downloads][downloads-image]][downloads-url] | |
| 5 | +[![Build status][travis-image]][travis-url] | |
| 6 | +[![Test coverage][coveralls-image]][coveralls-url] | |
| 7 | + | |
| 8 | +> Flatten an array of nested arrays into a single flat array. Accepts an optional depth. | |
| 9 | + | |
| 10 | +## Installation | |
| 11 | + | |
| 12 | +``` | |
| 13 | +npm install array-flatten --save | |
| 14 | +``` | |
| 15 | + | |
| 16 | +## Usage | |
| 17 | + | |
| 18 | +```javascript | |
| 19 | +var flatten = require('array-flatten') | |
| 20 | + | |
| 21 | +flatten([1, [2, [3, [4, [5], 6], 7], 8], 9]) | |
| 22 | +//=> [1, 2, 3, 4, 5, 6, 7, 8, 9] | |
| 23 | + | |
| 24 | +flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2) | |
| 25 | +//=> [1, 2, 3, [4, [5], 6], 7, 8, 9] | |
| 26 | + | |
| 27 | +(function () { | |
| 28 | + flatten(arguments) //=> [1, 2, 3] | |
| 29 | +})(1, [2, 3]) | |
| 30 | +``` | |
| 31 | + | |
| 32 | +## License | |
| 33 | + | |
| 34 | +MIT | |
| 35 | + | |
| 36 | +[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat | |
| 37 | +[npm-url]: https://npmjs.org/package/array-flatten | |
| 38 | +[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat | |
| 39 | +[downloads-url]: https://npmjs.org/package/array-flatten | |
| 40 | +[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat | |
| 41 | +[travis-url]: https://travis-ci.org/blakeembrey/array-flatten | |
| 42 | +[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat | |
| 43 | +[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master | ... | ... |