diff --git a/templates/yeoman/.gitignore b/templates/yeoman/.gitignore
new file mode 100644
index 0000000..2b5ec07
--- /dev/null
+++ b/templates/yeoman/.gitignore
@@ -0,0 +1,3 @@
+/node_modules/
+/built/
+/generator-aspnet-spa/
diff --git a/templates/yeoman/README.md b/templates/yeoman/README.md
new file mode 100644
index 0000000..9a05998
--- /dev/null
+++ b/templates/yeoman/README.md
@@ -0,0 +1,5 @@
+To generator the Yeoman generator, execute:
+
+ npm run build
+
+Output will appear in the `generator-aspnet-spa` directory.
diff --git a/templates/yeoman/package.json b/templates/yeoman/package.json
new file mode 100644
index 0000000..093df60
--- /dev/null
+++ b/templates/yeoman/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "generator-aspnetspa-generator",
+ "version": "1.0.0",
+ "description": "Creates the Yeoman generator for ASP.NET Core SPA templates",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "build": "tsc && node ./built/CreateGenerator.js"
+ },
+ "author": "Microsoft",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "diff": "^2.2.2",
+ "gitignore-parser": "0.0.2",
+ "glob": "^7.0.3",
+ "lodash": "^4.11.1",
+ "mkdirp": "^0.5.1",
+ "rimraf": "^2.5.2"
+ }
+}
diff --git a/templates/yeoman/src/CreateGenerator.ts b/templates/yeoman/src/CreateGenerator.ts
new file mode 100644
index 0000000..1a33673
--- /dev/null
+++ b/templates/yeoman/src/CreateGenerator.ts
@@ -0,0 +1,95 @@
+import * as yeoman from 'yeoman-generator';
+import * as glob from 'glob';
+import * as gitignore from 'gitignore-parser';
+import * as fs from 'fs';
+import * as path from 'path';
+import * as _ from 'lodash';
+import * as diff from 'diff';
+import * as mkdirp from 'mkdirp';
+import * as rimraf from 'rimraf';
+
+const textFileExtensions = ['.gitignore', '.config', '.cs', '.cshtml', 'Dockerfile', '.html', '.js', '.json', '.jsx', '.md', '.ts', '.tsx'];
+
+const templates = {
+ 'angular-2': '../../templates/Angular2Spa/',
+ 'knockout': '../../templates/KnockoutSpa/',
+ 'react-redux': '../../templates/ReactReduxSpa/',
+ 'react': '../../templates/ReactSpa/'
+};
+
+function isTextFile(filename: string): boolean {
+ return textFileExtensions.indexOf(path.extname(filename).toLowerCase()) >= 0;
+}
+
+function writeFileEnsuringDirExists(root: string, filename: string, contents: string | Buffer) {
+ let fullPath = path.join(root, filename);
+ mkdirp.sync(path.dirname(fullPath));
+ fs.writeFileSync(fullPath, contents);
+}
+
+function listFilesExcludingGitignored(root: string): string[] {
+ let gitignoreEvaluator = gitignore.compile(fs.readFileSync(path.join(root, '.gitignore'), 'utf8'));
+ return glob.sync('**/*', { cwd: root, dot: true, nodir: true })
+ .filter(fn => gitignoreEvaluator.accepts(fn));
+}
+
+function writeCommonFiles(outDir: string) {
+ let filesByTemplate = _.mapValues(templates, listFilesExcludingGitignored);
+ let commonFiles = _.intersection.apply(_, _.values(filesByTemplate));
+
+ commonFiles.forEach(fn => {
+ let templateRoots = _.values(templates);
+ let origContent = fs.readFileSync(path.join(templateRoots[0], fn));
+
+ if (isTextFile(fn)) {
+ // For text files, we copy the portion that's common to all the templates
+ let commonText = origContent.toString('utf8');
+ templateRoots.slice(1).forEach(otherTemplateRoot => {
+ let otherTemplateContent = fs.readFileSync(path.join(otherTemplateRoot, fn), 'utf8');
+ commonText = diff.diffLines(commonText, otherTemplateContent)
+ .filter(c => !(c.added || c.removed))
+ .map(c => c.value)
+ .join('');
+ });
+
+ writeFileEnsuringDirExists(outDir, fn, commonText);
+ } else {
+ // For binary (or maybe-binary) files, we only consider them common if they are identical across all templates
+ let isIdenticalEverywhere = !templateRoots.slice(1).some(otherTemplateRoot => {
+ return !fs.readFileSync(path.join(otherTemplateRoot, fn)).equals(origContent);
+ });
+ if (isIdenticalEverywhere) {
+ writeFileEnsuringDirExists(outDir, fn, origContent);
+ }
+ }
+ });
+}
+
+function writeDiffsForTemplate(sourceRoot: string, destRoot: string, commonRoot: string) {
+ listFilesExcludingGitignored(sourceRoot).forEach(fn => {
+ const commonFn = path.join(commonRoot, fn);
+ const sourceContent = fs.readFileSync(path.join(sourceRoot, fn));
+
+ if (!fs.existsSync(commonFn)) {
+ // This file is unique to this template - just copy as-is
+ writeFileEnsuringDirExists(destRoot, fn, sourceContent);
+ } else {
+ let commonText = fs.readFileSync(commonFn, 'utf8');
+ let sourceText = sourceContent.toString('utf8');
+ if (commonText !== sourceText) {
+ // Write a diff vs the common version of this file
+ let fileDiff = diff.createPatch(fn, commonText, sourceText, null, null);
+ writeFileEnsuringDirExists(destRoot, fn + '.patch', fileDiff);
+ }
+ }
+ });
+}
+
+const outputRoot = './generator-aspnet-spa';
+const commonRoot = path.join(outputRoot, 'templates/common');
+rimraf.sync(outputRoot);
+writeCommonFiles(commonRoot);
+
+_.forEach(templates, (templateRootDir, templateName) => {
+ writeDiffsForTemplate(templateRootDir, path.join(outputRoot, 'templates', templateName), commonRoot);
+});
diff --git a/templates/yeoman/tsconfig.json b/templates/yeoman/tsconfig.json
new file mode 100644
index 0000000..5b89f17
--- /dev/null
+++ b/templates/yeoman/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "compilerOptions": {
+ "moduleResolution": "node",
+ "target": "es5",
+ "outDir": "built",
+ "sourceMap": false
+ },
+ "exclude": [
+ "node_modules",
+ "generator-aspnet-spa"
+ ]
+}
diff --git a/templates/yeoman/tsd.json b/templates/yeoman/tsd.json
new file mode 100644
index 0000000..ece762e
--- /dev/null
+++ b/templates/yeoman/tsd.json
@@ -0,0 +1,33 @@
+{
+ "version": "v4",
+ "repo": "borisyankov/DefinitelyTyped",
+ "ref": "master",
+ "path": "typings",
+ "bundle": "typings/tsd.d.ts",
+ "installed": {
+ "yeoman-generator/yeoman-generator.d.ts": {
+ "commit": "544a35a10866b32afda9c7f029c0764558563f4f"
+ },
+ "node/node.d.ts": {
+ "commit": "544a35a10866b32afda9c7f029c0764558563f4f"
+ },
+ "glob/glob.d.ts": {
+ "commit": "544a35a10866b32afda9c7f029c0764558563f4f"
+ },
+ "minimatch/minimatch.d.ts": {
+ "commit": "544a35a10866b32afda9c7f029c0764558563f4f"
+ },
+ "lodash/lodash.d.ts": {
+ "commit": "544a35a10866b32afda9c7f029c0764558563f4f"
+ },
+ "diff/diff.d.ts": {
+ "commit": "544a35a10866b32afda9c7f029c0764558563f4f"
+ },
+ "mkdirp/mkdirp.d.ts": {
+ "commit": "544a35a10866b32afda9c7f029c0764558563f4f"
+ },
+ "rimraf/rimraf.d.ts": {
+ "commit": "544a35a10866b32afda9c7f029c0764558563f4f"
+ }
+ }
+}
diff --git a/templates/yeoman/typings/diff/diff.d.ts b/templates/yeoman/typings/diff/diff.d.ts
new file mode 100644
index 0000000..b1f9473
--- /dev/null
+++ b/templates/yeoman/typings/diff/diff.d.ts
@@ -0,0 +1,60 @@
+// Type definitions for diff
+// Project: https://github.com/kpdecker/jsdiff
+// Definitions by: vvakame
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare namespace JsDiff {
+ interface IDiffResult {
+ value: string;
+ count?: number;
+ added?: boolean;
+ removed?: boolean;
+ }
+
+ interface IBestPath {
+ newPos: number;
+ componenets: IDiffResult[];
+ }
+
+ class Diff {
+ ignoreWhitespace:boolean;
+
+ constructor(ignoreWhitespace?:boolean);
+
+ diff(oldString:string, newString:string):IDiffResult[];
+
+ pushComponent(components:IDiffResult[], value:string, added:boolean, removed:boolean):void;
+
+ extractCommon(basePath:IBestPath, newString:string, oldString:string, diagonalPath:number):number;
+
+ equals(left:string, right:string):boolean;
+
+ join(left:string, right:string):string;
+
+ tokenize(value:string):any; // return types are string or string[]
+ }
+
+ function diffChars(oldStr:string, newStr:string):IDiffResult[];
+
+ function diffWords(oldStr:string, newStr:string):IDiffResult[];
+
+ function diffWordsWithSpace(oldStr:string, newStr:string):IDiffResult[];
+
+ function diffJson(oldObj: Object, newObj: Object): IDiffResult[];
+
+ function diffLines(oldStr:string, newStr:string):IDiffResult[];
+
+ function diffCss(oldStr:string, newStr:string):IDiffResult[];
+
+ function createPatch(fileName:string, oldStr:string, newStr:string, oldHeader:string, newHeader:string):string;
+
+ function applyPatch(oldStr:string, uniDiff:string):string;
+
+ function convertChangesToXML(changes:IDiffResult[]):string;
+
+ function convertChangesToDMP(changes:IDiffResult[]):{0: number; 1:string;}[];
+}
+
+declare module "diff" {
+ export = JsDiff;
+}
diff --git a/templates/yeoman/typings/gitignore-parser/gitignore-parser.d.ts b/templates/yeoman/typings/gitignore-parser/gitignore-parser.d.ts
new file mode 100644
index 0000000..e265ba8
--- /dev/null
+++ b/templates/yeoman/typings/gitignore-parser/gitignore-parser.d.ts
@@ -0,0 +1,3 @@
+declare module 'gitignore-parser' {
+ export function compile(gitignoreContents: string): any;
+}
diff --git a/templates/yeoman/typings/glob/glob.d.ts b/templates/yeoman/typings/glob/glob.d.ts
new file mode 100644
index 0000000..2957204
--- /dev/null
+++ b/templates/yeoman/typings/glob/glob.d.ts
@@ -0,0 +1,112 @@
+// Type definitions for Glob 5.0.10
+// Project: https://github.com/isaacs/node-glob
+// Definitions by: vvakame
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+///
+
+declare module "glob" {
+
+ import events = require("events");
+ import fs = require('fs');
+ import minimatch = require("minimatch");
+
+ function G(pattern: string, cb: (err: Error, matches: string[]) => void): void;
+ function G(pattern: string, options: G.IOptions, cb: (err: Error, matches: string[]) => void): void;
+
+ namespace G {
+ function sync(pattern: string, options?: IOptions): string[];
+
+ function hasMagic(pattern: string, options?: IOptions): boolean;
+
+ var Glob: IGlobStatic;
+ var GlobSync: IGlobSyncStatic;
+
+ interface IOptions extends minimatch.IOptions {
+ cwd?: string;
+ root?: string;
+ dot?: boolean;
+ nomount?: boolean;
+ mark?: boolean;
+ nosort?: boolean;
+ stat?: boolean;
+ silent?: boolean;
+ strict?: boolean;
+ cache?: { [path: string]: any /* boolean | string | string[] */ };
+ statCache?: { [path: string]: fs.Stats };
+ symlinks?: any;
+ sync?: boolean;
+ nounique?: boolean;
+ nonull?: boolean;
+ debug?: boolean;
+ nobrace?: boolean;
+ noglobstar?: boolean;
+ noext?: boolean;
+ nocase?: boolean;
+ matchBase?: any;
+ nodir?: boolean;
+ ignore?: any; /* string | string[] */
+ follow?: boolean;
+ realpath?: boolean;
+ nonegate?: boolean;
+ nocomment?: boolean;
+
+ /** Deprecated. */
+ globDebug?: boolean;
+ }
+
+ interface IGlobStatic extends events.EventEmitter {
+ new (pattern: string, cb?: (err: Error, matches: string[]) => void): IGlob;
+ new (pattern: string, options: IOptions, cb?: (err: Error, matches: string[]) => void): IGlob;
+ prototype: IGlob;
+ }
+
+ interface IGlobSyncStatic {
+ new (pattern: string, options?: IOptions): IGlobBase
+ prototype: IGlobBase;
+ }
+
+ interface IGlobBase {
+ minimatch: minimatch.IMinimatch;
+ options: IOptions;
+ aborted: boolean;
+ cache: { [path: string]: any /* boolean | string | string[] */ };
+ statCache: { [path: string]: fs.Stats };
+ symlinks: { [path: string]: boolean };
+ realpathCache: { [path: string]: string };
+ found: string[];
+ }
+
+ interface IGlob extends IGlobBase, events.EventEmitter {
+ pause(): void;
+ resume(): void;
+ abort(): void;
+
+ /** Deprecated. */
+ EOF: any;
+ /** Deprecated. */
+ paused: boolean;
+ /** Deprecated. */
+ maxDepth: number;
+ /** Deprecated. */
+ maxLength: number;
+ /** Deprecated. */
+ changedCwd: boolean;
+ /** Deprecated. */
+ cwd: string;
+ /** Deprecated. */
+ root: string;
+ /** Deprecated. */
+ error: any;
+ /** Deprecated. */
+ matches: string[];
+ /** Deprecated. */
+ log(...args: any[]): void;
+ /** Deprecated. */
+ emitMatch(m: any): void;
+ }
+ }
+
+ export = G;
+}
diff --git a/templates/yeoman/typings/lodash/lodash.d.ts b/templates/yeoman/typings/lodash/lodash.d.ts
new file mode 100644
index 0000000..bd996b9
--- /dev/null
+++ b/templates/yeoman/typings/lodash/lodash.d.ts
@@ -0,0 +1,19265 @@
+// Type definitions for Lo-Dash
+// Project: http://lodash.com/
+// Definitions by: Brian Zengel , Ilya Mochalov
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+
+/**
+### 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog)
+
+#### TODO:
+removed:
+- [x] Removed _.support
+- [x] Removed _.findWhere in favor of _.find with iteratee shorthand
+- [x] Removed _.where in favor of _.filter with iteratee shorthand
+- [x] Removed _.pluck in favor of _.map with iteratee shorthand
+
+renamed:
+- [x] Renamed _.first to _.head
+- [x] Renamed _.indexBy to _.keyBy
+- [x] Renamed _.invoke to _.invokeMap
+- [x] Renamed _.overArgs to _.overArgs
+- [x] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd
+- [x] Renamed _.pairs to _.toPairs
+- [x] Renamed _.rest to _.tail
+- [x] Renamed _.restParam to _.rest
+- [x] Renamed _.sortByOrder to _.orderBy
+- [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd
+- [x] Renamed _.trunc to _.truncate
+
+split:
+- [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf
+- [x] Split _.max & _.min into _.maxBy & _.minBy
+- [x] Split _.omit & _.pick into _.omitBy & _.pickBy
+- [x] Split _.sample into _.sampleSize
+- [x] Split _.sortedIndex into _.sortedIndexBy
+- [x] Split _.sortedLastIndex into _.sortedLastIndexBy
+- [x] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy
+
+changes:
+- [x] Absorbed _.sortByAll into _.sortBy
+- [x] Changed the category of _.at to “Object”
+- [x] Changed the category of _.bindAll to “Utility”
+- [x] Made _.capitalize uppercase the first character & lowercase the rest
+- [x] Made _.functions return only own method names
+
+
+added 23 array methods:
+- [x] _.concat
+- [x] _.differenceBy
+- [x] _.differenceWith
+- [x] _.flatMap
+- [x] _.fromPairs
+- [x] _.intersectionBy
+- [x] _.intersectionWith
+- [x] _.join
+- [x] _.pullAll
+- [x] _.pullAllBy
+- [x] _.reverse
+- [x] _.sortedIndexBy
+- [x] _.sortedIndexOf
+- [x] _.sortedLastIndexBy
+- [x] _.sortedLastIndexOf
+- [x] _.sortedUniq
+- [x] _.sortedUniqBy
+- [x] _.unionBy
+- [x] _.unionWith
+- [x] _.uniqBy
+- [x] _.uniqWith
+- [x] _.xorBy
+- [x] _.xorWith
+
+added 18 lang methods:
+- [x] _.cloneDeepWith
+- [x] _.cloneWith
+- [x] _.eq
+- [x] _.isArrayLike
+- [x] _.isArrayLikeObject
+- [x] _.isEqualWith
+- [x] _.isInteger
+- [x] _.isLength
+- [x] _.isMatchWith
+- [x] _.isNil
+- [x] _.isObjectLike
+- [x] _.isSafeInteger
+- [x] _.isSymbol
+- [x] _.toInteger
+- [x] _.toLength
+- [x] _.toNumber
+- [x] _.toSafeInteger
+- [x] _.toString
+
+added 13 object methods:
+- [x] _.assignIn
+- [x] _.assignInWith
+- [x] _.assignWith
+- [x] _.functionsIn
+- [x] _.hasIn
+- [x] _.mergeWith
+- [x] _.omitBy
+- [x] _.pickBy
+
+
+added 8 string methods:
+- [x] _.lowerCase
+- [x] _.lowerFirst
+- [x] _.upperCase
+- [x] _.upperFirst
+- [x] _.toLower
+- [x] _.toUpper
+
+added 8 utility methods:
+- [x] _.toPath
+
+added 4 math methods:
+- [x] _.maxBy
+- [x] _.mean
+- [x] _.minBy
+- [x] _.sumBy
+
+added 2 function methods:
+- [x] _.flip
+- [x] _.unary
+
+added 2 number methods:
+- [x] _.clamp
+- [x] _.subtract
+
+added collection method:
+- [x] _.sampleSize
+
+Added 3 aliases
+
+- [x] _.first as an alias of _.head
+
+Removed 17 aliases
+- [x] Removed aliase _.all
+- [x] Removed aliase _.any
+- [x] Removed aliase _.backflow
+- [x] Removed aliase _.callback
+- [x] Removed aliase _.collect
+- [x] Removed aliase _.compose
+- [x] Removed aliase _.contains
+- [x] Removed aliase _.detect
+- [x] Removed aliase _.foldl
+- [x] Removed aliase _.foldr
+- [x] Removed aliase _.include
+- [x] Removed aliase _.inject
+- [x] Removed aliase _.methods
+- [x] Removed aliase _.object
+- [x] Removed aliase _.run
+- [x] Removed aliase _.select
+- [x] Removed aliase _.unique
+
+Other changes
+- [x] Added support for array buffers to _.isEqual
+- [x] Added support for converting iterators to _.toArray
+- [x] Added support for deep paths to _.zipObject
+- [x] Changed UMD to export to window or self when available regardless of other exports
+- [x] Ensured debounce cancel clears args & thisArg references
+- [x] Ensured _.add, _.subtract, & _.sum don’t skip NaN values
+- [x] Ensured _.clone treats generators like functions
+- [x] Ensured _.clone produces clones with the source’s [[Prototype]]
+- [x] Ensured _.defaults assigns properties that shadow Object.prototype
+- [x] Ensured _.defaultsDeep doesn’t merge a string into an array
+- [x] Ensured _.defaultsDeep & _.merge don’t modify sources
+- [x] Ensured _.defaultsDeep works with circular references
+- [x] Ensured _.keys skips “length” on strict mode arguments objects in Safari 9
+- [x] Ensured _.merge doesn’t convert strings to arrays
+- [x] Ensured _.merge merges plain-objects onto non plain-objects
+- [x] Ensured _#plant resets iterator data of cloned sequences
+- [x] Ensured _.random swaps min & max if min is greater than max
+- [x] Ensured _.range preserves the sign of start of -0
+- [x] Ensured _.reduce & _.reduceRight use getIteratee in their array branch
+- [x] Fixed rounding issue with the precision param of _.floor
+
+** LATER **
+Misc:
+- [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence
+- [ ] Removed thisArg params from most methods
+- [ ] Made “By” methods provide a single param to iteratees
+- [ ] Made _.words chainable by default
+- [ ] Removed isDeep params from _.clone & _.flatten
+- [ ] Removed _.bindAll support for binding all methods when no names are provided
+- [ ] Removed func-first param signature from _.before & _.after
+- [ ] _.extend as an alias of _.assignIn
+- [ ] _.extendWith as an alias of _.assignInWith
+- [ ] Added clear method to _.memoize.Cache
+- [ ] Added flush method to debounced & throttled functions
+- [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray
+- [ ] Enabled _.flow & _.flowRight to accept an array of functions
+- [ ] Ensured “Collection” methods treat functions as objects
+- [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects
+- [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator
+- [ ] Ensured _.isFunction returns true for generator functions
+- [ ] Ensured _.merge assigns typed arrays directly
+- [ ] Made _(...) an iterator & iterable
+- [ ] Made _.drop, _.take, & right forms coerce n of undefined to 0
+
+Methods:
+- [ ] _.concat
+- [ ] _.differenceBy
+- [ ] _.differenceWith
+- [ ] _.flatMap
+- [ ] _.fromPairs
+- [ ] _.intersectionBy
+- [ ] _.intersectionWith
+- [ ] _.join
+- [ ] _.pullAll
+- [ ] _.pullAllBy
+- [ ] _.reverse
+- [ ] _.sortedLastIndexOf
+- [ ] _.unionBy
+- [ ] _.unionWith
+- [ ] _.uniqWith
+- [ ] _.xorBy
+- [ ] _.xorWith
+- [ ] _.toString
+
+- [ ] _.invoke
+- [ ] _.setWith
+- [ ] _.toPairs
+- [ ] _.toPairsIn
+- [ ] _.unset
+
+- [ ] _.replace
+- [ ] _.split
+
+- [ ] _.cond
+- [ ] _.conforms
+- [ ] _.nthArg
+- [ ] _.over
+- [ ] _.overEvery
+- [ ] _.overSome
+- [ ] _.rangeRight
+
+- [ ] _.next
+*/
+
+declare var _: _.LoDashStatic;
+
+declare module _ {
+ interface LoDashStatic {
+ /**
+ * Creates a lodash object which wraps the given value to enable intuitive method chaining.
+ *
+ * In addition to Lo-Dash methods, wrappers also have the following Array methods:
+ * concat, join, pop, push, reverse, shift, slice, sort, splice, and unshift
+ *
+ * Chaining is supported in custom builds as long as the value method is implicitly or
+ * explicitly included in the build.
+ *
+ * The chainable wrapper functions are:
+ * after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy,
+ * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten,
+ * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy,
+ * keyBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min,
+ * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject,
+ * remove, rest, reverse, sample, shuffle, slice, sort, sortBy, splice, tap, throttle, times,
+ * toArray, transform, union, uniq, unset, unshift, unzip, values, where, without, wrap, and zip
+ *
+ * The non-chainable wrapper functions are:
+ * clone, cloneDeep, contains, escape, every, find, findIndex, findKey, findLast,
+ * findLastIndex, findLastKey, has, identity, indexOf, isArguments, isArray, isBoolean,
+ * isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber,
+ * isObject, isPlainObject, isRegExp, isString, isUndefined, join, lastIndexOf, mixin,
+ * noConflict, parseInt, pop, random, reduce, reduceRight, result, shift, size, some,
+ * sortedIndex, runInContext, template, unescape, uniqueId, and value
+ *
+ * The wrapper functions first and last return wrapped values when n is provided, otherwise
+ * they return unwrapped values.
+ *
+ * Explicit chaining can be enabled by using the _.chain method.
+ **/
+ (value: number): LoDashImplicitWrapper;
+ (value: string): LoDashImplicitStringWrapper;
+ (value: boolean): LoDashImplicitWrapper;
+ (value: Array): LoDashImplicitNumberArrayWrapper;
+ (value: Array): LoDashImplicitArrayWrapper;
+ (value: T): LoDashImplicitObjectWrapper;
+ (value: any): LoDashImplicitWrapper;
+
+ /**
+ * The semantic version number.
+ **/
+ VERSION: string;
+
+ /**
+ * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby
+ * (ERB). Change the following template settings to use alternative delimiters.
+ **/
+ templateSettings: TemplateSettings;
+ }
+
+ /**
+ * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby
+ * (ERB). Change the following template settings to use alternative delimiters.
+ **/
+ interface TemplateSettings {
+ /**
+ * The "escape" delimiter.
+ **/
+ escape?: RegExp;
+
+ /**
+ * The "evaluate" delimiter.
+ **/
+ evaluate?: RegExp;
+
+ /**
+ * An object to import into the template as local variables.
+ **/
+ imports?: Dictionary;
+
+ /**
+ * The "interpolate" delimiter.
+ **/
+ interpolate?: RegExp;
+
+ /**
+ * Used to reference the data object in the template text.
+ **/
+ variable?: string;
+ }
+
+ /**
+ * Creates a cache object to store key/value pairs.
+ */
+ interface MapCache {
+ /**
+ * Removes `key` and its value from the cache.
+ * @param key The key of the value to remove.
+ * @return Returns `true` if the entry was removed successfully, else `false`.
+ */
+ delete(key: string): boolean;
+
+ /**
+ * Gets the cached value for `key`.
+ * @param key The key of the value to get.
+ * @return Returns the cached value.
+ */
+ get(key: string): any;
+
+ /**
+ * Checks if a cached value for `key` exists.
+ * @param key The key of the entry to check.
+ * @return Returns `true` if an entry for `key` exists, else `false`.
+ */
+ has(key: string): boolean;
+
+ /**
+ * Sets `value` to `key` of the cache.
+ * @param key The key of the value to cache.
+ * @param value The value to cache.
+ * @return Returns the cache object.
+ */
+ set(key: string, value: any): _.Dictionary;
+ }
+
+ interface LoDashWrapperBase { }
+
+ interface LoDashImplicitWrapperBase extends LoDashWrapperBase { }
+
+ interface LoDashExplicitWrapperBase extends LoDashWrapperBase { }
+
+ interface LoDashImplicitWrapper extends LoDashImplicitWrapperBase> { }
+
+ interface LoDashExplicitWrapper extends LoDashExplicitWrapperBase> { }
+
+ interface LoDashImplicitStringWrapper extends LoDashImplicitWrapper { }
+
+ interface LoDashExplicitStringWrapper extends LoDashExplicitWrapper { }
+
+ interface LoDashImplicitObjectWrapper extends LoDashImplicitWrapperBase> { }
+
+ interface LoDashExplicitObjectWrapper extends LoDashExplicitWrapperBase> { }
+
+ interface LoDashImplicitArrayWrapper extends LoDashImplicitWrapperBase> {
+ pop(): T;
+ push(...items: T[]): LoDashImplicitArrayWrapper;
+ shift(): T;
+ sort(compareFn?: (a: T, b: T) => number): LoDashImplicitArrayWrapper;
+ splice(start: number): LoDashImplicitArrayWrapper;
+ splice(start: number, deleteCount: number, ...items: any[]): LoDashImplicitArrayWrapper;
+ unshift(...items: T[]): LoDashImplicitArrayWrapper;
+ }
+
+ interface LoDashExplicitArrayWrapper extends LoDashExplicitWrapperBase> { }
+
+ interface LoDashImplicitNumberArrayWrapper extends LoDashImplicitArrayWrapper { }
+
+ interface LoDashExplicitNumberArrayWrapper extends LoDashExplicitArrayWrapper { }
+
+ /*********
+ * Array *
+ *********/
+
+ //_.chunk
+ interface LoDashStatic {
+ /**
+ * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the
+ * final chunk will be the remaining elements.
+ *
+ * @param array The array to process.
+ * @param size The length of each chunk.
+ * @return Returns the new array containing chunks.
+ */
+ chunk(
+ array: List,
+ size?: number
+ ): T[][];
+ }
+
+ interface LoDashImplicitArrayWrapper {
+ /**
+ * @see _.chunk
+ */
+ chunk(size?: number): LoDashImplicitArrayWrapper;
+ }
+
+ interface LoDashImplicitObjectWrapper {
+ /**
+ * @see _.chunk
+ */
+ chunk(size?: number): LoDashImplicitArrayWrapper;
+ }
+
+ interface LoDashExplicitArrayWrapper {
+ /**
+ * @see _.chunk
+ */
+ chunk(size?: number): LoDashExplicitArrayWrapper;
+ }
+
+ interface LoDashExplicitObjectWrapper {
+ /**
+ * @see _.chunk
+ */
+ chunk(size?: number): LoDashExplicitArrayWrapper;
+ }
+
+ //_.compact
+ interface LoDashStatic {
+ /**
+ * Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are
+ * falsey.
+ *
+ * @param array The array to compact.
+ * @return (Array) Returns the new array of filtered values.
+ */
+ compact(array?: List): T[];
+ }
+
+ interface LoDashImplicitArrayWrapper {
+ /**
+ * @see _.compact
+ */
+ compact(): LoDashImplicitArrayWrapper;
+ }
+
+ interface LoDashImplicitObjectWrapper {
+ /**
+ * @see _.compact
+ */
+ compact(): LoDashImplicitArrayWrapper;
+ }
+
+ interface LoDashExplicitArrayWrapper {
+ /**
+ * @see _.compact
+ */
+ compact(): LoDashExplicitArrayWrapper;
+ }
+
+ interface LoDashExplicitObjectWrapper {
+ /**
+ * @see _.compact
+ */
+ compact(): LoDashExplicitArrayWrapper;
+ }
+
+ //_.concat DUMMY
+ interface LoDashStatic {
+ /**
+ * Creates a new array concatenating `array` with any additional arrays
+ * and/or values.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to concatenate.
+ * @param {...*} [values] The values to concatenate.
+ * @returns {Array} Returns the new concatenated array.
+ * @example
+ *
+ * var array = [1];
+ * var other = _.concat(array, 2, [3], [[4]]);
+ *
+ * console.log(other);
+ * // => [1, 2, 3, [4]]
+ *
+ * console.log(array);
+ * // => [1]
+ */
+ concat(...values: (T[]|List)[]) : T[];
+ }
+
+ //_.difference
+ interface LoDashStatic {
+ /**
+ * Creates an array of unique array values not included in the other provided arrays using SameValueZero for
+ * equality comparisons.
+ *
+ * @param array The array to inspect.
+ * @param values The arrays of values to exclude.
+ * @return Returns the new array of filtered values.
+ */
+ difference(
+ array: T[]|List,
+ ...values: Array>
+ ): T[];
+ }
+
+ interface LoDashImplicitArrayWrapper {
+ /**
+ * @see _.difference
+ */
+ difference(...values: (T[]|List)[]): LoDashImplicitArrayWrapper;
+ }
+
+ interface LoDashImplicitObjectWrapper {
+ /**
+ * @see _.difference
+ */
+ difference(...values: (TValue[]|List)[]): LoDashImplicitArrayWrapper;
+ }
+
+ interface LoDashExplicitArrayWrapper {
+ /**
+ * @see _.difference
+ */
+ difference(...values: (T[]|List)[]): LoDashExplicitArrayWrapper;
+ }
+
+ interface LoDashExplicitObjectWrapper {
+ /**
+ * @see _.difference
+ */
+ difference(...values: (TValue[]|List)[]): LoDashExplicitArrayWrapper;
+ }
+
+ //_.differenceBy
+ interface LoDashStatic {
+ /**
+ * This method is like _.difference except that it accepts iteratee which is invoked for each element of array
+ * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one
+ * argument: (value).
+ *
+ * @param array The array to inspect.
+ * @param values The values to exclude.
+ * @param iteratee The iteratee invoked per element.
+ * @returns Returns the new array of filtered values.
+ */
+ differenceBy(
+ array: T[]|List,
+ values?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): T[];
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ array: T[]|List,
+ values?: T[]|List,
+ iteratee?: W
+ ): T[];
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ array: T[]|List,
+ values1?: T[]|List,
+ values2?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): T[];
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ array: T[]|List,
+ values1?: T[]|List,
+ values2?: T[]|List,
+ iteratee?: W
+ ): T[];
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ array: T[]|List,
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): T[];
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ array: T[]|List,
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ iteratee?: W
+ ): T[];
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ array: T[]|List,
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ values4?: T[]|List,
+ iteratee?: W
+ ): T[];
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ array: T[]|List,
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ values4?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): T[];
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ array: T[]|List,
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ values4?: T[]|List,
+ values5?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): T[];
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ array: T[]|List,
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ values4?: T[]|List,
+ values5?: T[]|List,
+ iteratee?: W
+ ): T[];
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ array: T[]|List,
+ ...values: any[]
+ ): T[];
+ }
+
+ interface LoDashImplicitArrayWrapper {
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values?: T[]|List,
+ iteratee?: W
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ iteratee?: W
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ iteratee?: W
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ values4?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ values4?: T[]|List,
+ iteratee?: W
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ values4?: T[]|List,
+ values5?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ values4?: T[]|List,
+ values5?: T[]|List,
+ iteratee?: W
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ ...values: any[]
+ ): LoDashImplicitArrayWrapper;
+ }
+
+ interface LoDashImplicitObjectWrapper {
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values?: T[]|List,
+ iteratee?: W
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ iteratee?: W
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ iteratee?: W
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ values4?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ values4?: T[]|List,
+ iteratee?: W
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ values4?: T[]|List,
+ values5?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ values3?: T[]|List,
+ values4?: T[]|List,
+ values5?: T[]|List,
+ iteratee?: W
+ ): LoDashImplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ ...values: any[]
+ ): LoDashImplicitArrayWrapper;
+ }
+
+ interface LoDashExplicitArrayWrapper {
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): LoDashExplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values?: T[]|List,
+ iteratee?: W
+ ): LoDashExplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ iteratee?: ((value: T) => any)|string
+ ): LoDashExplicitArrayWrapper;
+
+ /**
+ * @see _.differenceBy
+ */
+ differenceBy(
+ values1?: T[]|List,
+ values2?: T[]|List,
+ iteratee?: W
+ ): LoDashExplicitArrayWrapper