new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
const { isArray } = Array;
|
||||
|
||||
/**
|
||||
* Used in operators and functions that accept either a list of arguments, or an array of arguments
|
||||
* as a single argument.
|
||||
*/
|
||||
export function argsOrArgArray<T>(args: (T | T[])[]): T[] {
|
||||
return args.length === 1 && isArray(args[0]) ? args[0] : (args as T[]);
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('mock', function (t) {
|
||||
t.plan(8);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/bar/baz.js')] = 'beep';
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo/bar')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file, cb) {
|
||||
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
|
||||
},
|
||||
isDirectory: function (dir, cb) {
|
||||
cb(null, !!dirs[path.resolve(dir)]);
|
||||
},
|
||||
readFile: function (file, cb) {
|
||||
cb(null, files[path.resolve(file)]);
|
||||
},
|
||||
realpath: function (file, cb) {
|
||||
cb(null, file);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/bar/baz.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/bar/baz.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('baz', opts('/foo/bar'), function (err, res) {
|
||||
t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
|
||||
resolve('../baz', opts('/foo/bar'), function (err, res) {
|
||||
t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
});
|
||||
|
||||
test('mock from package', function (t) {
|
||||
t.plan(8);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/bar/baz.js')] = 'beep';
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo/bar')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file, cb) {
|
||||
cb(null, Object.prototype.hasOwnProperty.call(files, file));
|
||||
},
|
||||
isDirectory: function (dir, cb) {
|
||||
cb(null, !!dirs[path.resolve(dir)]);
|
||||
},
|
||||
'package': { main: 'bar' },
|
||||
readFile: function (file, cb) {
|
||||
cb(null, files[file]);
|
||||
},
|
||||
realpath: function (file, cb) {
|
||||
cb(null, file);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/bar/baz.js'));
|
||||
t.equal(pkg && pkg.main, 'bar');
|
||||
});
|
||||
|
||||
resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/bar/baz.js'));
|
||||
t.equal(pkg && pkg.main, 'bar');
|
||||
});
|
||||
|
||||
resolve('baz', opts('/foo/bar'), function (err, res) {
|
||||
t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
|
||||
resolve('../baz', opts('/foo/bar'), function (err, res) {
|
||||
t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
});
|
||||
|
||||
test('mock package', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep';
|
||||
files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
|
||||
main: './baz.js'
|
||||
});
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo')] = true;
|
||||
dirs[path.resolve('/foo/node_modules')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file, cb) {
|
||||
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
|
||||
},
|
||||
isDirectory: function (dir, cb) {
|
||||
cb(null, !!dirs[path.resolve(dir)]);
|
||||
},
|
||||
readFile: function (file, cb) {
|
||||
cb(null, files[path.resolve(file)]);
|
||||
},
|
||||
realpath: function (file, cb) {
|
||||
cb(null, file);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
resolve('bar', opts('/foo'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/node_modules/bar/baz.js'));
|
||||
t.equal(pkg && pkg.main, './baz.js');
|
||||
});
|
||||
});
|
||||
|
||||
test('mock package from package', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep';
|
||||
files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
|
||||
main: './baz.js'
|
||||
});
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo')] = true;
|
||||
dirs[path.resolve('/foo/node_modules')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file, cb) {
|
||||
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
|
||||
},
|
||||
isDirectory: function (dir, cb) {
|
||||
cb(null, !!dirs[path.resolve(dir)]);
|
||||
},
|
||||
'package': { main: 'bar' },
|
||||
readFile: function (file, cb) {
|
||||
cb(null, files[path.resolve(file)]);
|
||||
},
|
||||
realpath: function (file, cb) {
|
||||
cb(null, file);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
resolve('bar', opts('/foo'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/node_modules/bar/baz.js'));
|
||||
t.equal(pkg && pkg.main, './baz.js');
|
||||
});
|
||||
});
|
||||
|
||||
test('symlinked', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/bar/baz.js')] = 'beep';
|
||||
files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep';
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo/bar')] = true;
|
||||
dirs[path.resolve('/foo/bar/symlinked')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
preserveSymlinks: false,
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file, cb) {
|
||||
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
|
||||
},
|
||||
isDirectory: function (dir, cb) {
|
||||
cb(null, !!dirs[path.resolve(dir)]);
|
||||
},
|
||||
readFile: function (file, cb) {
|
||||
cb(null, files[path.resolve(file)]);
|
||||
},
|
||||
realpath: function (file, cb) {
|
||||
var resolved = path.resolve(file);
|
||||
|
||||
if (resolved.indexOf('symlinked') >= 0) {
|
||||
cb(null, resolved);
|
||||
return;
|
||||
}
|
||||
|
||||
var ext = path.extname(resolved);
|
||||
|
||||
if (ext) {
|
||||
var dir = path.dirname(resolved);
|
||||
var base = path.basename(resolved);
|
||||
cb(null, path.join(dir, 'symlinked', base));
|
||||
} else {
|
||||
cb(null, path.join(resolved, 'symlinked'));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/bar/symlinked/baz.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/bar/symlinked/baz.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
});
|
||||
|
||||
test('readPackage', function (t) {
|
||||
t.plan(3);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep';
|
||||
files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
|
||||
main: './baz.js'
|
||||
});
|
||||
files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop';
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo')] = true;
|
||||
dirs[path.resolve('/foo/node_modules')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file, cb) {
|
||||
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
|
||||
},
|
||||
isDirectory: function (dir, cb) {
|
||||
cb(null, !!dirs[path.resolve(dir)]);
|
||||
},
|
||||
'package': { main: 'bar' },
|
||||
readFile: function (file, cb) {
|
||||
cb(null, files[path.resolve(file)]);
|
||||
},
|
||||
realpath: function (file, cb) {
|
||||
cb(null, file);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
t.test('with readFile', function (st) {
|
||||
st.plan(3);
|
||||
|
||||
resolve('bar', opts('/foo'), function (err, res, pkg) {
|
||||
st.error(err);
|
||||
st.equal(res, path.resolve('/foo/node_modules/bar/baz.js'));
|
||||
st.equal(pkg && pkg.main, './baz.js');
|
||||
});
|
||||
});
|
||||
|
||||
var readPackage = function (readFile, file, cb) {
|
||||
var barPackage = path.join('bar', 'package.json');
|
||||
if (file.slice(-barPackage.length) === barPackage) {
|
||||
cb(null, { main: './something-else.js' });
|
||||
} else {
|
||||
cb(null, JSON.parse(files[path.resolve(file)]));
|
||||
}
|
||||
};
|
||||
|
||||
t.test('with readPackage', function (st) {
|
||||
st.plan(3);
|
||||
|
||||
var options = opts('/foo');
|
||||
delete options.readFile;
|
||||
options.readPackage = readPackage;
|
||||
resolve('bar', options, function (err, res, pkg) {
|
||||
st.error(err);
|
||||
st.equal(res, path.resolve('/foo/node_modules/bar/something-else.js'));
|
||||
st.equal(pkg && pkg.main, './something-else.js');
|
||||
});
|
||||
});
|
||||
|
||||
t.test('with readFile and readPackage', function (st) {
|
||||
st.plan(1);
|
||||
|
||||
var options = opts('/foo');
|
||||
options.readPackage = readPackage;
|
||||
resolve('bar', options, function (err) {
|
||||
st.throws(function () { throw err; }, TypeError, 'errors when both readFile and readPackage are provided');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,905 @@
|
||||
<div align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img src="media/logo.svg" alt="type-fest" height="300">
|
||||
<br>
|
||||
<br>
|
||||
<b>A collection of essential TypeScript types</b>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<hr>
|
||||
<div align="center">
|
||||
<p>
|
||||
<p>
|
||||
<sup>
|
||||
<a href="https://github.com/sponsors/sindresorhus">Sindre Sorhus' open source work is supported by the community</a>
|
||||
</sup>
|
||||
</p>
|
||||
<sup>Special thanks to:</sup>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://standardresume.co/tech">
|
||||
<img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="180"/>
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://workos.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=type-fest&utm_source=github">
|
||||
<div>
|
||||
<img src="https://sindresorhus.com/assets/thanks/workos-logo-white-bg.svg" width="220" alt="WorkOS">
|
||||
</div>
|
||||
<b>Your app, enterprise-ready.</b>
|
||||
<div>
|
||||
<sub>Start selling to enterprise customers with just a few lines of code.</sub>
|
||||
<br>
|
||||
<sup>Add Single Sign-On (and more) in minutes instead of months.</sup>
|
||||
</div>
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://www.useanvil.com/?utm_source=sindresorhus#gh-light-mode-only">
|
||||
<div>
|
||||
<img src="https://sindresorhus.com/assets/thanks/anvil-logo-light.svg" width="200" alt="Anvil">
|
||||
</div>
|
||||
<br>
|
||||
<b>Paperwork that makes the data work.</b>
|
||||
<div>
|
||||
<sub>
|
||||
Easy APIs for paperwork. PDF generation, e-signature and embeddable no-code webforms.
|
||||
<br>
|
||||
The easiest way to build paperwork automation into your product.
|
||||
</sub>
|
||||
</div>
|
||||
</a>
|
||||
<a href="https://www.useanvil.com/?utm_source=sindresorhus#gh-dark-mode-only">
|
||||
<div>
|
||||
<img src="https://sindresorhus.com/assets/thanks/anvil-logo-dark.svg" width="200" alt="Anvil">
|
||||
</div>
|
||||
<br>
|
||||
<b>Paperwork that makes the data work.</b>
|
||||
<div>
|
||||
<sub>
|
||||
Easy APIs for paperwork. PDF generation, e-signature and embeddable no-code webforms.
|
||||
<br>
|
||||
The easiest way to build paperwork automation into your product.
|
||||
</sub>
|
||||
</div>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<br>
|
||||
<hr>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
[](https://giphy.com/gifs/illustration-rainbow-unicorn-26AHG5KGFxSkUWw1i)
|
||||
[](https://www.npmjs.com/package/type-fest?activeTab=dependents)
|
||||
[](https://www.npmjs.com/package/type-fest)
|
||||
[](https://paka.dev/npm/type-fest)
|
||||
|
||||
Many of the types here should have been built-in. You can help by suggesting some of them to the [TypeScript project](https://github.com/Microsoft/TypeScript/blob/main/CONTRIBUTING.md).
|
||||
|
||||
Either add this package as a dependency or copy-paste the needed types. No credit required. 👌
|
||||
|
||||
PR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first.
|
||||
|
||||
**Help wanted with reviewing [proposals](https://github.com/sindresorhus/type-fest/issues) and [pull requests](https://github.com/sindresorhus/type-fest/pulls).**
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install type-fest
|
||||
```
|
||||
|
||||
*Requires TypeScript >=4.7*
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import type {Except} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
unicorn: string;
|
||||
rainbow: boolean;
|
||||
};
|
||||
|
||||
type FooWithoutRainbow = Except<Foo, 'rainbow'>;
|
||||
//=> {unicorn: string}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Click the type names for complete docs.
|
||||
|
||||
### Basic
|
||||
|
||||
- [`Primitive`](source/primitive.d.ts) - Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
||||
- [`Class`](source/basic.d.ts) - Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
||||
- [`Constructor`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
||||
- [`TypedArray`](source/typed-array.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
|
||||
- [`ObservableLike`](source/observable-like.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
|
||||
|
||||
### Utilities
|
||||
|
||||
- [`EmptyObject`](source/empty-object.d.ts) - Represents a strictly empty plain object, the `{}` value.
|
||||
- [`IsEmptyObject`](source/empty-object.d.ts) - Returns a `boolean` for whether the type is strictly equal to an empty plain object, the `{}` value.
|
||||
- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys).
|
||||
- [`Writable`](source/writable.d.ts) - Create a type that strips `readonly` from all or some of an object's keys. The inverse of `Readonly<T>`.
|
||||
- [`WritableDeep`](source/writable-deep.d.ts) - Create a deeply mutable version of an `object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray` type. The inverse of `ReadonlyDeep<T>`. Use `Writable<T>` if you only need one level deep.
|
||||
- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
||||
- [`MergeDeep`](source/merge-deep.d.ts) - Merge two objects or two arrays/tuples recursively into a new type.
|
||||
- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive keys.
|
||||
- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys.
|
||||
- [`RequireExactlyOne`](source/require-exactly-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more.
|
||||
- [`RequireAllOrNone`](source/require-all-or-none.d.ts) - Create a type that requires all of the given keys or none of the given keys.
|
||||
- [`OmitIndexSignature`](source/omit-index-signature.d.ts) - Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
||||
- [`PickIndexSignature`](source/pick-index-signature.d.ts) - Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
||||
- [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type. Use [`Partial<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype) if you only need one level deep.
|
||||
- [`PartialOnUndefinedDeep`](source/partial-on-undefined-deep.d.ts) - Create a deep version of another type where all keys accepting `undefined` type are set to optional.
|
||||
- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype) if you only need one level deep.
|
||||
- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).
|
||||
- [`Opaque`](source/opaque.d.ts) - Create an [opaque type](https://codemix.com/opaque-types-in-javascript/).
|
||||
- [`UnwrapOpaque`](source/opaque.d.ts) - Revert an [opaque type](https://codemix.com/opaque-types-in-javascript/) back to its original type.
|
||||
- [`InvariantOf`](source/invariant-of.d.ts) - Create an [invariant type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance), which is a type that does not accept supertypes and subtypes.
|
||||
- [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional.
|
||||
- [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required.
|
||||
- [`SetNonNullable`](source/set-non-nullable.d.ts) - Create a type that makes the given keys non-nullable.
|
||||
- [`ValueOf`](source/value-of.d.ts) - Create a union of the given object's values, and optionally specify which keys to get the values from.
|
||||
- [`ConditionalKeys`](source/conditional-keys.d.ts) - Extract keys from a shape where values extend the given `Condition` type.
|
||||
- [`ConditionalPick`](source/conditional-pick.d.ts) - Like `Pick` except it selects properties from a shape where the values extend the given `Condition` type.
|
||||
- [`ConditionalPickDeep`](source/conditional-pick-deep.d.ts) - Like `ConditionalPick` except that it selects the properties deeply.
|
||||
- [`ConditionalExcept`](source/conditional-except.d.ts) - Like `Omit` except it removes properties from a shape where the values extend the given `Condition` type.
|
||||
- [`UnionToIntersection`](source/union-to-intersection.d.ts) - Convert a union type to an intersection type.
|
||||
- [`LiteralToPrimitive`](source/literal-to-primitive.d.ts) - Convert a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types) to the [primitive type](source/primitive.d.ts) it belongs to.
|
||||
- [`Stringified`](source/stringified.d.ts) - Create a type with the keys of the given type changed to `string` type.
|
||||
- [`IterableElement`](source/iterable-element.d.ts) - Get the element type of an `Iterable`/`AsyncIterable`. For example, an array or a generator.
|
||||
- [`Entry`](source/entry.d.ts) - Create a type that represents the type of an entry of a collection.
|
||||
- [`Entries`](source/entries.d.ts) - Create a type that represents the type of the entries of a collection.
|
||||
- [`SetReturnType`](source/set-return-type.d.ts) - Create a function type with a return type of your choice and the same parameters as the given function type.
|
||||
- [`Simplify`](source/simplify.d.ts) - Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
|
||||
- [`Get`](source/get.d.ts) - Get a deeply-nested property from an object using a key path, like [Lodash's `.get()`](https://lodash.com/docs/latest#get) function.
|
||||
- [`StringKeyOf`](source/string-key-of.d.ts) - Get keys of the given type as strings.
|
||||
- [`Schema`](source/schema.d.ts) - Create a deep version of another object type where property values are recursively replaced into a given value type.
|
||||
- [`Exact`](source/exact.d.ts) - Create a type that does not allow extra properties.
|
||||
- [`OptionalKeysOf`](source/optional-keys-of.d.ts) - Extract all optional keys from the given type.
|
||||
- [`HasOptionalKeys`](source/has-optional-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any optional fields.
|
||||
- [`RequiredKeysOf`](source/required-keys-of.d.ts) - Extract all required keys from the given type.
|
||||
- [`HasRequiredKeys`](source/has-required-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any required fields.
|
||||
- [`Spread`](source/spread.d.ts) - Mimic the type inferred by TypeScript when merging two objects or two arrays/tuples using the spread syntax.
|
||||
- [`IsEqual`](source/is-equal.d.ts) - Returns a boolean for whether the two given types are equal.
|
||||
|
||||
### JSON
|
||||
|
||||
- [`Jsonify`](source/jsonify.d.ts) - Transform a type to one that is assignable to the `JsonValue` type.
|
||||
- [`Jsonifiable`](source/jsonifiable.d.ts) - Matches a value that can be losslessly converted to JSON.
|
||||
- [`JsonPrimitive`](source/basic.d.ts) - Matches a JSON primitive.
|
||||
- [`JsonObject`](source/basic.d.ts) - Matches a JSON object.
|
||||
- [`JsonArray`](source/basic.d.ts) - Matches a JSON array.
|
||||
- [`JsonValue`](source/basic.d.ts) - Matches any valid JSON value.
|
||||
|
||||
### Async
|
||||
|
||||
- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`.
|
||||
- [`AsyncReturnType`](source/async-return-type.d.ts) - Unwrap the return type of a function that returns a `Promise`.
|
||||
- [`Asyncify`](source/asyncify.d.ts) - Create an async version of the given function type.
|
||||
|
||||
### String
|
||||
|
||||
- [`Trim`](source/trim.d.ts) - Remove leading and trailing spaces from a string.
|
||||
- [`Split`](source/split.d.ts) - Represents an array of strings split using a given character or character set.
|
||||
- [`Replace`](source/replace.d.ts) - Represents a string with some or all matches replaced by a replacement.
|
||||
|
||||
### Array
|
||||
|
||||
- [`Includes`](source/includes.d.ts) - Returns a boolean for whether the given array includes the given item.
|
||||
- [`Join`](source/join.d.ts) - Join an array of strings and/or numbers using the given string as a delimiter.
|
||||
- [`LastArrayElement`](source/last-array-element.d.ts) - Extracts the type of the last element of an array.
|
||||
- [`FixedLengthArray`](source/fixed-length-array.d.ts) - Create a type that represents an array of the given type and length.
|
||||
- [`MultidimensionalArray`](source/multidimensional-array.d.ts) - Create a type that represents a multidimensional array of the given type and dimensions.
|
||||
- [`MultidimensionalReadonlyArray`](source/multidimensional-readonly-array.d.ts) - Create a type that represents a multidimensional readonly array of the given type and dimensions.
|
||||
- [`ReadonlyTuple`](source/readonly-tuple.d.ts) - Create a type that represents a read-only tuple of the given type and length.
|
||||
- [`TupleToUnion`](source/tuple-to-union.d.ts) - Convert a tuple/array into a union type of its elements.
|
||||
|
||||
### Numeric
|
||||
|
||||
- [`PositiveInfinity`](source/numeric.d.ts) - Matches the hidden `Infinity` type.
|
||||
- [`NegativeInfinity`](source/numeric.d.ts) - Matches the hidden `-Infinity` type.
|
||||
- [`Finite`](source/numeric.d.ts) - A finite `number`.
|
||||
- [`Integer`](source/numeric.d.ts) - A `number` that is an integer.
|
||||
- [`Float`](source/numeric.d.ts) - A `number` that is not an integer.
|
||||
- [`NegativeFloat`](source/numeric.d.ts) - A negative (`-∞ < x < 0`) `number` that is not an integer.
|
||||
- [`Negative`](source/numeric.d.ts) - A negative `number`/`bigint` (`-∞ < x < 0`)
|
||||
- [`NonNegative`](source/numeric.d.ts) - A non-negative `number`/`bigint` (`0 <= x < ∞`).
|
||||
- [`NegativeInteger`](source/numeric.d.ts) - A negative (`-∞ < x < 0`) `number` that is an integer.
|
||||
- [`NonNegativeInteger`](source/numeric.d.ts) - A non-negative (`0 <= x < ∞`) `number` that is an integer.
|
||||
|
||||
### Change case
|
||||
|
||||
- [`CamelCase`](source/camel-case.d.ts) - Convert a string literal to camel-case (`fooBar`).
|
||||
- [`CamelCasedProperties`](source/camel-cased-properties.d.ts) - Convert object properties to camel-case (`fooBar`).
|
||||
- [`CamelCasedPropertiesDeep`](source/camel-cased-properties-deep.d.ts) - Convert object properties to camel-case recursively (`fooBar`).
|
||||
- [`KebabCase`](source/kebab-case.d.ts) - Convert a string literal to kebab-case (`foo-bar`).
|
||||
- [`KebabCasedProperties`](source/kebab-cased-properties.d.ts) - Convert a object properties to kebab-case recursively (`foo-bar`).
|
||||
- [`KebabCasedPropertiesDeep`](source/kebab-cased-properties-deep.d.ts) - Convert object properties to kebab-case (`foo-bar`).
|
||||
- [`PascalCase`](source/pascal-case.d.ts) - Converts a string literal to pascal-case (`FooBar`)
|
||||
- [`PascalCasedProperties`](source/pascal-cased-properties.d.ts) - Converts object properties to pascal-case (`FooBar`)
|
||||
- [`PascalCasedPropertiesDeep`](source/pascal-cased-properties-deep.d.ts) - Converts object properties to pascal-case (`FooBar`)
|
||||
- [`SnakeCase`](source/snake-case.d.ts) - Convert a string literal to snake-case (`foo_bar`).
|
||||
- [`SnakeCasedProperties`](source/snake-cased-properties-deep.d.ts) - Convert object properties to snake-case (`foo_bar`).
|
||||
- [`SnakeCasedPropertiesDeep`](source/snake-cased-properties-deep.d.ts) - Convert object properties to snake-case recursively (`foo_bar`).
|
||||
- [`ScreamingSnakeCase`](source/screaming-snake-case.d.ts) - Convert a string literal to screaming-snake-case (`FOO_BAR`).
|
||||
- [`DelimiterCase`](source/delimiter-case.d.ts) - Convert a string literal to a custom string delimiter casing.
|
||||
- [`DelimiterCasedProperties`](source/delimiter-cased-properties.d.ts) - Convert object properties to a custom string delimiter casing.
|
||||
- [`DelimiterCasedPropertiesDeep`](source/delimiter-cased-properties-deep.d.ts) - Convert object properties to a custom string delimiter casing recursively.
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
- [`GlobalThis`](source/global-this.d.ts) - Declare locally scoped properties on `globalThis`.
|
||||
- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). It also includes support for [TypeScript Declaration Files](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html).
|
||||
- [`TsConfigJson`](source/tsconfig-json.d.ts) - Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html).
|
||||
|
||||
## Declined types
|
||||
|
||||
*If we decline a type addition, we will make sure to document the better solution here.*
|
||||
|
||||
- [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The pull request author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider.
|
||||
- [`Dictionary`](https://github.com/sindresorhus/type-fest/issues/33) - You only save a few characters (`Dictionary<number>` vs `Record<string, number>`) from [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type), which is more flexible and well-known. Also, you shouldn't use an object as a dictionary. We have `Map` in JavaScript now.
|
||||
- [`ExtractProperties` and `ExtractMethods`](https://github.com/sindresorhus/type-fest/pull/4) - The types violate the single responsibility principle. Instead, refine your types into more granular type hierarchies.
|
||||
- [`Url2Json`](https://github.com/sindresorhus/type-fest/pull/262) - Inferring search parameters from a URL string is a cute idea, but not very useful in practice, since search parameters are usually dynamic and defined separately.
|
||||
- [`Nullish`](https://github.com/sindresorhus/type-fest/pull/318) - The type only saves a couple of characters, not everyone knows what "nullish" means, and I'm also trying to [get away from `null`](https://github.com/sindresorhus/meta/discussions/7).
|
||||
- [`TitleCase`](https://github.com/sindresorhus/type-fest/pull/303) - It's not solving a common need and is a better fit for a separate package.
|
||||
- [`ExtendOr` and `ExtendAnd`](https://github.com/sindresorhus/type-fest/pull/247) - The benefits don't outweigh having to learn what they mean.
|
||||
- [`PackageJsonExtras`](https://github.com/sindresorhus/type-fest/issues/371) - There are too many possible configurations that can be put into `package.json`. If you would like to extend `PackageJson` to support an additional configuration in your project, please see the *Extending existing types* section below.
|
||||
|
||||
## Alternative type names
|
||||
|
||||
*If you know one of our types by a different name, add it here for discovery.*
|
||||
|
||||
- `PartialBy` - See [`SetOptional`](https://github.com/sindresorhus/type-fest/blob/main/source/set-optional.d.ts)
|
||||
- `RecordDeep`- See [`Schema`](https://github.com/sindresorhus/type-fest/blob/main/source/schema.d.ts)
|
||||
- `Mutable`- See [`Writable`](https://github.com/sindresorhus/type-fest/blob/main/source/writable.d.ts)
|
||||
|
||||
## Tips
|
||||
|
||||
### Extending existing types
|
||||
|
||||
- [`PackageJson`](source/package-json.d.ts) - There are a lot of tools that place extra configurations inside the `package.json` file. You can extend `PackageJson` to support these additional configurations.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBDAnmApnA3gBQIYGMDW2A5igFIDOEAdnNuXAEJ0o4HFmVUC+cAZlBBBwA5ElQBaXinIxhAbgCwAKFCRYCZGnQAZYFRgooPfoJHSANntmKlysWlaESFanAC8jZo-YuaAMgwLKwBhal5gIgB+AC44XX1DADpQqnCiLhsgA)
|
||||
|
||||
```ts
|
||||
import type {PackageJson as BasePackageJson} from 'type-fest';
|
||||
import type {Linter} from 'eslint';
|
||||
|
||||
type PackageJson = BasePackageJson & {eslintConfig?: Linter.Config};
|
||||
```
|
||||
</details>
|
||||
|
||||
### Related
|
||||
|
||||
- [typed-query-selector](https://github.com/g-plane/typed-query-selector) - Enhances `document.querySelector` and `document.querySelectorAll` with a template literal type that matches element types returned from an HTML element query selector.
|
||||
- [`Linter.Config`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/eslint/index.d.ts) - Definitions for the [ESLint configuration schema](https://eslint.org/docs/user-guide/configuring/language-options).
|
||||
|
||||
### Built-in types
|
||||
|
||||
There are many advanced types most users don't know about.
|
||||
|
||||
- [`Partial<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype) - Make all properties in `T` optional.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://www.typescriptlang.org/play/#code/JYOwLgpgTgZghgYwgAgHIHsAmEDC6QzADmyA3gLABQyycADnanALYQBcyAzmFKEQNxUaddFDAcQAV2YAjaIMoBfKlQQAbOJ05osEAIIMAQpOBrsUMkOR1eANziRkCfISKSoD4Pg4ZseAsTIALyW1DS0DEysHADkvvoMMQA0VsKi4sgAzAAMuVaKClY2wPaOknSYDrguADwA0sgQAB6QIJjaANYQAJ7oMDp+LsQAfAAUXd0cdUnI9mo+uv6uANp1ALoAlKHhyGAAFsCcAHTOAW4eYF4gyxNrwbNwago0ypRWp66jH8QcAApwYmAjxq8SWIy2FDCNDA3ToKFBQyIdR69wmfQG1TOhShyBgomQX3w3GQE2Q6IA8jIAFYQBBgI4TTiEs5bTQYsFInrLTbbHZOIlgZDlSqQABqj0kKBC3yINx6a2xfOQwH6o2FVXFaklwSCIUkbQghBAEEwENSfNOlykEGefNe5uhB2O6sgS3GPRmLogmslG1tLxUOKgEDA7hAuydtteryAA)
|
||||
|
||||
```ts
|
||||
interface NodeConfig {
|
||||
appName: string;
|
||||
port: number;
|
||||
}
|
||||
|
||||
class NodeAppBuilder {
|
||||
private configuration: NodeConfig = {
|
||||
appName: 'NodeApp',
|
||||
port: 3000
|
||||
};
|
||||
|
||||
private updateConfig<Key extends keyof NodeConfig>(key: Key, value: NodeConfig[Key]) {
|
||||
this.configuration[key] = value;
|
||||
}
|
||||
|
||||
config(config: Partial<NodeConfig>) {
|
||||
type NodeConfigKey = keyof NodeConfig;
|
||||
|
||||
for (const key of Object.keys(config) as NodeConfigKey[]) {
|
||||
const updateValue = config[key];
|
||||
|
||||
if (updateValue === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.updateConfig(key, updateValue);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
// `Partial<NodeConfig>`` allows us to provide only a part of the
|
||||
// NodeConfig interface.
|
||||
new NodeAppBuilder().config({appName: 'ToDoApp'});
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Required<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype) - Make all properties in `T` required.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgGED21VQGJZwC2wA3gFCjXAzFJgA2A-AFzADOUckA5gNxUaIYjA4ckvGG07c+g6gF8KQkAgCuEFFDA5O6gEbEwUbLm2ESwABQIixACJIoSdgCUYAR3Vg4MACYAPGYuFvYAfACU5Ko0APRxwADKMBD+wFAAFuh2Vv7OSBlYGdmc8ABu8LHKsRyGxqY4oQT21pTCIHQMjOwA5DAAHgACxAAOjDAAdChYxL0ANLHUouKSMH0AEmAAhJhY6ozpAJ77GTCMjMCiV0ToSAb7UJPPC9WRgrEJwAAqR6MwSRQPFGUFocDgRHYxnEfGAowh-zgUCOwF6KwkUl6tXqJhCeEsxDaS1AXSYfUGI3GUxmc0WSneQA)
|
||||
|
||||
```ts
|
||||
interface ContactForm {
|
||||
email?: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
function submitContactForm(formData: Required<ContactForm>) {
|
||||
// Send the form data to the server.
|
||||
}
|
||||
|
||||
submitContactForm({
|
||||
email: 'ex@mple.com',
|
||||
message: 'Hi! Could you tell me more about…',
|
||||
});
|
||||
|
||||
// TypeScript error: missing property 'message'
|
||||
submitContactForm({
|
||||
email: 'ex@mple.com',
|
||||
});
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Readonly<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype) - Make all properties in `T` readonly.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4UwOwVwW2AZA9gc3mAbmANsA3gKFCOAHkAzMgGkOJABEwAjKZa2kAUQCcvEu32AMQCGAF2FYBIAL4BufDRABLCKLBcywgMZgEKZOoDCiCGSXI8i4hGEwwALmABnUVxXJ57YFgzZHSVF8sT1BpBSItLGEnJz1kAy5LLy0TM2RHACUwYQATEywATwAeAITjU3MAPnkrCJMXLigtUT4AClxgGztKbyDgaX99I1TzAEokr1BRAAslJwA6FIqLAF48TtswHp9MHDla9hJGACswZvmyLjAwAC8wVpm5xZHkUZDaMKIwqyWXYCW0oN4sNlsA1h0ug5gAByACyBQAggAHJHQ7ZBIFoXbzBjMCz7OoQP5YIaJNYQMAAdziCVaALGNSIAHomcAACoFJFgADKWjcSNEwG4vC4ji0wggEEQguiTnMEGALWAV1yAFp8gVgEjeFyuKICvMrCTgVxnst5jtsGC4ljsPNhXxGaAWcAAOq6YRXYDCRg+RWIcA5JSC+kWdCepQ+v3RYCU3RInzRMCGwlpC19NYBW1Ye08R1AA)
|
||||
|
||||
```ts
|
||||
enum LogLevel {
|
||||
Off,
|
||||
Debug,
|
||||
Error,
|
||||
Fatal
|
||||
};
|
||||
|
||||
interface LoggerConfig {
|
||||
name: string;
|
||||
level: LogLevel;
|
||||
}
|
||||
|
||||
class Logger {
|
||||
config: Readonly<LoggerConfig>;
|
||||
|
||||
constructor({name, level}: LoggerConfig) {
|
||||
this.config = {name, level};
|
||||
Object.freeze(this.config);
|
||||
}
|
||||
}
|
||||
|
||||
const config: LoggerConfig = {
|
||||
name: 'MyApp',
|
||||
level: LogLevel.Debug
|
||||
};
|
||||
|
||||
const logger = new Logger(config);
|
||||
|
||||
// TypeScript Error: cannot assign to read-only property.
|
||||
logger.config.level = LogLevel.Error;
|
||||
|
||||
// We are able to edit config variable as we please.
|
||||
config.level = LogLevel.Error;
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Pick<T, K>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys) - From `T`, pick a set of properties whose keys are in the union `K`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgEE5TCgNugN4BQoZwOUBAXMAM5RyQDmA3KeSFABYCuAtgCMISMHloMmENh04oA9tBjQJjFuzIBfYrOAB6PcADCcGElh1gEGAHcKATwAO6ebyjB5CTNlwFwSxFR0BX5HeToYABNgBDh5fm8cfBg6AHIKG3ldA2BHOOcfFNpUygJ0pAhokr4hETFUgDpswywkggAFUwA3MFtgAF5gQgowKhhVKTYKGuFRcXo1aVZgbTIoJ3RW3xhOmB6+wfbcAGsAHi3kgBpgEtGy4AAfG54BWfqAPnZm4AAlZUj4MAkMA8GAGB4vEgfMlLLw6CwPBA8PYRmMgZVgAC6CgmI4cIommQELwICh8RBgKZKvALh1ur0bHQABR5PYMui0Wk7em2ADaAF0AJS0AASABUALIAGQAogR+Mp3CROCAFBBwVC2ikBpj5CgBIqGjizLA5TAFdAmalImAuqlBRoVQh5HBgEy1eDWfs7J5cjzGYKhroVfpDEhHM4MV6GRR5NN0JrtnRg6BVirTFBeHAKYmYY6QNpdB73LmCJZBlSAXAubtvczeSmQMNSuMbmKNgBlHFgPEUNwusBIPAAQlS1xetTmxT0SDoESgdD0C4aACtHMwxytLrohawgA)
|
||||
|
||||
```ts
|
||||
interface Article {
|
||||
title: string;
|
||||
thumbnail: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
// Creates new type out of the `Article` interface composed
|
||||
// from the Articles' two properties: `title` and `thumbnail`.
|
||||
// `ArticlePreview = {title: string; thumbnail: string}`
|
||||
type ArticlePreview = Pick<Article, 'title' | 'thumbnail'>;
|
||||
|
||||
// Render a list of articles using only title and description.
|
||||
function renderArticlePreviews(previews: ArticlePreview[]): HTMLElement {
|
||||
const articles = document.createElement('div');
|
||||
|
||||
for (const preview of previews) {
|
||||
// Append preview to the articles.
|
||||
}
|
||||
|
||||
return articles;
|
||||
}
|
||||
|
||||
const articles = renderArticlePreviews([
|
||||
{
|
||||
title: 'TypeScript tutorial!',
|
||||
thumbnail: '/assets/ts.jpg'
|
||||
}
|
||||
]);
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Record<K, T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type) - Construct a type with a set of properties `K` of type `T`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4ejYAUHsGcCWAXBMB2dgwGbAKYC2ADgDYwCeeemCaWArgE7ADGMxAhmuQHQBQoYEnJE8wALKEARnkaxEKdMAC8wAOS0kstGuAAfdQBM8ANzxlRjXQbVaWACwC0JPB0NqA3HwGgIwAJJoWozYHCxixnAsjAhStADmwESMMJYo1Fi4HMCIaPEu+MRklHj8gpqyoeHAAKJFFFTAAN4+giDYCIxwSAByHAR4AFw5SDF5Xm2gJBzdfQPD3WPxE5PAlBxdAPLYNQAelgh4aOHDaPQEMowrIAC+3oJ+AMKMrlrAXFhSAFZ4LEhC9g4-0BmA4JBISXgiCkBQABpILrJ5MhUGhYcATGD6Bk4Hh-jNgABrPDkOBlXyQAAq9ngYmJpOAAHcEOCRjAXqwYODfoo6DhakUSph+Uh7GI4P0xER4Cj0OSQGwMP8tP1hgAlX7swwAHgRl2RvIANALSA08ABtAC6AD4VM1Wm0Kow0MMrYaHYJjGYLLJXZb3at1HYnC43Go-QHQDcvA6-JsmEJXARgCDgMYWAhjIYhDAU+YiMAAFIwex0ZmilMITCGF79TLAGRsAgJYAAZRwSEZGzEABFTOZUrJ5Yn+jwnWgeER6HB7AAKJrADpdXqS4ZqYultTG6azVfqHswPBbtauLY7fayQ7HIbAAAMwBuAEoYw9IBq2Ixs9h2eFMOQYPQObALQKJgggABeYhghCIpikkKRpOQRIknAsZUiIeCttECBEP8NSMCkjDDAARMGziuIYxHwYOjDCMBmDNnAuTxA6irdCOBB1Lh5Dqpqn66tISIykawBnOCtqqC0gbjqc9DgpGkxegOliyfJDrRkAA)
|
||||
|
||||
```ts
|
||||
// Positions of employees in our company.
|
||||
type MemberPosition = 'intern' | 'developer' | 'tech-lead';
|
||||
|
||||
// Interface describing properties of a single employee.
|
||||
interface Employee {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
yearsOfExperience: number;
|
||||
}
|
||||
|
||||
// Create an object that has all possible `MemberPosition` values set as keys.
|
||||
// Those keys will store a collection of Employees of the same position.
|
||||
const team: Record<MemberPosition, Employee[]> = {
|
||||
intern: [],
|
||||
developer: [],
|
||||
'tech-lead': [],
|
||||
};
|
||||
|
||||
// Our team has decided to help John with his dream of becoming Software Developer.
|
||||
team.intern.push({
|
||||
firstName: 'John',
|
||||
lastName: 'Doe',
|
||||
yearsOfExperience: 0
|
||||
});
|
||||
|
||||
// `Record` forces you to initialize all of the property keys.
|
||||
// TypeScript Error: "tech-lead" property is missing
|
||||
const teamEmpty: Record<MemberPosition, null> = {
|
||||
intern: null,
|
||||
developer: null,
|
||||
};
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Exclude<T, U>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#excludetype-excludedunion) - Exclude from `T` those types that are assignable to `U`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgMrQG7QMIHsQzADmyA3gFDLIAOuUYAXMiAK4A2byAPsgM5hRQJHqwC2AI2gBucgF9y5MAE9qKAEoQAjiwj8AEnBAATNtGQBeZAAooWphu26wAGmS3e93bRC8IASgsAPmRDJRlyAHoI5ABRAA8ENhYjFFYOZGVVZBgoXFFkAAM0zh5+QRBhZhYJaAKAOkjogEkQZAQ4X2QAdwALCFbaemRgXmQtFjhOMFwq9K6ULuB0lk6U+HYwZAxJnQaYFhAEMGB8ZCIIMAAFOjAANR2IK0HGWISklIAedCgsKDwCYgAbQA5M9gQBdVzFQJ+JhiSRQMiUYYwayZCC4VHPCzmSzAspCYEBWxgFhQAZwKC+FpgJ43VwARgADH4ZFQSWSBjcZPJyPtDsdTvxKWBvr8rD1DCZoJ5HPopaYoK4EPhCEQmGKcKriLCtrhgEYkVQVT5Nr4fmZLLZtMBbFZgT0wGBqES6ghbHBIJqoBKFdBWQpjfh+DQbhY2tqiHVsbjLMVkAB+ZAAZiZaeQTHOVxu9ySjxNaujNwDVHNvzqbBGkBAdPoAfkQA)
|
||||
|
||||
```ts
|
||||
interface ServerConfig {
|
||||
port: null | string | number;
|
||||
}
|
||||
|
||||
type RequestHandler = (request: Request, response: Response) => void;
|
||||
|
||||
// Exclude `null` type from `null | string | number`.
|
||||
// In case the port is equal to `null`, we will use default value.
|
||||
function getPortValue(port: Exclude<ServerConfig['port'], null>): number {
|
||||
if (typeof port === 'string') {
|
||||
return parseInt(port, 10);
|
||||
}
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
function startServer(handler: RequestHandler, config: ServerConfig): void {
|
||||
const server = require('http').createServer(handler);
|
||||
|
||||
const port = config.port === null ? 3000 : getPortValue(config.port);
|
||||
server.listen(port);
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Extract<T, U>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#extracttype-union) - Extract from `T` those types that are assignable to `U`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzSwEdkQBJYACgEoAueVZAWwCMQYBuAKDDwGcM8MgBF4AXngBlAJ6scESgHIRi6ty5ZUGdoihgEABXZ888AN5d48ANoiAuvUat23K6ihMQ9ATE0BzV3goPy8GZjZOLgBfLi4Aejj4AEEICBwAdz54MAALKFQQ+BxEeAAHY1NgKAwoIKy0grr4DByEUpgccpgMaXgAaxBerCzi+B9-ZulygDouFHRsU1z8kKMYE1RhaqgAHkt4AHkWACt4EAAPbVRgLLWNgBp9gGlBs8uQa6yAUUuYPQwdgNpKM7nh7mMML4CgA+R5WABqUAgpDeVxuhxO1he0jsXGh8EoOBO9COx3BQPo2PBADckaR6IjkSA6PBqTgsMBzPsicdrEC7OJWXSQNwYvFEgAVTS9JLXODpeDpKBZFg4GCoWa8VACIJykAKiQWKy2YQOAioYikCg0OEMDyhRSy4DyxS24KhAAMjyi6gS8AAwjh5OD0iBFHAkJoEOksC1mnkMJq8gUQKDNttKPlnfrwYp3J5XfBHXqoKpfYkAOI4ansTxaeDADmoRSCCBYAbxhC6TDx6rwYHIRX5bScjA4bLJwoDmDwDkfbA9JMrVMVdM1TN69LgkTgwgkchUahqIA)
|
||||
|
||||
```ts
|
||||
declare function uniqueId(): number;
|
||||
|
||||
const ID = Symbol('ID');
|
||||
|
||||
interface Person {
|
||||
[ID]: number;
|
||||
name: string;
|
||||
age: number;
|
||||
}
|
||||
|
||||
// Allows changing the person data as long as the property key is of string type.
|
||||
function changePersonData<
|
||||
Obj extends Person,
|
||||
Key extends Extract<keyof Person, string>,
|
||||
Value extends Obj[Key]
|
||||
> (obj: Obj, key: Key, value: Value): void {
|
||||
obj[key] = value;
|
||||
}
|
||||
|
||||
// Tiny Andrew was born.
|
||||
const andrew = {
|
||||
[ID]: uniqueId(),
|
||||
name: 'Andrew',
|
||||
age: 0,
|
||||
};
|
||||
|
||||
// Cool, we're fine with that.
|
||||
changePersonData(andrew, 'name', 'Pony');
|
||||
|
||||
// Goverment didn't like the fact that you wanted to change your identity.
|
||||
changePersonData(andrew, ID, uniqueId());
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`NonNullable<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#nonnullabletype) - Exclude `null` and `undefined` from `T`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
Works with <a href="https://www.typescriptlang.org/tsconfig#strictNullChecks"><code>strictNullChecks</code></a> set to <code>true</code>.
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/C4TwDgpgBACg9gJ2AOQK4FsBGEFQLxQDOwCAlgHYDmUAPlORtrnQwDasDcAUFwPQBU-WAEMkUOADMowqAGNWwwoSgATCBIqlgpOOSjAAFsOBRSy1IQgr9cKJlSlW1mZYQA3HFH68u8xcoBlHA8EACEHJ08Aby4oKDBUTFZSWXjEFEYcAEIALihkXTR2YSSIAB54JDQsHAA+blj4xOTUsHSACkMzPKD3HHDHNQQAGjSkPMqMmoQASh7g-oihqBi4uNIpdraxPAI2VhmVxrX9AzMAOm2ppnwoAA4ABifuE4BfKAhWSyOTuK7CS7pao3AhXF5rV48E4ICDAVAIPT-cGQyG+XTEIgLMJLTx7CAAdygvRCA0iCHaMwarhJOIQjUBSHaACJHk8mYdeLwxtdcVAAOSsh58+lXdr7Dlcq7A3n3J4PEUdADMcspUE53OluAIUGVTx46oAKuAIAFZGQwCYAKIIBCILjUxaDHAMnla+iodjcIA)
|
||||
|
||||
```ts
|
||||
type PortNumber = string | number | null;
|
||||
|
||||
/** Part of a class definition that is used to build a server */
|
||||
class ServerBuilder {
|
||||
portNumber!: NonNullable<PortNumber>;
|
||||
|
||||
port(this: ServerBuilder, port: PortNumber): ServerBuilder {
|
||||
if (port == null) {
|
||||
this.portNumber = 8000;
|
||||
} else {
|
||||
this.portNumber = port;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
const serverBuilder = new ServerBuilder();
|
||||
|
||||
serverBuilder
|
||||
.port('8000') // portNumber = '8000'
|
||||
.port(null) // portNumber = 8000
|
||||
.port(3000); // portNumber = 3000
|
||||
|
||||
// TypeScript error
|
||||
serverBuilder.portNumber = null;
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Parameters<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#parameterstype) - Obtain the parameters of a function type in a tuple.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/GYVwdgxgLglg9mABAZwBYmMANgUwBQxgAOIUAXIgIZgCeA2gLoCUFAbnDACaIDeAUIkQB6IYgCypSlBxUATrMo1ECsJzgBbLEoipqAc0J7EMKMgDkiHLnU4wp46pwAPHMgB0fAL58+oSLARECEosLAA5ABUYG2QAHgAxJGdpVWREPDdMylk9ZApqemZEAF4APipacrw-CApEgBogkKwAYThwckQwEHUAIxxZJl4BYVEImiIZKF0oZRwiWVdbeygJmThgOYgcGFYcbhqApCJsyhtpWXcR1cnEePBoeDAABVPzgbTixFeFd8uEsClADcIxGiygIFkSEOT3SmTc2VydQeRx+ZxwF2QQ34gkEwDgsnSuFmMBKiAADEDjIhYk1Qm0OlSYABqZnYka4xA1DJZHJYkGc7yCbyeRA+CAIZCzNAYbA4CIAdxg2zJwVCkWirjwMswuEaACYmCCgA)
|
||||
|
||||
```ts
|
||||
function shuffle(input: any[]): void {
|
||||
// Mutate array randomly changing its' elements indexes.
|
||||
}
|
||||
|
||||
function callNTimes<Fn extends (...arguments_: any[]) => any> (func: Fn, callCount: number) {
|
||||
// Type that represents the type of the received function parameters.
|
||||
type FunctionParameters = Parameters<Fn>;
|
||||
|
||||
return function (...arguments_: FunctionParameters) {
|
||||
for (let i = 0; i < callCount; i++) {
|
||||
func(...arguments_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const shuffleTwice = callNTimes(shuffle, 2);
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`ConstructorParameters<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#constructorparameterstype) - Obtain the parameters of a constructor function type in a tuple.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECCBOAXAlqApgWQPYBM0mgG8AoaaFRENALmgkXmQDsBzAblOmCycTV4D8teo1YdO3JiICuwRFngAKClWENmLAJRFOZRAAtkEAHQq00ALzlklNBzIBfYk+KhIMAJJTEYJsDQAwmDA+mgAPAAq0GgAHnxMODCKTGgA7tCKxllg8CwQtL4AngDaALraFgB80EWa1SRkAA6MAG5gfNAB4FABPDJyCrQR9tDNyG0dwMGhtBhgjWEiGgA00F70vv4RhY3hEZXVVinpc42KmuJkkv3y8Bly8EPaDWTkhiZd7r3e8LK3llwGCMXGQWGhEOsfH5zJlsrl8p0+gw-goAAo5MAAW3BaHgEEilU0tEhmzQ212BJ0ry4SOg+kg+gBBiMximIGA0nAfAQLGk2N4EAAEgzYcYcnkLsRdDTvNEYkYUKwSdCme9WdM0MYwYhFPSIPpJdTkAAzDKxBUaZX+aAAQgsVmkCTQxuYaBw2ng4Ok8CYcotSu8pMur09iG9vuObxZnx6SN+AyUWTF8MN0CcZE4Ywm5jZHK5aB5fP4iCFIqT4oRRTKRLo6lYVNeAHpG50wOzOe1zHr9NLQ+HoABybsD4HOKXXRA1JCoKhBELmI5pNaB6Fz0KKBAodDYPAgSUTmqYsAALx4m5nC6nW9nGq14KtaEUA9gR9PvuNCjQ9BgACNvcwNBtAcLiAA)
|
||||
|
||||
```ts
|
||||
class ArticleModel {
|
||||
title: string;
|
||||
content?: string;
|
||||
|
||||
constructor(title: string) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
|
||||
class InstanceCache<T extends (new (...arguments_: any[]) => any)> {
|
||||
private ClassConstructor: T;
|
||||
private cache: Map<string, InstanceType<T>> = new Map();
|
||||
|
||||
constructor (ctr: T) {
|
||||
this.ClassConstructor = ctr;
|
||||
}
|
||||
|
||||
getInstance (...arguments_: ConstructorParameters<T>): InstanceType<T> {
|
||||
const hash = this.calculateArgumentsHash(...arguments_);
|
||||
|
||||
const existingInstance = this.cache.get(hash);
|
||||
if (existingInstance !== undefined) {
|
||||
return existingInstance;
|
||||
}
|
||||
|
||||
return new this.ClassConstructor(...arguments_);
|
||||
}
|
||||
|
||||
private calculateArgumentsHash(...arguments_: any[]): string {
|
||||
// Calculate hash.
|
||||
return 'hash';
|
||||
}
|
||||
}
|
||||
|
||||
const articleCache = new InstanceCache(ArticleModel);
|
||||
const amazonArticle = articleCache.getInstance('Amazon forests burining!');
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`ReturnType<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#returntypetype) - Obtain the return type of a function type.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)
|
||||
|
||||
```ts
|
||||
/** Provides every element of the iterable `iter` into the `callback` function and stores the results in an array. */
|
||||
function mapIter<
|
||||
Elem,
|
||||
Func extends (elem: Elem) => any,
|
||||
Ret extends ReturnType<Func>
|
||||
>(iter: Iterable<Elem>, callback: Func): Ret[] {
|
||||
const mapped: Ret[] = [];
|
||||
|
||||
for (const elem of iter) {
|
||||
mapped.push(callback(elem));
|
||||
}
|
||||
|
||||
return mapped;
|
||||
}
|
||||
|
||||
const setObject: Set<string> = new Set();
|
||||
const mapObject: Map<number, string> = new Map();
|
||||
|
||||
mapIter(setObject, (value: string) => value.indexOf('Foo')); // number[]
|
||||
|
||||
mapIter(mapObject, ([key, value]: [number, string]) => {
|
||||
return key % 2 === 0 ? value : 'Odd';
|
||||
}); // string[]
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`InstanceType<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#instancetypetype) - Obtain the instance type of a constructor function type.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)
|
||||
|
||||
```ts
|
||||
class IdleService {
|
||||
doNothing (): void {}
|
||||
}
|
||||
|
||||
class News {
|
||||
title: string;
|
||||
content: string;
|
||||
|
||||
constructor(title: string, content: string) {
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
|
||||
const instanceCounter: Map<Function, number> = new Map();
|
||||
|
||||
interface Constructor {
|
||||
new(...arguments_: any[]): any;
|
||||
}
|
||||
|
||||
// Keep track how many instances of `Constr` constructor have been created.
|
||||
function getInstance<
|
||||
Constr extends Constructor,
|
||||
Arguments extends ConstructorParameters<Constr>
|
||||
>(constructor: Constr, ...arguments_: Arguments): InstanceType<Constr> {
|
||||
let count = instanceCounter.get(constructor) || 0;
|
||||
|
||||
const instance = new constructor(...arguments_);
|
||||
|
||||
instanceCounter.set(constructor, count + 1);
|
||||
|
||||
console.log(`Created ${count + 1} instances of ${Constr.name} class`);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
const idleService = getInstance(IdleService);
|
||||
// Will log: `Created 1 instances of IdleService class`
|
||||
const newsEntry = getInstance(News, 'New ECMAScript proposals!', 'Last month...');
|
||||
// Will log: `Created 1 instances of News class`
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Omit<T, K>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys) - Constructs a type by picking all properties from T and then removing K.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgIImAWzgG2QbwChlks4BzCAVShwC5kBnMKUcgbmKYAcIFgIjBs1YgOXMpSFMWbANoBdTiW5woFddwAW0kfKWEAvoUIB6U8gDCUCHEiNkICAHdkYAJ69kz4GC3JcPG4oAHteKDABBxCYNAxsPFBIWEQUCAAPJG4wZABySUFcgJAAEzMLXNV1ck0dIuCw6EjBADpy5AB1FAQ4EGQAV0YUP2AHDy8wEOQbUugmBLwtEIA3OcmQnEjuZBgQqE7gAGtgZAhwKHdkHFGwNvGUdDIcAGUliIBJEF3kAF5kAHlML4ADyPBIAGjyBUYRQAPnkqho4NoYQA+TiEGD9EAISIhPozErQMG4AASK2gn2+AApek9pCSXm8wFSQooAJQMUkAFQAsgAZACiOAgmDOOSIJAQ+OYyGl4DgoDmf2QJRCCH6YvALQQNjsEGFovF1NyJWAy1y7OUyHMyE+yRAuFImG4Iq1YDswHxbRINjA-SgfXlHqVUE4xiAA)
|
||||
|
||||
```ts
|
||||
interface Animal {
|
||||
imageUrl: string;
|
||||
species: string;
|
||||
images: string[];
|
||||
paragraphs: string[];
|
||||
}
|
||||
|
||||
// Creates new type with all properties of the `Animal` interface
|
||||
// except 'images' and 'paragraphs' properties. We can use this
|
||||
// type to render small hover tooltip for a wiki entry list.
|
||||
type AnimalShortInfo = Omit<Animal, 'images' | 'paragraphs'>;
|
||||
|
||||
function renderAnimalHoverInfo (animals: AnimalShortInfo[]): HTMLElement {
|
||||
const container = document.createElement('div');
|
||||
// Internal implementation.
|
||||
return container;
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Uppercase<S extends string>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#uppercasestringtype) - Transforms every character in a string into uppercase.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
```ts
|
||||
type T = Uppercase<'hello'>; // 'HELLO'
|
||||
|
||||
type T2 = Uppercase<'foo' | 'bar'>; // 'FOO' | 'BAR'
|
||||
|
||||
type T3<S extends string> = Uppercase<`aB${S}`>;
|
||||
type T4 = T3<'xYz'>; // 'ABXYZ'
|
||||
|
||||
type T5 = Uppercase<string>; // string
|
||||
type T6 = Uppercase<any>; // any
|
||||
type T7 = Uppercase<never>; // never
|
||||
type T8 = Uppercase<42>; // Error, type 'number' does not satisfy the constraint 'string'
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Lowercase<S extends string>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#lowercasestringtype) - Transforms every character in a string into lowercase.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
```ts
|
||||
type T = Lowercase<'HELLO'>; // 'hello'
|
||||
|
||||
type T2 = Lowercase<'FOO' | 'BAR'>; // 'foo' | 'bar'
|
||||
|
||||
type T3<S extends string> = Lowercase<`aB${S}`>;
|
||||
type T4 = T3<'xYz'>; // 'abxyz'
|
||||
|
||||
type T5 = Lowercase<string>; // string
|
||||
type T6 = Lowercase<any>; // any
|
||||
type T7 = Lowercase<never>; // never
|
||||
type T8 = Lowercase<42>; // Error, type 'number' does not satisfy the constraint 'string'
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Capitalize<S extends string>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#capitalizestringtype) - Transforms the first character in a string into uppercase.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
```ts
|
||||
type T = Capitalize<'hello'>; // 'Hello'
|
||||
|
||||
type T2 = Capitalize<'foo' | 'bar'>; // 'Foo' | 'Bar'
|
||||
|
||||
type T3<S extends string> = Capitalize<`aB${S}`>;
|
||||
type T4 = T3<'xYz'>; // 'ABxYz'
|
||||
|
||||
type T5 = Capitalize<string>; // string
|
||||
type T6 = Capitalize<any>; // any
|
||||
type T7 = Capitalize<never>; // never
|
||||
type T8 = Capitalize<42>; // Error, type 'number' does not satisfy the constraint 'string'
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Uncapitalize<S extends string>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#uncapitalizestringtype) - Transforms the first character in a string into lowercase.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
```ts
|
||||
type T = Uncapitalize<'Hello'>; // 'hello'
|
||||
|
||||
type T2 = Uncapitalize<'Foo' | 'Bar'>; // 'foo' | 'bar'
|
||||
|
||||
type T3<S extends string> = Uncapitalize<`AB${S}`>;
|
||||
type T4 = T3<'xYz'>; // 'aBxYz'
|
||||
|
||||
type T5 = Uncapitalize<string>; // string
|
||||
type T6 = Uncapitalize<any>; // any
|
||||
type T7 = Uncapitalize<never>; // never
|
||||
type T8 = Uncapitalize<42>; // Error, type 'number' does not satisfy the constraint 'string'
|
||||
```
|
||||
</details>
|
||||
|
||||
You can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/utility-types.html).
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Jarek Radosz](https://github.com/CvX)
|
||||
- [Dimitri Benin](https://github.com/BendingBender)
|
||||
- [Pelle Wessman](https://github.com/voxpelli)
|
||||
- [Sébastien Mischler](https://github.com/skarab42)
|
||||
|
||||
## License
|
||||
|
||||
SPDX-License-Identifier: (MIT OR CC0-1.0)
|
||||
@@ -0,0 +1,58 @@
|
||||
let comparisonMap = {
|
||||
atrule: ['name', 'params'],
|
||||
rule: ['selector'],
|
||||
}
|
||||
let types = new Set(Object.keys(comparisonMap))
|
||||
|
||||
export default function collapseAdjacentRules() {
|
||||
function collapseRulesIn(root) {
|
||||
let currentRule = null
|
||||
root.each((node) => {
|
||||
if (!types.has(node.type)) {
|
||||
currentRule = null
|
||||
return
|
||||
}
|
||||
|
||||
if (currentRule === null) {
|
||||
currentRule = node
|
||||
return
|
||||
}
|
||||
|
||||
let properties = comparisonMap[node.type]
|
||||
|
||||
if (node.type === 'atrule' && node.name === 'font-face') {
|
||||
currentRule = node
|
||||
} else if (
|
||||
properties.every(
|
||||
(property) =>
|
||||
(node[property] ?? '').replace(/\s+/g, ' ') ===
|
||||
(currentRule[property] ?? '').replace(/\s+/g, ' ')
|
||||
)
|
||||
) {
|
||||
// An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
|
||||
if (node.nodes) {
|
||||
currentRule.append(node.nodes)
|
||||
}
|
||||
|
||||
node.remove()
|
||||
} else {
|
||||
currentRule = node
|
||||
}
|
||||
})
|
||||
|
||||
// After we've collapsed adjacent rules & at-rules, we need to collapse
|
||||
// adjacent rules & at-rules that are children of at-rules.
|
||||
// We do not care about nesting rules because Tailwind CSS
|
||||
// explicitly does not handle rule nesting on its own as
|
||||
// the user is expected to use a nesting plugin
|
||||
root.each((node) => {
|
||||
if (node.type === 'atrule') {
|
||||
collapseRulesIn(node)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (root) => {
|
||||
collapseRulesIn(root)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
name: Publish on NPM
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '.github/workflows/npm-publish.yml'
|
||||
- 'package.json'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 15
|
||||
- name: Installing NPM deps
|
||||
run: npm install
|
||||
- name: Testing
|
||||
run: npm run test
|
||||
|
||||
publish-npm:
|
||||
needs: test
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 15
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- name: Installing NPM deps
|
||||
run: npm install
|
||||
env:
|
||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
|
||||
- name: Build modules
|
||||
run: npm run build
|
||||
- name: Publishing on NPM
|
||||
run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||
@@ -0,0 +1,65 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const copy = require('../copy').copy
|
||||
const remove = require('../remove').remove
|
||||
const mkdirp = require('../mkdirs').mkdirp
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
const stat = require('../util/stat')
|
||||
|
||||
function move (src, dest, opts, cb) {
|
||||
if (typeof opts === 'function') {
|
||||
cb = opts
|
||||
opts = {}
|
||||
}
|
||||
|
||||
const overwrite = opts.overwrite || opts.clobber || false
|
||||
|
||||
stat.checkPaths(src, dest, 'move', (err, stats) => {
|
||||
if (err) return cb(err)
|
||||
const { srcStat } = stats
|
||||
stat.checkParentPaths(src, srcStat, dest, 'move', err => {
|
||||
if (err) return cb(err)
|
||||
mkdirp(path.dirname(dest), err => {
|
||||
if (err) return cb(err)
|
||||
return doRename(src, dest, overwrite, cb)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function doRename (src, dest, overwrite, cb) {
|
||||
if (overwrite) {
|
||||
return remove(dest, err => {
|
||||
if (err) return cb(err)
|
||||
return rename(src, dest, overwrite, cb)
|
||||
})
|
||||
}
|
||||
pathExists(dest, (err, destExists) => {
|
||||
if (err) return cb(err)
|
||||
if (destExists) return cb(new Error('dest already exists.'))
|
||||
return rename(src, dest, overwrite, cb)
|
||||
})
|
||||
}
|
||||
|
||||
function rename (src, dest, overwrite, cb) {
|
||||
fs.rename(src, dest, err => {
|
||||
if (!err) return cb()
|
||||
if (err.code !== 'EXDEV') return cb(err)
|
||||
return moveAcrossDevice(src, dest, overwrite, cb)
|
||||
})
|
||||
}
|
||||
|
||||
function moveAcrossDevice (src, dest, overwrite, cb) {
|
||||
const opts = {
|
||||
overwrite,
|
||||
errorOnExist: true
|
||||
}
|
||||
copy(src, dest, opts, err => {
|
||||
if (err) return cb(err)
|
||||
return remove(src, cb)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = move
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"word-wrap","version":"1.2.3","files":{"package.json":{"checkedAt":1678883672187,"integrity":"sha512-9zELSC38S59zB0irpaJUKa86OBuGPqOfZl/r+hnhab6sEjxDUtpgiT0alceDNwVTV0LlFHaTlnfn8UtdkvJzsQ==","mode":420,"size":1724},"README.md":{"checkedAt":1678883672188,"integrity":"sha512-AH/Tcx7qcvYtifxyz70Li6DjKDbEZFVWAik+jKv7dtmyd5R3DfApX3CvuyGCHgOgpnKUO27zgTXYzPbwGNzuZQ==","mode":420,"size":5461},"LICENSE":{"checkedAt":1678883672188,"integrity":"sha512-tvfTdJiWJDiFPpsR/I9WZSs0oBmhGFXq7UhlakT0rx9viP394eXYZoTSYAH9KLC6LQkxkGWAeqY2WHVWHwxwPQ==","mode":420,"size":1087},"index.js":{"checkedAt":1678883672188,"integrity":"sha512-kqMLJRIKsNqpeIziEdjaFI8ypX9o0XWxMmy/TH5hRpAOeV30ZCgxEAkBcQTPImOGnEJBg9iE8mqUln/6bggV4w==","mode":420,"size":1070},"index.d.ts":{"checkedAt":1678883672188,"integrity":"sha512-rdf11izxXrhY+bSpZuevZMhxJ8NO+oZ2/6ZhID0hEqtRywPBwuf1twVIJIx+TUFryPYnSiQX2dcMmVWNnwcsAg==","mode":420,"size":1242}}}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "frac",
|
||||
"version": "1.1.2",
|
||||
"author": "SheetJS",
|
||||
"description": "Rational approximation with bounded denominator",
|
||||
"keywords": [ "math", "fraction", "rational", "approximation" ],
|
||||
"main": "./frac",
|
||||
"types": "types",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"voc": "~1.1.0",
|
||||
"mocha": "~2.5.3",
|
||||
"blanket": "~1.2.3",
|
||||
"codepage": "~1.10.0",
|
||||
"@sheetjs/uglify-js": "~2.7.3",
|
||||
"@types/node": "^8.0.7",
|
||||
"dtslint": "^0.1.2",
|
||||
"typescript": "2.2.0"
|
||||
},
|
||||
"repository": { "type":"git", "url":"git://github.com/SheetJS/frac.git" },
|
||||
"scripts": {
|
||||
"test": "make test",
|
||||
"build": "make",
|
||||
"lint": "make fullint",
|
||||
"dtslint": "dtslint types"
|
||||
},
|
||||
"config": {
|
||||
"blanket": {
|
||||
"pattern": "frac.js"
|
||||
}
|
||||
},
|
||||
"homepage": "http://sheetjs.com/opensource",
|
||||
"bugs": { "url": "https://github.com/SheetJS/frac/issues" },
|
||||
"license": "Apache-2.0",
|
||||
"engines": { "node": ">=0.8" }
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AjaxResponse.js","sourceRoot":"","sources":["../../../../src/internal/ajax/AjaxResponse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBlD,MAAM,OAAO,YAAY;IA+CvB,YAIkB,aAA4B,EAM5B,GAAmB,EAInB,OAAoB,EAcpB,OAAyB,eAAe;QAxBxC,kBAAa,GAAb,aAAa,CAAe;QAM5B,QAAG,GAAH,GAAG,CAAgB;QAInB,YAAO,GAAP,OAAO,CAAa;QAcpB,SAAI,GAAJ,IAAI,CAAoC;QAExD,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,YAAY,GAAG,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,CAAC;QASvC,MAAM,UAAU,GAAG,GAAG,CAAC,qBAAqB,EAAE,CAAC;QAC/C,IAAI,CAAC,eAAe,GAAG,UAAU;YAC/B,CAAC;gBACC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,OAA+B,EAAE,IAAI,EAAE,EAAE;oBAItE,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;oBACjC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;oBACtD,OAAO,OAAO,CAAC;gBACjB,CAAC,EAAE,EAAE,CAAC;YACR,CAAC,CAAC,EAAE,CAAC;QAEP,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { asyncScheduler } from '../scheduler/async';
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
export function debounceTime(dueTime, scheduler = asyncScheduler) {
|
||||
return operate((source, subscriber) => {
|
||||
let activeTask = null;
|
||||
let lastValue = null;
|
||||
let lastTime = null;
|
||||
const emit = () => {
|
||||
if (activeTask) {
|
||||
activeTask.unsubscribe();
|
||||
activeTask = null;
|
||||
const value = lastValue;
|
||||
lastValue = null;
|
||||
subscriber.next(value);
|
||||
}
|
||||
};
|
||||
function emitWhenIdle() {
|
||||
const targetTime = lastTime + dueTime;
|
||||
const now = scheduler.now();
|
||||
if (now < targetTime) {
|
||||
activeTask = this.schedule(undefined, targetTime - now);
|
||||
subscriber.add(activeTask);
|
||||
return;
|
||||
}
|
||||
emit();
|
||||
}
|
||||
source.subscribe(createOperatorSubscriber(subscriber, (value) => {
|
||||
lastValue = value;
|
||||
lastTime = scheduler.now();
|
||||
if (!activeTask) {
|
||||
activeTask = scheduler.schedule(emitWhenIdle, dueTime);
|
||||
subscriber.add(activeTask);
|
||||
}
|
||||
}, () => {
|
||||
emit();
|
||||
subscriber.complete();
|
||||
}, undefined, () => {
|
||||
lastValue = activeTask = null;
|
||||
}));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=debounceTime.js.map
|
||||
@@ -0,0 +1,7 @@
|
||||
export type FixedDonation = {
|
||||
_amount: number;
|
||||
amount: number;
|
||||
id: number;
|
||||
donor: string;
|
||||
paidAmount: number;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC tB I v J D E F A B C K L G EC FC","132":"0 M N O w g x y z","260":"1 2 3 4 5 6","516":"7"},D:{"1":"AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"I v J D E F A B C K L G M N O","1028":"0 1 2 3 4 5 6 7 8 9 w g x y z"},E:{"1":"F A B C K L G LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E HC zB IC JC KC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"F B C PC QC RC SC qB AC TC rB","1028":"G M N O w g"},G:{"1":"ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC","1028":"sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:6,C:"ES6 Number"};
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Khaled Al-Ansari
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,10 @@
|
||||
export default function slash(path) {
|
||||
const isExtendedLengthPath = /^\\\\\?\\/.test(path);
|
||||
const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex
|
||||
|
||||
if (isExtendedLengthPath || hasNonAscii) {
|
||||
return path;
|
||||
}
|
||||
|
||||
return path.replace(/\\/g, '/');
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0.03517,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0.00502,"34":0,"35":0,"36":0,"37":0.00502,"38":0.00502,"39":0,"40":0.00502,"41":0.0201,"42":0,"43":0.00502,"44":0.00502,"45":0,"46":0.00502,"47":0.01005,"48":0.09043,"49":0,"50":0.00502,"51":0,"52":0,"53":0.00502,"54":0.00502,"55":0,"56":0.0201,"57":0.01005,"58":0,"59":0.00502,"60":0,"61":0.01005,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.01005,"68":0.00502,"69":0,"70":0,"71":0,"72":0.01005,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.05526,"79":0.17584,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0.01507,"87":0,"88":0.02512,"89":0.01005,"90":0.00502,"91":0,"92":0,"93":0,"94":0,"95":0.05526,"96":0,"97":0.00502,"98":0.01005,"99":0.01507,"100":0.00502,"101":0.01005,"102":0.01507,"103":0.01507,"104":0,"105":0.01005,"106":0.05024,"107":0.04522,"108":0.2512,"109":1.95936,"110":1.25098,"111":0.22106,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0.01507,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0.04019,"43":0.00502,"44":0,"45":0.02512,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0.00502,"55":0,"56":0,"57":0,"58":0.14067,"59":0.01005,"60":0.01507,"61":0,"62":0.00502,"63":0.01005,"64":0.01507,"65":0.03517,"66":0.00502,"67":0.01507,"68":0.03014,"69":0,"70":0,"71":0,"72":0.01005,"73":0.00502,"74":0.05526,"75":0.0201,"76":0,"77":0.00502,"78":0,"79":0.00502,"80":0.1256,"81":0.01005,"83":0.01507,"84":0.00502,"85":0.01507,"86":0.00502,"87":0.02512,"88":0.00502,"89":0.00502,"90":0.01005,"91":0.01005,"92":0.00502,"93":0.00502,"94":0,"95":0.01005,"96":0.02512,"97":0.0201,"98":0.01507,"99":0.02512,"100":0.01507,"101":0.01005,"102":0.0201,"103":0.11053,"104":0.04522,"105":0.03517,"106":0.03014,"107":0.06531,"108":0.31651,"109":9.90733,"110":3.66752,"111":0,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0.03014,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0.00502,"55":0,"56":0,"57":0,"58":0.01005,"60":0.01005,"62":0,"63":0.01005,"64":0.01005,"65":0,"66":0.01005,"67":0.17584,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0.01005,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0.00502,"91":0.00502,"92":0.01005,"93":0.01005,"94":0.26627,"95":0.21101,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0.00502},B:{"12":0.01005,"13":0.00502,"14":0.00502,"15":0,"16":0.01005,"17":0.01005,"18":0.0201,"79":0,"80":0,"81":0,"83":0,"84":0.01005,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0.01507,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0.01507,"97":0,"98":0.01507,"99":0.01005,"100":0.01507,"101":0.01005,"102":0,"103":0.01507,"104":0.02512,"105":0.0201,"106":0.03517,"107":0.05526,"108":0.18086,"109":1.1505,"110":1.256},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0.00502,"13":0.00502,"14":0.0201,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0.00502,"12.1":0.0201,"13.1":0.04019,"14.1":0.06531,"15.1":0.07034,"15.2-15.3":0.01005,"15.4":0.04522,"15.5":0.06029,"15.6":0.01507,"16.0":0,"16.1":0.01507,"16.2":0.06531,"16.3":0.03517,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.00085,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0.00507,"9.3":0.01099,"10.0-10.2":0.00507,"10.3":0.08457,"11.0-11.2":0.00085,"11.3-11.4":0.00423,"12.0-12.1":0.08203,"12.2-12.5":0.73914,"13.0-13.1":0.04059,"13.2":0.00592,"13.3":0.06512,"13.4-13.7":0.13193,"14.0-14.4":0.60637,"14.5-14.8":0.67149,"15.0-15.1":0.75944,"15.2-15.3":0.24102,"15.4":0.19451,"15.5":0.55309,"15.6":0.99285,"16.0":0.57592,"16.1":0.62666,"16.2":0.97002,"16.3":0.61736,"16.4":0.00254},P:{"4":0.14147,"20":0.09095,"5.0-5.4":0.01011,"6.2-6.4":0.01011,"7.2-7.4":0.12126,"8.2":0,"9.2":0.03032,"10.1":0,"11.1-11.2":0.09095,"12.0":0.01011,"13.0":0.02021,"14.0":0.07074,"15.0":0.02021,"16.0":0.18189,"17.0":0.05053,"18.0":0.09095,"19.0":0.37389},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.01716,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.04289},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.05024,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.69166},H:{"0":0.9893},L:{"0":63.63792},R:{_:"0"},M:{"0":0.1443},Q:{"13.1":0.00498}};
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var isNumber = require("./is-number-value");
|
||||
|
||||
module.exports = function (value) { return isNumber(value) && isFinite(value); };
|
||||
@@ -0,0 +1,8 @@
|
||||
import { asyncScheduler } from '../scheduler/async';
|
||||
import { defaultThrottleConfig, throttle } from './throttle';
|
||||
import { timer } from '../observable/timer';
|
||||
export function throttleTime(duration, scheduler = asyncScheduler, config = defaultThrottleConfig) {
|
||||
const duration$ = timer(duration, scheduler);
|
||||
return throttle(() => duration$, config);
|
||||
}
|
||||
//# sourceMappingURL=throttleTime.js.map
|
||||
@@ -0,0 +1,24 @@
|
||||
import { EmptyError } from './util/EmptyError';
|
||||
import { SafeSubscriber } from './Subscriber';
|
||||
export function firstValueFrom(source, config) {
|
||||
var hasConfig = typeof config === 'object';
|
||||
return new Promise(function (resolve, reject) {
|
||||
var subscriber = new SafeSubscriber({
|
||||
next: function (value) {
|
||||
resolve(value);
|
||||
subscriber.unsubscribe();
|
||||
},
|
||||
error: reject,
|
||||
complete: function () {
|
||||
if (hasConfig) {
|
||||
resolve(config.defaultValue);
|
||||
}
|
||||
else {
|
||||
reject(new EmptyError());
|
||||
}
|
||||
},
|
||||
});
|
||||
source.subscribe(subscriber);
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=firstValueFrom.js.map
|
||||
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.subscribeToArray = void 0;
|
||||
var subscribeToArray = function (array) { return function (subscriber) {
|
||||
for (var i = 0, len = array.length; i < len && !subscriber.closed; i++) {
|
||||
subscriber.next(array[i]);
|
||||
}
|
||||
subscriber.complete();
|
||||
}; };
|
||||
exports.subscribeToArray = subscribeToArray;
|
||||
//# sourceMappingURL=subscribeToArray.js.map
|
||||
@@ -0,0 +1,111 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isPostalCode;
|
||||
exports.locales = void 0;
|
||||
|
||||
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// common patterns
|
||||
var threeDigit = /^\d{3}$/;
|
||||
var fourDigit = /^\d{4}$/;
|
||||
var fiveDigit = /^\d{5}$/;
|
||||
var sixDigit = /^\d{6}$/;
|
||||
var patterns = {
|
||||
AD: /^AD\d{3}$/,
|
||||
AT: fourDigit,
|
||||
AU: fourDigit,
|
||||
AZ: /^AZ\d{4}$/,
|
||||
BA: /^([7-8]\d{4}$)/,
|
||||
BE: fourDigit,
|
||||
BG: fourDigit,
|
||||
BR: /^\d{5}-\d{3}$/,
|
||||
BY: /^2[1-4]\d{4}$/,
|
||||
CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,
|
||||
CH: fourDigit,
|
||||
CN: /^(0[1-7]|1[012356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[1-5]|8[1345]|9[09])\d{4}$/,
|
||||
CZ: /^\d{3}\s?\d{2}$/,
|
||||
DE: fiveDigit,
|
||||
DK: fourDigit,
|
||||
DO: fiveDigit,
|
||||
DZ: fiveDigit,
|
||||
EE: fiveDigit,
|
||||
ES: /^(5[0-2]{1}|[0-4]{1}\d{1})\d{3}$/,
|
||||
FI: fiveDigit,
|
||||
FR: /^\d{2}\s?\d{3}$/,
|
||||
GB: /^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i,
|
||||
GR: /^\d{3}\s?\d{2}$/,
|
||||
HR: /^([1-5]\d{4}$)/,
|
||||
HT: /^HT\d{4}$/,
|
||||
HU: fourDigit,
|
||||
ID: fiveDigit,
|
||||
IE: /^(?!.*(?:o))[A-Za-z]\d[\dw]\s\w{4}$/i,
|
||||
IL: /^(\d{5}|\d{7})$/,
|
||||
IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/,
|
||||
IR: /^(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}$/,
|
||||
IS: threeDigit,
|
||||
IT: fiveDigit,
|
||||
JP: /^\d{3}\-\d{4}$/,
|
||||
KE: fiveDigit,
|
||||
KR: /^(\d{5}|\d{6})$/,
|
||||
LI: /^(948[5-9]|949[0-7])$/,
|
||||
LT: /^LT\-\d{5}$/,
|
||||
LU: fourDigit,
|
||||
LV: /^LV\-\d{4}$/,
|
||||
LK: fiveDigit,
|
||||
MG: threeDigit,
|
||||
MX: fiveDigit,
|
||||
MT: /^[A-Za-z]{3}\s{0,1}\d{4}$/,
|
||||
MY: fiveDigit,
|
||||
NL: /^\d{4}\s?[a-z]{2}$/i,
|
||||
NO: fourDigit,
|
||||
NP: /^(10|21|22|32|33|34|44|45|56|57)\d{3}$|^(977)$/i,
|
||||
NZ: fourDigit,
|
||||
PL: /^\d{2}\-\d{3}$/,
|
||||
PR: /^00[679]\d{2}([ -]\d{4})?$/,
|
||||
PT: /^\d{4}\-\d{3}?$/,
|
||||
RO: sixDigit,
|
||||
RU: sixDigit,
|
||||
SA: fiveDigit,
|
||||
SE: /^[1-9]\d{2}\s?\d{2}$/,
|
||||
SG: sixDigit,
|
||||
SI: fourDigit,
|
||||
SK: /^\d{3}\s?\d{2}$/,
|
||||
TH: fiveDigit,
|
||||
TN: fourDigit,
|
||||
TW: /^\d{3}(\d{2})?$/,
|
||||
UA: fiveDigit,
|
||||
US: /^\d{5}(-\d{4})?$/,
|
||||
ZA: fourDigit,
|
||||
ZM: fiveDigit
|
||||
};
|
||||
var locales = Object.keys(patterns);
|
||||
exports.locales = locales;
|
||||
|
||||
function isPostalCode(str, locale) {
|
||||
(0, _assertString.default)(str);
|
||||
|
||||
if (locale in patterns) {
|
||||
return patterns[locale].test(str);
|
||||
} else if (locale === 'any') {
|
||||
for (var key in patterns) {
|
||||
// https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes
|
||||
// istanbul ignore else
|
||||
if (patterns.hasOwnProperty(key)) {
|
||||
var pattern = patterns[key];
|
||||
|
||||
if (pattern.test(str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
throw new Error("Invalid locale '".concat(locale, "'"));
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../../../src/internal/operators/publish.ts"],"names":[],"mappings":";;;AACA,sCAAqC;AACrC,yCAAwC;AAGxC,qCAAoC;AAqFpC,SAAgB,OAAO,CAAO,QAAiC;IAC7D,OAAO,QAAQ,CAAC,CAAC,CAAC,UAAC,MAAM,IAAK,OAAA,iBAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAzB,CAAyB,CAAC,CAAC,CAAC,UAAC,MAAM,IAAK,OAAA,qBAAS,CAAC,IAAI,iBAAO,EAAK,CAAC,CAAC,MAAM,CAAC,EAAnC,CAAmC,CAAC;AAC5G,CAAC;AAFD,0BAEC"}
|
||||
@@ -0,0 +1,136 @@
|
||||
import { Fork } from "../types";
|
||||
declare type Deep = boolean | ((type: Type<any>, value: any) => void);
|
||||
export declare type Type<T> = ArrayType<T> | IdentityType<T> | ObjectType<T> | OrType<T> | PredicateType<T>;
|
||||
export interface AnyType {
|
||||
toString(): string;
|
||||
check(value: any, deep?: Deep): boolean;
|
||||
assert(value: any, deep?: Deep): boolean;
|
||||
arrayOf(): AnyType;
|
||||
}
|
||||
declare abstract class BaseType<T> {
|
||||
abstract toString(): string;
|
||||
abstract check(value: any, deep?: Deep): value is T;
|
||||
assert(value: any, deep?: Deep): value is T;
|
||||
arrayOf(): Type<T[]>;
|
||||
}
|
||||
declare class ArrayType<T> extends BaseType<T> {
|
||||
readonly elemType: Type<T extends (infer E)[] ? E : never>;
|
||||
readonly kind: "ArrayType";
|
||||
constructor(elemType: Type<T extends (infer E)[] ? E : never>);
|
||||
toString(): string;
|
||||
check(value: any, deep?: Deep): value is T;
|
||||
}
|
||||
declare class IdentityType<T> extends BaseType<T> {
|
||||
readonly value: T;
|
||||
readonly kind: "IdentityType";
|
||||
constructor(value: T);
|
||||
toString(): string;
|
||||
check(value: any, deep?: Deep): value is T;
|
||||
}
|
||||
declare class ObjectType<T> extends BaseType<T> {
|
||||
readonly fields: Field<any>[];
|
||||
readonly kind: "ObjectType";
|
||||
constructor(fields: Field<any>[]);
|
||||
toString(): string;
|
||||
check(value: any, deep?: Deep): value is T;
|
||||
}
|
||||
declare class OrType<T> extends BaseType<T> {
|
||||
readonly types: Type<any>[];
|
||||
readonly kind: "OrType";
|
||||
constructor(types: Type<any>[]);
|
||||
toString(): string;
|
||||
check(value: any, deep?: Deep): value is T;
|
||||
}
|
||||
declare class PredicateType<T> extends BaseType<T> {
|
||||
readonly name: string;
|
||||
readonly predicate: (value: any, deep?: Deep) => boolean;
|
||||
readonly kind: "PredicateType";
|
||||
constructor(name: string, predicate: (value: any, deep?: Deep) => boolean);
|
||||
toString(): string;
|
||||
check(value: any, deep?: Deep): value is T;
|
||||
}
|
||||
export declare abstract class Def<T = any> {
|
||||
readonly type: Type<T>;
|
||||
readonly typeName: string;
|
||||
baseNames: string[];
|
||||
ownFields: {
|
||||
[name: string]: Field<any>;
|
||||
};
|
||||
allSupertypes: {
|
||||
[name: string]: Def<any>;
|
||||
};
|
||||
supertypeList: string[];
|
||||
allFields: {
|
||||
[name: string]: Field<any>;
|
||||
};
|
||||
fieldNames: string[];
|
||||
finalized: boolean;
|
||||
buildable: boolean;
|
||||
buildParams: string[];
|
||||
constructor(type: Type<T>, typeName: string);
|
||||
isSupertypeOf(that: Def<any>): boolean;
|
||||
checkAllFields(value: any, deep?: any): boolean;
|
||||
abstract check(value: any, deep?: any): boolean;
|
||||
bases(...supertypeNames: string[]): this;
|
||||
abstract build(...buildParams: string[]): this;
|
||||
abstract field(name: string, type: any, defaultFn?: Function, hidden?: boolean): this;
|
||||
abstract finalize(): void;
|
||||
}
|
||||
declare class Field<T> {
|
||||
readonly name: string;
|
||||
readonly type: Type<T>;
|
||||
readonly defaultFn?: Function | undefined;
|
||||
readonly hidden: boolean;
|
||||
constructor(name: string, type: Type<T>, defaultFn?: Function | undefined, hidden?: boolean);
|
||||
toString(): string;
|
||||
getValue(obj: {
|
||||
[key: string]: any;
|
||||
}): any;
|
||||
}
|
||||
declare type FieldType<T> = Field<T>;
|
||||
export { FieldType as Field };
|
||||
export interface ASTNode {
|
||||
type: string;
|
||||
}
|
||||
export interface Builder {
|
||||
(...args: any[]): ASTNode;
|
||||
from(obj: {
|
||||
[param: string]: any;
|
||||
}): ASTNode;
|
||||
}
|
||||
export default function typesPlugin(_fork: Fork): {
|
||||
Type: {
|
||||
or(...types: any[]): Type<any>;
|
||||
from<T>(value: any, name?: string | undefined): Type<T>;
|
||||
def(typeName: string): Def;
|
||||
hasDef(typeName: string): boolean;
|
||||
};
|
||||
builtInTypes: {
|
||||
string: Type<string>;
|
||||
function: Type<Function>;
|
||||
array: Type<any[]>;
|
||||
object: Type<{
|
||||
[key: string]: any;
|
||||
}>;
|
||||
RegExp: Type<RegExp>;
|
||||
Date: Type<Date>;
|
||||
number: Type<number>;
|
||||
boolean: Type<boolean>;
|
||||
null: Type<null>;
|
||||
undefined: Type<undefined>;
|
||||
};
|
||||
getSupertypeNames: (typeName: string) => string[];
|
||||
computeSupertypeLookupTable: (candidates: any) => {
|
||||
[typeName: string]: any;
|
||||
};
|
||||
builders: import("../gen/builders").builders;
|
||||
defineMethod: (name: any, func?: Function | undefined) => Function;
|
||||
getBuilderName: (typeName: any) => any;
|
||||
getStatementBuilderName: (typeName: any) => any;
|
||||
namedTypes: import("../gen/namedTypes").NamedTypes;
|
||||
getFieldNames: (object: any) => string[];
|
||||
getFieldValue: (object: any, fieldName: any) => any;
|
||||
eachField: (object: any, callback: (name: any, value: any) => any, context?: any) => void;
|
||||
someField: (object: any, callback: (name: any, value: any) => any, context?: any) => boolean;
|
||||
finalize: () => void;
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
let fs = require('fs')
|
||||
let path = require('path')
|
||||
|
||||
let engines = {
|
||||
stable: {
|
||||
files: [
|
||||
path.resolve(__dirname, '..', 'package.stable.json'),
|
||||
path.resolve(__dirname, '..', 'package-lock.stable.json'),
|
||||
],
|
||||
},
|
||||
oxide: {
|
||||
files: [
|
||||
path.resolve(__dirname, '..', 'package.oxide.json'),
|
||||
path.resolve(__dirname, '..', 'package-lock.oxide.json'),
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
// Find out what the current engine is that we are using:
|
||||
let [otherEngine, info] = Object.entries(engines).find(([, info]) =>
|
||||
info.files.every((file) => fs.existsSync(file))
|
||||
)
|
||||
let currentEngine = otherEngine === 'oxide' ? 'stable' : 'oxide'
|
||||
|
||||
console.log(`Current engine: \`${currentEngine}\`, swapping to \`${otherEngine}\``)
|
||||
|
||||
// Swap the engines
|
||||
for (let file of info.files) {
|
||||
fs.renameSync(
|
||||
file.replace(`.${otherEngine}`, ''),
|
||||
file.replace(`.${otherEngine}`, `.${currentEngine}`)
|
||||
)
|
||||
}
|
||||
for (let file of engines[otherEngine].files) {
|
||||
fs.renameSync(file, file.replace(`.${otherEngine}`, ''))
|
||||
}
|
||||
|
||||
console.log(
|
||||
'Engines have been swapped. Make sure to run `npm install` to update your dependencies.'
|
||||
)
|
||||
@@ -0,0 +1,63 @@
|
||||
import tslib from '../tslib.js';
|
||||
const {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__esDecorate,
|
||||
__runInitializers,
|
||||
__propKey,
|
||||
__setFunctionName,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__exportStar,
|
||||
__createBinding,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__spreadArray,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
__classPrivateFieldIn,
|
||||
} = tslib;
|
||||
export {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__esDecorate,
|
||||
__runInitializers,
|
||||
__propKey,
|
||||
__setFunctionName,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__exportStar,
|
||||
__createBinding,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__spreadArray,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
__classPrivateFieldIn,
|
||||
};
|
||||
@@ -0,0 +1,63 @@
|
||||
# macos-release
|
||||
|
||||
> Get the name and version of a macOS release from the Darwin version\
|
||||
> Example: `13.2.0` → `{name: 'Mavericks', version: '10.9'}`
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install macos-release
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import os from 'node:os';
|
||||
import macosRelease from 'macos-release';
|
||||
|
||||
// On a macOS Sierra system
|
||||
|
||||
macosRelease();
|
||||
//=> {name: 'Sierra', version: '10.12'}
|
||||
|
||||
os.release();
|
||||
//=> 13.2.0
|
||||
// This is the Darwin kernel version
|
||||
|
||||
macosRelease(os.release());
|
||||
//=> {name: 'Sierra', version: '10.12'}
|
||||
|
||||
macosRelease('14.0.0');
|
||||
//=> {name: 'Yosemite', version: '10.10'}
|
||||
|
||||
macosRelease('20.0.0');
|
||||
//=> {name: 'Big Sur', version: '11'}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### macosRelease(release?)
|
||||
|
||||
#### release
|
||||
|
||||
Type: `string`
|
||||
|
||||
By default, the current operating system is used, but you can supply a custom [Darwin kernel version](https://en.wikipedia.org/wiki/Darwin_%28operating_system%29#Release_history), which is the output of [`os.release()`](https://nodejs.org/api/os.html#os_os_release).
|
||||
|
||||
## Related
|
||||
|
||||
- [os-name](https://github.com/sindresorhus/os-name) - Get the name of the current operating system. Example: `macOS Sierra`
|
||||
- [macos-version](https://github.com/sindresorhus/macos-version) - Get the macOS version of the current system. Example: `10.9.3`
|
||||
- [win-release](https://github.com/sindresorhus/win-release) - Get the name of a Windows version from the release number: `5.1.2600` → `XP`
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-macos-release?utm_source=npm-macos-release&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var hasSymbols = require('has-symbols/shams');
|
||||
|
||||
module.exports = function hasToStringTagShams() {
|
||||
return hasSymbols() && !!Symbol.toStringTag;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"shareReplay.js","sourceRoot":"","sources":["../../../../src/internal/operators/shareReplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAwJhC,MAAM,UAAU,WAAW,CACzB,kBAA+C,EAC/C,UAAmB,EACnB,SAAyB;;IAEzB,IAAI,UAAkB,CAAC;IACvB,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,kBAAkB,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE;QAChE,CAAG,KAA8E,kBAAkB,WAA3E,EAArB,UAAU,mBAAG,QAAQ,KAAA,EAAE,KAAuD,kBAAkB,WAApD,EAArB,UAAU,mBAAG,QAAQ,KAAA,EAAE,KAAgC,kBAAkB,SAAlC,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAAE,SAAS,GAAK,kBAAkB,UAAvB,CAAwB,CAAC;KACtG;SAAM;QACL,UAAU,GAAG,CAAC,kBAAkB,aAAlB,kBAAkB,cAAlB,kBAAkB,GAAI,QAAQ,CAAW,CAAC;KACzD;IACD,OAAO,KAAK,CAAI;QACd,SAAS,EAAE,cAAM,OAAA,IAAI,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,EAApD,CAAoD;QACrE,YAAY,EAAE,IAAI;QAClB,eAAe,EAAE,KAAK;QACtB,mBAAmB,EAAE,QAAQ;KAC9B,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference lib="es2020.bigint"/>
|
||||
|
||||
/**
|
||||
Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
|
||||
|
||||
@category Basic
|
||||
*/
|
||||
export type TypedArray =
|
||||
| Int8Array
|
||||
| Uint8Array
|
||||
| Uint8ClampedArray
|
||||
| Int16Array
|
||||
| Uint16Array
|
||||
| Int32Array
|
||||
| Uint32Array
|
||||
| Float32Array
|
||||
| Float64Array
|
||||
| BigInt64Array
|
||||
| BigUint64Array;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"F A B","2":"J D E CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC tB I v J D E F A B C EC FC"},D:{"1":"1 2 3 4 5 6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 I v J D E F A B C K L G M N O w g x y z"},E:{"1":"D E F A B C K L G KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J HC zB IC JC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e RC SC qB AC TC rB","2":"F PC QC"},G:{"1":"E XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC BC VC WC"},H:{"1":"oC"},I:{"1":"f tC uC","2":"tB I pC qC rC sC BC"},J:{"1":"A","2":"D"},K:{"1":"B C h qB AC rB","2":"A"},L:{"1":"H"},M:{"1":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:4,C:"CSS background-position edge offsets"};
|
||||
@@ -0,0 +1,11 @@
|
||||
export default function escapeStringRegexp(string) {
|
||||
if (typeof string !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
// Escape characters with special meaning either inside or outside character sets.
|
||||
// Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
||||
return string
|
||||
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
|
||||
.replace(/-/g, '\\x2d');
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
# has-proto <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
Does this environment have the ability to set the [[Prototype]] of an object on creation with `__proto__`?
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var hasProto = require('has-proto');
|
||||
var assert = require('assert');
|
||||
|
||||
assert.equal(typeof hasProto(), 'boolean');
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.org/package/has-proto
|
||||
[npm-version-svg]: https://versionbadg.es/inspect-js/has-proto.svg
|
||||
[deps-svg]: https://david-dm.org/inspect-js/has-proto.svg
|
||||
[deps-url]: https://david-dm.org/inspect-js/has-proto
|
||||
[dev-deps-svg]: https://david-dm.org/inspect-js/has-proto/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/inspect-js/has-proto#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/has-proto.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/has-proto.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/has-proto.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=has-proto
|
||||
[codecov-image]: https://codecov.io/gh/inspect-js/has-proto/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/inspect-js/has-proto/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-proto
|
||||
[actions-url]: https://github.com/inspect-js/has-proto/actions
|
||||
@@ -0,0 +1,139 @@
|
||||
// Type definitions for pug 2.0
|
||||
// Project: https://github.com/pugjs/pug
|
||||
// Definitions by: TonyYang <https://github.com/TonyPythoneer>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Table of Contents
|
||||
*
|
||||
* - Options https://pugjs.org/api/reference.html#options
|
||||
* - Methods https://pugjs.org/api/reference.html#methods
|
||||
*
|
||||
* The order of contents is according to pugjs API document.
|
||||
*/
|
||||
declare module 'pug' {
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Options https://pugjs.org/api/reference.html#options ///
|
||||
////////////////////////////////////////////////////////////
|
||||
export interface Options {
|
||||
/** The name of the file being compiled. Used in exceptions, and required for relative includes and extends. Defaults to 'Pug'. */
|
||||
filename?: string | undefined,
|
||||
/** The root directory of all absolute inclusion. */
|
||||
basedir?: string | undefined,
|
||||
/** If the doctype is not specified as part of the template, you can specify it here. It is sometimes useful to get self-closing tags and remove mirroring of boolean attributes; see doctype documentation for more information. */
|
||||
doctype?: string | undefined,
|
||||
/** Adds whitespace to the resulting HTML to make it easier for a human to read using ' ' as indentation. If a string is specified, that will be used as indentation instead (e.g. '\t'). Defaults to false. */
|
||||
pretty?: boolean | string | undefined,
|
||||
/** Hash table of custom filters. Defaults to undefined. */
|
||||
filters?: any,
|
||||
/** Use a self namespace to hold the locals. It will speed up the compilation, but instead of writing variable you will have to write self.variable to access a property of the locals object. Defaults to false. */
|
||||
self?: boolean | undefined,
|
||||
/** If set to true, the tokens and function body are logged to stdout. */
|
||||
debug?: boolean | undefined,
|
||||
/** If set to true, the function source will be included in the compiled template for better error messages (sometimes useful in development). It is enabled by default unless used with Express in production mode. */
|
||||
compileDebug?: boolean | undefined,
|
||||
/** Add a list of global names to make accessible in templates. */
|
||||
globals?: Array<string> | undefined,
|
||||
/** If set to true, compiled functions are cached. filename must be set as the cache key. Only applies to render functions. Defaults to false. */
|
||||
cache?: boolean | undefined,
|
||||
/** Inline runtime functions instead of require-ing them from a shared version. For compileClient functions, the default is true so that one does not have to include the runtime. For all other compilation or rendering types, the default is false. */
|
||||
inlineRuntimeFunctions?: boolean | undefined,
|
||||
/** The name of the template function. Only applies to compileClient functions. Defaults to 'template'. */
|
||||
name?: string | undefined
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Methods https://pugjs.org/api/reference.html#methods ///
|
||||
////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Compile a Pug template to a function which can be rendered multiple times with different locals.
|
||||
*/
|
||||
export function compile(template: string, options?: Options): compileTemplate;
|
||||
|
||||
/**
|
||||
* Compile a Pug template from a file to a function which can be rendered multiple times with different locals.
|
||||
*/
|
||||
export function compileFile(path: string, options?: Options): compileTemplate;
|
||||
|
||||
/**
|
||||
* Compile a Pug template to a string of JavaScript that can be used client side along with the Pug runtime.
|
||||
*/
|
||||
export function compileClient(template: string, options?: Options): string;
|
||||
|
||||
/**
|
||||
* Compile a Pug template to an object of the form:
|
||||
* {
|
||||
* 'body': 'function (locals) {...}',
|
||||
* 'dependencies': ['filename.pug']
|
||||
* }
|
||||
* that can be used client side along with the Pug runtime.
|
||||
* You should only use this method if you need dependencies to implement something like watching for changes to the Pug files.
|
||||
*/
|
||||
export function compileClientWithDependenciesTracked(template: string, options?: Options): {
|
||||
body: string;
|
||||
dependencies: string[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Compile a Pug template file to a string of JavaScript that can be used client side along with the Pug runtime.
|
||||
*/
|
||||
export function compileFileClient(path: string, options?: Options): string;
|
||||
|
||||
/**
|
||||
* Compile a Pug template and render it without locals to html string.
|
||||
*/
|
||||
export function render(template: string): string;
|
||||
/**
|
||||
* Compile a Pug template and render it with locals to html string.
|
||||
* @param {(Options & LocalsObject)} options Pug Options and rendering locals
|
||||
*/
|
||||
export function render(template: string, options: Options & LocalsObject): string;
|
||||
/**
|
||||
* Compile a Pug template and render it without locals to html string.
|
||||
* @param {((err: Error | null, html: string) => void)} callback Node.js-style callback receiving the rendered results. This callback is called synchronously.
|
||||
*/
|
||||
export function render(template: string, callback: (err: Error | null, html: string) => void): void;
|
||||
/**
|
||||
* Compile a Pug template and render it with locals to html string.
|
||||
* @param {(Options & LocalsObject)} options Pug Options and rendering locals
|
||||
* @param {((err: Error | null, html: string) => void)} callback Node.js-style callback receiving the rendered results. This callback is called synchronously.
|
||||
*/
|
||||
export function render(template: string, options: Options & LocalsObject, callback: (err: Error | null, html: string) => void): void;
|
||||
|
||||
/**
|
||||
* Compile a Pug template from a file and render it without locals to html string.
|
||||
*/
|
||||
export function renderFile(path: string): string;
|
||||
/**
|
||||
* Compile a Pug template from a file and render it with locals to html string.
|
||||
* @param {(Options & LocalsObject)} options Pug Options and rendering locals
|
||||
*/
|
||||
export function renderFile(path: string, options: Options & LocalsObject): string;
|
||||
/**
|
||||
* Compile a Pug template from a file and render it without locals to html string.
|
||||
* @param {((err: Error | null, html: string) => void)} callback Node.js-style callback receiving the rendered results. This callback is called synchronously.
|
||||
*/
|
||||
export function renderFile(path: string, callback: (err: Error | null, html: string) => void): void;
|
||||
/**
|
||||
* Compile a Pug template from a file and render it with locals to html string.
|
||||
* @param {(Options & LocalsObject)} options Pug Options and rendering locals
|
||||
* @param {((err: Error | null, html: string) => void)} callback Node.js-style callback receiving the rendered results. This callback is called synchronously.
|
||||
*/
|
||||
export function renderFile(path: string, options: Options & LocalsObject, callback: (err: Error | null, html: string) => void): void;
|
||||
|
||||
///////////////////
|
||||
/// Types ///
|
||||
///////////////////
|
||||
|
||||
/**
|
||||
* A function that can be use to render html string of compiled template.
|
||||
*/
|
||||
export type compileTemplate = (locals?: LocalsObject) => string;
|
||||
|
||||
/**
|
||||
* An object that can have multiple properties of any type.
|
||||
*/
|
||||
export interface LocalsObject {
|
||||
[propName: string]: any;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"combineLatest.js","sourceRoot":"","sources":["../../../../src/internal/observable/combineLatest.ts"],"names":[],"mappings":";;;AAAA,4CAA2C;AAE3C,qEAAoE;AAEpE,+BAA8B;AAC9B,6CAA4C;AAE5C,6DAA4D;AAC5D,qCAA+D;AAC/D,qDAAoD;AACpD,sEAA2E;AAE3E,2DAA0D;AA4L1D,SAAgB,aAAa;IAAoC,cAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,yBAAc;;IAC7E,IAAM,SAAS,GAAG,mBAAY,CAAC,IAAI,CAAC,CAAC;IACrC,IAAM,cAAc,GAAG,wBAAiB,CAAC,IAAI,CAAC,CAAC;IAEzC,IAAA,KAA8B,2CAAoB,CAAC,IAAI,CAAC,EAAhD,WAAW,UAAA,EAAE,IAAI,UAA+B,CAAC;IAE/D,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAI5B,OAAO,WAAI,CAAC,EAAE,EAAE,SAAgB,CAAC,CAAC;KACnC;IAED,IAAM,MAAM,GAAG,IAAI,uBAAU,CAC3B,iBAAiB,CACf,WAAoD,EACpD,SAAS,EACT,IAAI;QACF,CAAC;YACC,UAAC,MAAM,IAAK,OAAA,2BAAY,CAAC,IAAI,EAAE,MAAM,CAAC,EAA1B,CAA0B;QACxC,CAAC;YACC,mBAAQ,CACb,CACF,CAAC;IAEF,OAAO,cAAc,CAAC,CAAC,CAAE,MAAM,CAAC,IAAI,CAAC,mCAAgB,CAAC,cAAc,CAAC,CAAmB,CAAC,CAAC,CAAC,MAAM,CAAC;AACpG,CAAC;AA1BD,sCA0BC;AAED,SAAgB,iBAAiB,CAC/B,WAAmC,EACnC,SAAyB,EACzB,cAAiD;IAAjD,+BAAA,EAAA,iBAAyC,mBAAQ;IAEjD,OAAO,UAAC,UAA2B;QAGjC,aAAa,CACX,SAAS,EACT;YACU,IAAA,MAAM,GAAK,WAAW,OAAhB,CAAiB;YAE/B,IAAM,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;YAGjC,IAAI,MAAM,GAAG,MAAM,CAAC;YAIpB,IAAI,oBAAoB,GAAG,MAAM,CAAC;oCAGzB,CAAC;gBACR,aAAa,CACX,SAAS,EACT;oBACE,IAAM,MAAM,GAAG,WAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,SAAgB,CAAC,CAAC;oBACtD,IAAI,aAAa,GAAG,KAAK,CAAC;oBAC1B,MAAM,CAAC,SAAS,CACd,6CAAwB,CACtB,UAAU,EACV,UAAC,KAAK;wBAEJ,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;wBAClB,IAAI,CAAC,aAAa,EAAE;4BAElB,aAAa,GAAG,IAAI,CAAC;4BACrB,oBAAoB,EAAE,CAAC;yBACxB;wBACD,IAAI,CAAC,oBAAoB,EAAE;4BAGzB,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;yBACjD;oBACH,CAAC,EACD;wBACE,IAAI,CAAC,EAAE,MAAM,EAAE;4BAGb,UAAU,CAAC,QAAQ,EAAE,CAAC;yBACvB;oBACH,CAAC,CACF,CACF,CAAC;gBACJ,CAAC,EACD,UAAU,CACX,CAAC;;YAlCJ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE;wBAAtB,CAAC;aAmCT;QACH,CAAC,EACD,UAAU,CACX,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AA/DD,8CA+DC;AAMD,SAAS,aAAa,CAAC,SAAoC,EAAE,OAAmB,EAAE,YAA0B;IAC1G,IAAI,SAAS,EAAE;QACb,iCAAe,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;KACnD;SAAM;QACL,OAAO,EAAE,CAAC;KACX;AACH,CAAC"}
|
||||
@@ -0,0 +1,16 @@
|
||||
const util = require('./dist/util')
|
||||
|
||||
exports.findPair = util.findPair
|
||||
exports.toJSON = util.toJSON
|
||||
exports.parseMap = util.parseMap
|
||||
exports.parseSeq = util.parseSeq
|
||||
|
||||
exports.stringifyNumber = util.stringifyNumber
|
||||
exports.stringifyString = util.stringifyString
|
||||
exports.Type = util.Type
|
||||
|
||||
exports.YAMLError = util.YAMLError
|
||||
exports.YAMLReferenceError = util.YAMLReferenceError
|
||||
exports.YAMLSemanticError = util.YAMLSemanticError
|
||||
exports.YAMLSyntaxError = util.YAMLSyntaxError
|
||||
exports.YAMLWarning = util.YAMLWarning
|
||||
@@ -0,0 +1,19 @@
|
||||
import { noop } from './utils';
|
||||
import { T$$ } from './types';
|
||||
export declare function bind(component: any, name: any, callback: any): void;
|
||||
export declare function create_component(block: any): void;
|
||||
export declare function claim_component(block: any, parent_nodes: any): void;
|
||||
export declare function mount_component(component: any, target: any, anchor: any, customElement: any): void;
|
||||
export declare function destroy_component(component: any, detaching: any): void;
|
||||
export declare function init(component: any, options: any, instance: any, create_fragment: any, not_equal: any, props: any, append_styles: any, dirty?: number[]): void;
|
||||
export declare let SvelteElement: any;
|
||||
/**
|
||||
* Base class for Svelte components. Used when dev=false.
|
||||
*/
|
||||
export declare class SvelteComponent {
|
||||
$$: T$$;
|
||||
$$set?: ($$props: any) => void;
|
||||
$destroy(): void;
|
||||
$on(type: any, callback: any): typeof noop;
|
||||
$set($$props: any): void;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
declare module '*.svelte' {
|
||||
export { SvelteComponentDev as default } from 'svelte/internal';
|
||||
}
|
||||
@@ -0,0 +1,396 @@
|
||||
'use strict'
|
||||
|
||||
const { Buffer } = require('buffer')
|
||||
const symbol = Symbol.for('BufferList')
|
||||
|
||||
function BufferList (buf) {
|
||||
if (!(this instanceof BufferList)) {
|
||||
return new BufferList(buf)
|
||||
}
|
||||
|
||||
BufferList._init.call(this, buf)
|
||||
}
|
||||
|
||||
BufferList._init = function _init (buf) {
|
||||
Object.defineProperty(this, symbol, { value: true })
|
||||
|
||||
this._bufs = []
|
||||
this.length = 0
|
||||
|
||||
if (buf) {
|
||||
this.append(buf)
|
||||
}
|
||||
}
|
||||
|
||||
BufferList.prototype._new = function _new (buf) {
|
||||
return new BufferList(buf)
|
||||
}
|
||||
|
||||
BufferList.prototype._offset = function _offset (offset) {
|
||||
if (offset === 0) {
|
||||
return [0, 0]
|
||||
}
|
||||
|
||||
let tot = 0
|
||||
|
||||
for (let i = 0; i < this._bufs.length; i++) {
|
||||
const _t = tot + this._bufs[i].length
|
||||
if (offset < _t || i === this._bufs.length - 1) {
|
||||
return [i, offset - tot]
|
||||
}
|
||||
tot = _t
|
||||
}
|
||||
}
|
||||
|
||||
BufferList.prototype._reverseOffset = function (blOffset) {
|
||||
const bufferId = blOffset[0]
|
||||
let offset = blOffset[1]
|
||||
|
||||
for (let i = 0; i < bufferId; i++) {
|
||||
offset += this._bufs[i].length
|
||||
}
|
||||
|
||||
return offset
|
||||
}
|
||||
|
||||
BufferList.prototype.get = function get (index) {
|
||||
if (index > this.length || index < 0) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const offset = this._offset(index)
|
||||
|
||||
return this._bufs[offset[0]][offset[1]]
|
||||
}
|
||||
|
||||
BufferList.prototype.slice = function slice (start, end) {
|
||||
if (typeof start === 'number' && start < 0) {
|
||||
start += this.length
|
||||
}
|
||||
|
||||
if (typeof end === 'number' && end < 0) {
|
||||
end += this.length
|
||||
}
|
||||
|
||||
return this.copy(null, 0, start, end)
|
||||
}
|
||||
|
||||
BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) {
|
||||
if (typeof srcStart !== 'number' || srcStart < 0) {
|
||||
srcStart = 0
|
||||
}
|
||||
|
||||
if (typeof srcEnd !== 'number' || srcEnd > this.length) {
|
||||
srcEnd = this.length
|
||||
}
|
||||
|
||||
if (srcStart >= this.length) {
|
||||
return dst || Buffer.alloc(0)
|
||||
}
|
||||
|
||||
if (srcEnd <= 0) {
|
||||
return dst || Buffer.alloc(0)
|
||||
}
|
||||
|
||||
const copy = !!dst
|
||||
const off = this._offset(srcStart)
|
||||
const len = srcEnd - srcStart
|
||||
let bytes = len
|
||||
let bufoff = (copy && dstStart) || 0
|
||||
let start = off[1]
|
||||
|
||||
// copy/slice everything
|
||||
if (srcStart === 0 && srcEnd === this.length) {
|
||||
if (!copy) {
|
||||
// slice, but full concat if multiple buffers
|
||||
return this._bufs.length === 1
|
||||
? this._bufs[0]
|
||||
: Buffer.concat(this._bufs, this.length)
|
||||
}
|
||||
|
||||
// copy, need to copy individual buffers
|
||||
for (let i = 0; i < this._bufs.length; i++) {
|
||||
this._bufs[i].copy(dst, bufoff)
|
||||
bufoff += this._bufs[i].length
|
||||
}
|
||||
|
||||
return dst
|
||||
}
|
||||
|
||||
// easy, cheap case where it's a subset of one of the buffers
|
||||
if (bytes <= this._bufs[off[0]].length - start) {
|
||||
return copy
|
||||
? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes)
|
||||
: this._bufs[off[0]].slice(start, start + bytes)
|
||||
}
|
||||
|
||||
if (!copy) {
|
||||
// a slice, we need something to copy in to
|
||||
dst = Buffer.allocUnsafe(len)
|
||||
}
|
||||
|
||||
for (let i = off[0]; i < this._bufs.length; i++) {
|
||||
const l = this._bufs[i].length - start
|
||||
|
||||
if (bytes > l) {
|
||||
this._bufs[i].copy(dst, bufoff, start)
|
||||
bufoff += l
|
||||
} else {
|
||||
this._bufs[i].copy(dst, bufoff, start, start + bytes)
|
||||
bufoff += l
|
||||
break
|
||||
}
|
||||
|
||||
bytes -= l
|
||||
|
||||
if (start) {
|
||||
start = 0
|
||||
}
|
||||
}
|
||||
|
||||
// safeguard so that we don't return uninitialized memory
|
||||
if (dst.length > bufoff) return dst.slice(0, bufoff)
|
||||
|
||||
return dst
|
||||
}
|
||||
|
||||
BufferList.prototype.shallowSlice = function shallowSlice (start, end) {
|
||||
start = start || 0
|
||||
end = typeof end !== 'number' ? this.length : end
|
||||
|
||||
if (start < 0) {
|
||||
start += this.length
|
||||
}
|
||||
|
||||
if (end < 0) {
|
||||
end += this.length
|
||||
}
|
||||
|
||||
if (start === end) {
|
||||
return this._new()
|
||||
}
|
||||
|
||||
const startOffset = this._offset(start)
|
||||
const endOffset = this._offset(end)
|
||||
const buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1)
|
||||
|
||||
if (endOffset[1] === 0) {
|
||||
buffers.pop()
|
||||
} else {
|
||||
buffers[buffers.length - 1] = buffers[buffers.length - 1].slice(0, endOffset[1])
|
||||
}
|
||||
|
||||
if (startOffset[1] !== 0) {
|
||||
buffers[0] = buffers[0].slice(startOffset[1])
|
||||
}
|
||||
|
||||
return this._new(buffers)
|
||||
}
|
||||
|
||||
BufferList.prototype.toString = function toString (encoding, start, end) {
|
||||
return this.slice(start, end).toString(encoding)
|
||||
}
|
||||
|
||||
BufferList.prototype.consume = function consume (bytes) {
|
||||
// first, normalize the argument, in accordance with how Buffer does it
|
||||
bytes = Math.trunc(bytes)
|
||||
// do nothing if not a positive number
|
||||
if (Number.isNaN(bytes) || bytes <= 0) return this
|
||||
|
||||
while (this._bufs.length) {
|
||||
if (bytes >= this._bufs[0].length) {
|
||||
bytes -= this._bufs[0].length
|
||||
this.length -= this._bufs[0].length
|
||||
this._bufs.shift()
|
||||
} else {
|
||||
this._bufs[0] = this._bufs[0].slice(bytes)
|
||||
this.length -= bytes
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
BufferList.prototype.duplicate = function duplicate () {
|
||||
const copy = this._new()
|
||||
|
||||
for (let i = 0; i < this._bufs.length; i++) {
|
||||
copy.append(this._bufs[i])
|
||||
}
|
||||
|
||||
return copy
|
||||
}
|
||||
|
||||
BufferList.prototype.append = function append (buf) {
|
||||
if (buf == null) {
|
||||
return this
|
||||
}
|
||||
|
||||
if (buf.buffer) {
|
||||
// append a view of the underlying ArrayBuffer
|
||||
this._appendBuffer(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength))
|
||||
} else if (Array.isArray(buf)) {
|
||||
for (let i = 0; i < buf.length; i++) {
|
||||
this.append(buf[i])
|
||||
}
|
||||
} else if (this._isBufferList(buf)) {
|
||||
// unwrap argument into individual BufferLists
|
||||
for (let i = 0; i < buf._bufs.length; i++) {
|
||||
this.append(buf._bufs[i])
|
||||
}
|
||||
} else {
|
||||
// coerce number arguments to strings, since Buffer(number) does
|
||||
// uninitialized memory allocation
|
||||
if (typeof buf === 'number') {
|
||||
buf = buf.toString()
|
||||
}
|
||||
|
||||
this._appendBuffer(Buffer.from(buf))
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
BufferList.prototype._appendBuffer = function appendBuffer (buf) {
|
||||
this._bufs.push(buf)
|
||||
this.length += buf.length
|
||||
}
|
||||
|
||||
BufferList.prototype.indexOf = function (search, offset, encoding) {
|
||||
if (encoding === undefined && typeof offset === 'string') {
|
||||
encoding = offset
|
||||
offset = undefined
|
||||
}
|
||||
|
||||
if (typeof search === 'function' || Array.isArray(search)) {
|
||||
throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.')
|
||||
} else if (typeof search === 'number') {
|
||||
search = Buffer.from([search])
|
||||
} else if (typeof search === 'string') {
|
||||
search = Buffer.from(search, encoding)
|
||||
} else if (this._isBufferList(search)) {
|
||||
search = search.slice()
|
||||
} else if (Array.isArray(search.buffer)) {
|
||||
search = Buffer.from(search.buffer, search.byteOffset, search.byteLength)
|
||||
} else if (!Buffer.isBuffer(search)) {
|
||||
search = Buffer.from(search)
|
||||
}
|
||||
|
||||
offset = Number(offset || 0)
|
||||
|
||||
if (isNaN(offset)) {
|
||||
offset = 0
|
||||
}
|
||||
|
||||
if (offset < 0) {
|
||||
offset = this.length + offset
|
||||
}
|
||||
|
||||
if (offset < 0) {
|
||||
offset = 0
|
||||
}
|
||||
|
||||
if (search.length === 0) {
|
||||
return offset > this.length ? this.length : offset
|
||||
}
|
||||
|
||||
const blOffset = this._offset(offset)
|
||||
let blIndex = blOffset[0] // index of which internal buffer we're working on
|
||||
let buffOffset = blOffset[1] // offset of the internal buffer we're working on
|
||||
|
||||
// scan over each buffer
|
||||
for (; blIndex < this._bufs.length; blIndex++) {
|
||||
const buff = this._bufs[blIndex]
|
||||
|
||||
while (buffOffset < buff.length) {
|
||||
const availableWindow = buff.length - buffOffset
|
||||
|
||||
if (availableWindow >= search.length) {
|
||||
const nativeSearchResult = buff.indexOf(search, buffOffset)
|
||||
|
||||
if (nativeSearchResult !== -1) {
|
||||
return this._reverseOffset([blIndex, nativeSearchResult])
|
||||
}
|
||||
|
||||
buffOffset = buff.length - search.length + 1 // end of native search window
|
||||
} else {
|
||||
const revOffset = this._reverseOffset([blIndex, buffOffset])
|
||||
|
||||
if (this._match(revOffset, search)) {
|
||||
return revOffset
|
||||
}
|
||||
|
||||
buffOffset++
|
||||
}
|
||||
}
|
||||
|
||||
buffOffset = 0
|
||||
}
|
||||
|
||||
return -1
|
||||
}
|
||||
|
||||
BufferList.prototype._match = function (offset, search) {
|
||||
if (this.length - offset < search.length) {
|
||||
return false
|
||||
}
|
||||
|
||||
for (let searchOffset = 0; searchOffset < search.length; searchOffset++) {
|
||||
if (this.get(offset + searchOffset) !== search[searchOffset]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
;(function () {
|
||||
const methods = {
|
||||
readDoubleBE: 8,
|
||||
readDoubleLE: 8,
|
||||
readFloatBE: 4,
|
||||
readFloatLE: 4,
|
||||
readInt32BE: 4,
|
||||
readInt32LE: 4,
|
||||
readUInt32BE: 4,
|
||||
readUInt32LE: 4,
|
||||
readInt16BE: 2,
|
||||
readInt16LE: 2,
|
||||
readUInt16BE: 2,
|
||||
readUInt16LE: 2,
|
||||
readInt8: 1,
|
||||
readUInt8: 1,
|
||||
readIntBE: null,
|
||||
readIntLE: null,
|
||||
readUIntBE: null,
|
||||
readUIntLE: null
|
||||
}
|
||||
|
||||
for (const m in methods) {
|
||||
(function (m) {
|
||||
if (methods[m] === null) {
|
||||
BufferList.prototype[m] = function (offset, byteLength) {
|
||||
return this.slice(offset, offset + byteLength)[m](0, byteLength)
|
||||
}
|
||||
} else {
|
||||
BufferList.prototype[m] = function (offset = 0) {
|
||||
return this.slice(offset, offset + methods[m])[m](0)
|
||||
}
|
||||
}
|
||||
}(m))
|
||||
}
|
||||
}())
|
||||
|
||||
// Used internally by the class and also as an indicator of this object being
|
||||
// a `BufferList`. It's not possible to use `instanceof BufferList` in a browser
|
||||
// environment because there could be multiple different copies of the
|
||||
// BufferList class and some `BufferList`s might be `BufferList`s.
|
||||
BufferList.prototype._isBufferList = function _isBufferList (b) {
|
||||
return b instanceof BufferList || BufferList.isBufferList(b)
|
||||
}
|
||||
|
||||
BufferList.isBufferList = function isBufferList (b) {
|
||||
return b != null && b[symbol]
|
||||
}
|
||||
|
||||
module.exports = BufferList
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0.00408,"53":0,"54":0,"55":0,"56":0,"57":0.00408,"58":0,"59":0,"60":0.00408,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.01223,"79":0,"80":0,"81":0.00408,"82":0,"83":0,"84":0,"85":0.00408,"86":0.00815,"87":0,"88":0,"89":0,"90":0,"91":0.00408,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0.00408,"99":0.00408,"100":0.00408,"101":0,"102":0.12639,"103":0.00408,"104":0.00408,"105":0,"106":0.00815,"107":0.00815,"108":0.04077,"109":1.04371,"110":0.81132,"111":0.00408,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.07746,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0.00408,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0.00408,"70":0.00408,"71":0.00408,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00408,"79":0.00408,"80":0,"81":0.00408,"83":0.00815,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0.00815,"90":0,"91":0,"92":0.17123,"93":0,"94":0.01223,"95":0,"96":0.00408,"97":0.00408,"98":0.00408,"99":0.02854,"100":0.01223,"101":0,"102":0.01631,"103":0.02039,"104":0.03669,"105":0.00815,"106":0.01631,"107":0.01223,"108":0.17123,"109":4.74971,"110":3.5633,"111":0,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0.01223,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0.00408,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0.00815,"90":0,"91":0,"92":0,"93":0.04077,"94":0.13046,"95":0.17123,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0.00815,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0.00408,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00408,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0.00408,"99":0.00815,"100":0.00408,"101":0.01223,"102":0.02039,"103":0.00408,"104":0.00408,"105":0.00408,"106":0,"107":0.06523,"108":0.06116,"109":1.05187,"110":1.55741},E:{"4":0,"5":0.00408,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.01223,"14":0.02854,"15":0.00408,_:"0","3.1":0,"3.2":0,"5.1":0.00408,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.00408,"13.1":0.06116,"14.1":0.13862,"15.1":0.00815,"15.2-15.3":0.02039,"15.4":0.01223,"15.5":0.17939,"15.6":0.23239,"16.0":0.03669,"16.1":0.1427,"16.2":0.39955,"16.3":0.2487,"16.4":0},G:{"8":0.00619,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.19801,"10.0-10.2":0,"10.3":0.00619,"11.0-11.2":0,"11.3-11.4":0.00413,"12.0-12.1":0.02475,"12.2-12.5":0.20832,"13.0-13.1":0.00413,"13.2":0,"13.3":0.01031,"13.4-13.7":0.04331,"14.0-14.4":0.23101,"14.5-14.8":0.41252,"15.0-15.1":0.18357,"15.2-15.3":0.24339,"15.4":0.39809,"15.5":0.51359,"15.6":1.84604,"16.0":4.29437,"16.1":3.49614,"16.2":4.18918,"16.3":3.11249,"16.4":0.04538},P:{"4":0.07165,"20":1.25891,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.11259,"8.2":0,"9.2":0.05118,"10.1":0,"11.1-11.2":0.08188,"12.0":0.01024,"13.0":0.08188,"14.0":0.09212,"15.0":0.01024,"16.0":0.21494,"17.0":0.03071,"18.0":0.3787,"19.0":2.60994},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.01545,"4.4":0,"4.4.3-4.4.4":0.11201},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.00408,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.02369},H:{"0":0.31963},L:{"0":56.5524},R:{_:"0"},M:{"0":0.2843},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, isRegExp = require("../../reg-exp/is");
|
||||
|
||||
describe("reg-exp/is", function () {
|
||||
it("Should return true on regular expression", function () {
|
||||
assert.equal(isRegExp(/foo/), true);
|
||||
});
|
||||
|
||||
it("Should return false on native regular expression with no common API exposed", function () {
|
||||
var re = /foo/;
|
||||
re.test = null;
|
||||
assert.equal(isRegExp(re), false);
|
||||
});
|
||||
it("Should return false on RegExp.prototype", function () {
|
||||
assert.equal(isRegExp(RegExp.prototype), false);
|
||||
});
|
||||
it("Should return false on regexp like string", function () {
|
||||
assert.equal(isRegExp("/foo/"), false);
|
||||
});
|
||||
|
||||
it("Should return false on plain object", function () { assert.equal(isRegExp({}), false); });
|
||||
it("Should return false on function", function () {
|
||||
assert.equal(isRegExp(function () { return true; }), false);
|
||||
});
|
||||
|
||||
it("Should return false on array", function () { assert.equal(isRegExp([]), false); });
|
||||
if (typeof Object.create === "function") {
|
||||
it("Should return false on object with no prototype", function () {
|
||||
assert.equal(isRegExp(Object.create(null)), false);
|
||||
});
|
||||
}
|
||||
it("Should return false on string", function () { assert.equal(isRegExp("foo"), false); });
|
||||
it("Should return false on empty string", function () { assert.equal(isRegExp(""), false); });
|
||||
it("Should return false on number", function () { assert.equal(isRegExp(123), false); });
|
||||
it("Should return false on NaN", function () { assert.equal(isRegExp(NaN), false); });
|
||||
it("Should return false on boolean", function () { assert.equal(isRegExp(true), false); });
|
||||
if (typeof Symbol === "function") {
|
||||
it("Should return false on symbol", function () {
|
||||
assert.equal(isRegExp(Symbol("foo")), false);
|
||||
});
|
||||
}
|
||||
|
||||
it("Should return false on null", function () { assert.equal(isRegExp(null), false); });
|
||||
it("Should return false on undefined", function () { assert.equal(isRegExp(void 0), false); });
|
||||
});
|
||||
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const Module = require('module');
|
||||
const fs = require('fs');
|
||||
|
||||
const resolveFrom = (fromDir, moduleId, silent) => {
|
||||
if (typeof fromDir !== 'string') {
|
||||
throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDir}\``);
|
||||
}
|
||||
|
||||
if (typeof moduleId !== 'string') {
|
||||
throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
|
||||
}
|
||||
|
||||
try {
|
||||
fromDir = fs.realpathSync(fromDir);
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
fromDir = path.resolve(fromDir);
|
||||
} else if (silent) {
|
||||
return null;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
const fromFile = path.join(fromDir, 'noop.js');
|
||||
|
||||
const resolveFileName = () => Module._resolveFilename(moduleId, {
|
||||
id: fromFile,
|
||||
filename: fromFile,
|
||||
paths: Module._nodeModulePaths(fromDir)
|
||||
});
|
||||
|
||||
if (silent) {
|
||||
try {
|
||||
return resolveFileName();
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return resolveFileName();
|
||||
};
|
||||
|
||||
module.exports = (fromDir, moduleId) => resolveFrom(fromDir, moduleId);
|
||||
module.exports.silent = (fromDir, moduleId) => resolveFrom(fromDir, moduleId, true);
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('unionBy', require('../unionBy'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
* The `timer` module exposes a global API for scheduling functions to
|
||||
* be called at some future period of time. Because the timer functions are
|
||||
* globals, there is no need to call `require('timers')` to use the API.
|
||||
*
|
||||
* The timer functions within Node.js implement a similar API as the timers API
|
||||
* provided by Web Browsers but use a different internal implementation that is
|
||||
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
|
||||
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/timers.js)
|
||||
*/
|
||||
declare module 'timers' {
|
||||
import { Abortable } from 'node:events';
|
||||
import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'node:timers/promises';
|
||||
interface TimerOptions extends Abortable {
|
||||
/**
|
||||
* Set to `false` to indicate that the scheduled `Timeout`
|
||||
* should not require the Node.js event loop to remain active.
|
||||
* @default true
|
||||
*/
|
||||
ref?: boolean | undefined;
|
||||
}
|
||||
let setTimeout: typeof global.setTimeout;
|
||||
let clearTimeout: typeof global.clearTimeout;
|
||||
let setInterval: typeof global.setInterval;
|
||||
let clearInterval: typeof global.clearInterval;
|
||||
let setImmediate: typeof global.setImmediate;
|
||||
let clearImmediate: typeof global.clearImmediate;
|
||||
global {
|
||||
namespace NodeJS {
|
||||
// compatibility with older typings
|
||||
interface Timer extends RefCounted {
|
||||
hasRef(): boolean;
|
||||
refresh(): this;
|
||||
[Symbol.toPrimitive](): number;
|
||||
}
|
||||
interface Immediate extends RefCounted {
|
||||
/**
|
||||
* If true, the `Immediate` object will keep the Node.js event loop active.
|
||||
* @since v11.0.0
|
||||
*/
|
||||
hasRef(): boolean;
|
||||
_onImmediate: Function; // to distinguish it from the Timeout class
|
||||
}
|
||||
interface Timeout extends Timer {
|
||||
/**
|
||||
* If true, the `Timeout` object will keep the Node.js event loop active.
|
||||
* @since v11.0.0
|
||||
*/
|
||||
hasRef(): boolean;
|
||||
/**
|
||||
* Sets the timer's start time to the current time, and reschedules the timer to
|
||||
* call its callback at the previously specified duration adjusted to the current
|
||||
* time. This is useful for refreshing a timer without allocating a new
|
||||
* JavaScript object.
|
||||
*
|
||||
* Using this on a timer that has already called its callback will reactivate the
|
||||
* timer.
|
||||
* @since v10.2.0
|
||||
* @return a reference to `timeout`
|
||||
*/
|
||||
refresh(): this;
|
||||
[Symbol.toPrimitive](): number;
|
||||
}
|
||||
}
|
||||
function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
|
||||
// util.promisify no rest args compability
|
||||
// tslint:disable-next-line void-return
|
||||
function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
|
||||
namespace setTimeout {
|
||||
const __promisify__: typeof setTimeoutPromise;
|
||||
}
|
||||
function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
|
||||
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
|
||||
// util.promisify no rest args compability
|
||||
// tslint:disable-next-line void-return
|
||||
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timer;
|
||||
namespace setInterval {
|
||||
const __promisify__: typeof setIntervalPromise;
|
||||
}
|
||||
function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void;
|
||||
function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
|
||||
// util.promisify no rest args compability
|
||||
// tslint:disable-next-line void-return
|
||||
function setImmediate(callback: (args: void) => void): NodeJS.Immediate;
|
||||
namespace setImmediate {
|
||||
const __promisify__: typeof setImmediatePromise;
|
||||
}
|
||||
function clearImmediate(immediateId: NodeJS.Immediate | undefined): void;
|
||||
function queueMicrotask(callback: () => void): void;
|
||||
}
|
||||
}
|
||||
declare module 'node:timers' {
|
||||
export * from 'timers';
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* This function is like
|
||||
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
||||
* except that it includes inherited enumerable properties.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
function nativeKeysIn(object) {
|
||||
var result = [];
|
||||
if (object != null) {
|
||||
for (var key in Object(object)) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = nativeKeysIn;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"Y Z a b c d e i j k l m n o p q r s t u f H","2":"C K L G M N O","194":"P Q R S T U V W X"},C:{"1":"u f H xB yB","2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n EC FC","322":"o p q r s t"},D:{"1":"Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h","194":"lB mB nB oB pB P Q R S T U V W X"},E:{"1":"9B OC","2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B"},F:{"1":"nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB PC QC RC SC qB AC TC rB","194":"aB bB cB dB eB fB gB hB iB jB kB h lB mB"},G:{"1":"9B","2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"2":"H"},N:{"2":"A B"},O:{"2":"vC"},P:{"1":"g 5C sB 6C 7C 8C","2":"I wC xC yC zC 0C 0B 1C 2C 3C 4C"},Q:{"2":"1B"},R:{"1":"9C"},S:{"2":"AD BD"}},B:7,C:"Import maps"};
|
||||
@@ -0,0 +1,102 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/libs/csv2json.js</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../../prettify.css" />
|
||||
<link rel="stylesheet" href="../../base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="../../index.html">All files</a> / <a href="index.html">csv2json/libs</a> csv2json.js
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/3</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
</div>
|
||||
<div class='status-line low'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a></td><td class="line-coverage quiet"><span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span></td><td class="text"><pre class="prettyprint lang-js">Unable to lookup source: /Users/kxiang/work/projects/csv2json/libs/csv2json.js(ENOENT: no such file or directory, open '/Users/kxiang/work/projects/csv2json/libs/csv2json.js')
|
||||
Error: Unable to lookup source: /Users/kxiang/work/projects/csv2json/libs/csv2json.js(ENOENT: no such file or directory, open '/Users/kxiang/work/projects/csv2json/libs/csv2json.js')
|
||||
at Context.defaultSourceLookup [as sourceFinder] (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/context.js:15:15)
|
||||
at Context.getSource (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/context.js:74:17)
|
||||
at Object.annotateSourceCode (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-reports/lib/html/annotator.js:172:38)
|
||||
at HtmlReport.onDetail (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-reports/lib/html/index.js:237:39)
|
||||
at Visitor.(anonymous function) [as onDetail] (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:34:30)
|
||||
at ReportNode.Node.visit (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:123:17)
|
||||
at /Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:116:23
|
||||
at Array.forEach (native)
|
||||
at visitChildren (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:115:32)
|
||||
at ReportNode.Node.visit (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:126:5)</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:36:07 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../../sorter.js"></script>
|
||||
<script src="../../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,92 @@
|
||||
import process from 'node:process';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import fastGlob from 'fast-glob';
|
||||
import gitIgnore from 'ignore';
|
||||
import slash from 'slash';
|
||||
import {toPath, isNegativePattern} from './utilities.js';
|
||||
|
||||
const ignoreFilesGlobOptions = {
|
||||
ignore: [
|
||||
'**/node_modules',
|
||||
'**/flow-typed',
|
||||
'**/coverage',
|
||||
'**/.git',
|
||||
],
|
||||
absolute: true,
|
||||
dot: true,
|
||||
};
|
||||
|
||||
export const GITIGNORE_FILES_PATTERN = '**/.gitignore';
|
||||
|
||||
const applyBaseToPattern = (pattern, base) => isNegativePattern(pattern)
|
||||
? '!' + path.posix.join(base, pattern.slice(1))
|
||||
: path.posix.join(base, pattern);
|
||||
|
||||
const parseIgnoreFile = (file, cwd) => {
|
||||
const base = slash(path.relative(cwd, path.dirname(file.filePath)));
|
||||
|
||||
return file.content
|
||||
.split(/\r?\n/)
|
||||
.filter(line => line && !line.startsWith('#'))
|
||||
.map(pattern => applyBaseToPattern(pattern, base));
|
||||
};
|
||||
|
||||
const toRelativePath = (fileOrDirectory, cwd) => {
|
||||
cwd = slash(cwd);
|
||||
if (path.isAbsolute(fileOrDirectory)) {
|
||||
if (slash(fileOrDirectory).startsWith(cwd)) {
|
||||
return path.relative(cwd, fileOrDirectory);
|
||||
}
|
||||
|
||||
throw new Error(`Path ${fileOrDirectory} is not in cwd ${cwd}`);
|
||||
}
|
||||
|
||||
return fileOrDirectory;
|
||||
};
|
||||
|
||||
const getIsIgnoredPredicate = (files, cwd) => {
|
||||
const patterns = files.flatMap(file => parseIgnoreFile(file, cwd));
|
||||
const ignores = gitIgnore().add(patterns);
|
||||
|
||||
return fileOrDirectory => {
|
||||
fileOrDirectory = toPath(fileOrDirectory);
|
||||
fileOrDirectory = toRelativePath(fileOrDirectory, cwd);
|
||||
return fileOrDirectory ? ignores.ignores(slash(fileOrDirectory)) : false;
|
||||
};
|
||||
};
|
||||
|
||||
const normalizeOptions = (options = {}) => ({
|
||||
cwd: toPath(options.cwd) || process.cwd(),
|
||||
});
|
||||
|
||||
export const isIgnoredByIgnoreFiles = async (patterns, options) => {
|
||||
const {cwd} = normalizeOptions(options);
|
||||
|
||||
const paths = await fastGlob(patterns, {cwd, ...ignoreFilesGlobOptions});
|
||||
|
||||
const files = await Promise.all(
|
||||
paths.map(async filePath => ({
|
||||
filePath,
|
||||
content: await fs.promises.readFile(filePath, 'utf8'),
|
||||
})),
|
||||
);
|
||||
|
||||
return getIsIgnoredPredicate(files, cwd);
|
||||
};
|
||||
|
||||
export const isIgnoredByIgnoreFilesSync = (patterns, options) => {
|
||||
const {cwd} = normalizeOptions(options);
|
||||
|
||||
const paths = fastGlob.sync(patterns, {cwd, ...ignoreFilesGlobOptions});
|
||||
|
||||
const files = paths.map(filePath => ({
|
||||
filePath,
|
||||
content: fs.readFileSync(filePath, 'utf8'),
|
||||
}));
|
||||
|
||||
return getIsIgnoredPredicate(files, cwd);
|
||||
};
|
||||
|
||||
export const isGitIgnored = options => isIgnoredByIgnoreFiles(GITIGNORE_FILES_PATTERN, options);
|
||||
export const isGitIgnoredSync = options => isIgnoredByIgnoreFilesSync(GITIGNORE_FILES_PATTERN, options);
|
||||
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
var resolveException = require("../lib/resolve-exception")
|
||||
, coerce = require("./coerce");
|
||||
|
||||
module.exports = function (value/*, options*/) {
|
||||
var coerced = coerce(value);
|
||||
if (coerced !== null) return coerced;
|
||||
var options = arguments[1];
|
||||
var errorMessage =
|
||||
options && options.name
|
||||
? "Expected a safe integer for %n, received %v"
|
||||
: "%v is not a safe integer";
|
||||
return resolveException(value, errorMessage, options);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Subscription } from '../Subscription';
|
||||
interface AnimationFrameProvider {
|
||||
schedule(callback: FrameRequestCallback): Subscription;
|
||||
requestAnimationFrame: typeof requestAnimationFrame;
|
||||
cancelAnimationFrame: typeof cancelAnimationFrame;
|
||||
delegate: {
|
||||
requestAnimationFrame: typeof requestAnimationFrame;
|
||||
cancelAnimationFrame: typeof cancelAnimationFrame;
|
||||
} | undefined;
|
||||
}
|
||||
export declare const animationFrameProvider: AnimationFrameProvider;
|
||||
export {};
|
||||
//# sourceMappingURL=animationFrameProvider.d.ts.map
|
||||
@@ -0,0 +1,14 @@
|
||||
Copyright (c) 2015, Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice
|
||||
appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $SyntaxError = GetIntrinsic('%SyntaxError%');
|
||||
var $bigIntValueOf = callBound('BigInt.prototype.valueOf', true);
|
||||
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-thisbigintvalue
|
||||
|
||||
module.exports = function thisBigIntValue(value) {
|
||||
var type = Type(value);
|
||||
if (type === 'BigInt') {
|
||||
return value;
|
||||
}
|
||||
if (!$bigIntValueOf) {
|
||||
throw new $SyntaxError('BigInt is not supported');
|
||||
}
|
||||
return $bigIntValueOf(value);
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
function resolveYamlNull(data) {
|
||||
if (data === null) return true;
|
||||
|
||||
var max = data.length;
|
||||
|
||||
return (max === 1 && data === '~') ||
|
||||
(max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
|
||||
}
|
||||
|
||||
function constructYamlNull() {
|
||||
return null;
|
||||
}
|
||||
|
||||
function isNull(object) {
|
||||
return object === null;
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:null', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlNull,
|
||||
construct: constructYamlNull,
|
||||
predicate: isNull,
|
||||
represent: {
|
||||
canonical: function () { return '~'; },
|
||||
lowercase: function () { return 'null'; },
|
||||
uppercase: function () { return 'NULL'; },
|
||||
camelcase: function () { return 'Null'; },
|
||||
empty: function () { return ''; }
|
||||
},
|
||||
defaultStyle: 'lowercase'
|
||||
});
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "@types/uglify-js",
|
||||
"version": "3.17.1",
|
||||
"description": "TypeScript definitions for UglifyJS",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/uglify-js",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Alan Agius",
|
||||
"url": "https://github.com/alan-agius4",
|
||||
"githubUsername": "alan-agius4"
|
||||
},
|
||||
{
|
||||
"name": "Tanguy Krotoff",
|
||||
"url": "https://github.com/tkrotoff",
|
||||
"githubUsername": "tkrotoff"
|
||||
},
|
||||
{
|
||||
"name": "John Reilly",
|
||||
"url": "https://github.com/johnnyreilly",
|
||||
"githubUsername": "johnnyreilly"
|
||||
},
|
||||
{
|
||||
"name": "Piotr Błażejewicz",
|
||||
"url": "https://github.com/peterblazejewicz",
|
||||
"githubUsername": "peterblazejewicz"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/uglify-js"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"source-map": "^0.6.1"
|
||||
},
|
||||
"typesPublisherContentHash": "f80ad4b80fbc8786d6d2f3158b55355cc42cb65193b944dcdd81654dfe38418a",
|
||||
"typeScriptVersion": "4.1"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"B","2":"J D E F A CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"1":"v J D E F A B C K L G IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I HC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"F B C PC QC RC SC qB AC TC rB"},G:{"1":"E VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","16":"zB UC BC"},H:{"2":"oC"},I:{"1":"tB I f rC sC BC tC uC","16":"pC qC"},J:{"1":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"1":"B","2":"A"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:1,C:"PageTransitionEvent"};
|
||||
Reference in New Issue
Block a user