-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: Add doc for jsmodern, closes #6.
Also, fix other modules to import from original sources.
- Loading branch information
Showing
61 changed files
with
819 additions
and
897 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,2 @@ | ||
export interface DeepCloneOptions { | ||
absolute?: boolean; | ||
} | ||
|
||
import { deepAssign } from "https://cdn.jsdelivr.net/gh/denoland/[email protected]/std/util/deep_assign.ts"; | ||
|
||
export function deepCloneSync<T>(target: T, options?: DeepCloneOptions): T { | ||
if (target == null) throw new TypeError(`'target' is not defined`); | ||
|
||
return options && options.absolute | ||
? deepAssign({}, target as any) | ||
: JSON.parse(JSON.stringify(target)); | ||
} | ||
|
||
export async function deepClone<T>(target: T, options?: DeepCloneOptions) { | ||
return deepCloneSync<T>(target, options); | ||
} | ||
|
||
export default deepClone; | ||
// @deno-types="https://cdn.jsdelivr.net/npm/[email protected]/dist/deep-clone/index.d.ts" | ||
export * from "https://cdn.jsdelivr.net/npm/[email protected]/dist/deep-clone/index.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ import { delayUntil } from "https://denopkg.com/motss/[email protected]/delay_unti | |
(async () => { | ||
await delayUntil(3e3); | ||
|
||
console.log('This message prints out after 3 seconds'); | ||
console.log("This message prints out after 3 seconds"); | ||
})(); | ||
``` | ||
|
||
|
@@ -43,7 +43,7 @@ import { delayUntil } from "https://denopkg.com/motss/[email protected]/delay_unti | |
|
||
<!-- References --> | ||
|
||
[setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout | ||
[settimeout]: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout | ||
[async...await]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await | ||
|
||
<!-- MDN --> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from 'https://cdn.jsdelivr.net/gh/motss/[email protected]/src/delay-until/index.ts'; | ||
export * from "https://cdn.jsdelivr.net/gh/motss/[email protected]/src/delay-until/index.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<div align="center" style="text-align: center;"> | ||
<h1 style="border-bottom: none;">jsmodern</h1> | ||
|
||
<p>An extension to existing JavaScript, influenced by other great languages such as Rust, Dart, Java, Golang, etc.</p> | ||
</div> | ||
|
||
<hr /> | ||
|
||
[![MIT License][mit-license-badge]][mit-license-url] | ||
|
||
> A collections of extensions for JavaScript that borrow some of the useful features from other programming languages. | ||
## Table of contents <!-- omit in toc --> | ||
|
||
- [Usage](#usage) | ||
- [API Reference](#api-reference) | ||
- [License](#license) | ||
|
||
## Usage | ||
|
||
```ts | ||
// It is recommended to only import those extensions you need instead of everything. | ||
import { extend } from "https://cdn.jsdelivr.net/gh/motss/[email protected]/jsmodern/extend.ts"; | ||
import { sum } from "https://cdn.jsdelivr.net/gh/motss/[email protected]/jsmodern/array.ts"; | ||
|
||
extend({ array: [sum] }); | ||
|
||
const total = [1, 2, 3].sum(); | ||
|
||
console.log(total === 6); // true | ||
``` | ||
|
||
## API Reference | ||
|
||
- [x] [Array extensions] | ||
- [x] [Boolean extensions] | ||
- [x] [Date extensions] | ||
- [x] [Error extensions] | ||
- [x] [Function extensions] | ||
- [x] [Iterator extensions] | ||
- [x] [Map extensions] | ||
- [x] [Number extensions] | ||
- [x] [Object extensions] | ||
- [x] [Promise extensions] | ||
- [x] [RegExp extensions] | ||
- [x] [Set extensions] | ||
- [x] [String extensions] | ||
- [x] [Symbol extensions] | ||
- [x] [WeakMap extensions] | ||
- [x] [WeakSet extensions] | ||
|
||
## License | ||
|
||
[MIT License](http://motss.mit-license.org/) © Rong Sen Ng | ||
|
||
<!-- References --> | ||
|
||
[array extensions]: https://github.com/motss/jsmodern/tree/master/src/array | ||
[boolean extensions]: https://github.com/motss/jsmodern/tree/master/src/boolean | ||
[date extensions]: https://github.com/motss/jsmodern/tree/master/src/date | ||
[error extensions]: https://github.com/motss/jsmodern/tree/master/src/error | ||
[function extensions]: https://github.com/motss/jsmodern/tree/master/src/function | ||
[iterator extensions]: https://github.com/motss/jsmodern/tree/master/src/iterator | ||
[map extensions]: https://github.com/motss/jsmodern/tree/master/src/map | ||
[number extensions]: https://github.com/motss/jsmodern/tree/master/src/number | ||
[object extensions]: https://github.com/motss/jsmodern/tree/master/src/object | ||
[promise extensions]: https://github.com/motss/jsmodern/tree/master/src/promise | ||
[regexp extensions]: https://github.com/motss/jsmodern/tree/master/src/regexp | ||
[set extensions]: https://github.com/motss/jsmodern/tree/master/src/set | ||
[string extensions]: https://github.com/motss/jsmodern/tree/master/src/string | ||
[symbol extensions]: https://github.com/motss/jsmodern/tree/master/src/symbol | ||
[weakmap extensions]: https://github.com/motss/jsmodern/tree/master/src/weak-map | ||
[weakset extensions]: https://github.com/motss/jsmodern/tree/master/src/weak-set | ||
|
||
<!-- MDN --> | ||
|
||
[map-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map | ||
[string-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String | ||
[object-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object | ||
[number-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number | ||
[boolean-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean | ||
[html-style-element-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLStyleElement | ||
[promise-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise | ||
|
||
<!-- Badges --> | ||
|
||
[mit-license-badge]: https://flat.badgen.net/badge/license/MIT/blue | ||
|
||
<!-- Links --> | ||
|
||
[mit-license-url]: https://github.com/motss/deno_mod/blob/master/LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.