decocms 2.283.0 → 2.283.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-CbtT--Ol.js → AlertCircle-B6lKc5r3.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-DWZkNaNO.js → ArrowNarrowLeft-DKpjDF0O.js} +1 -1
- package/dist/client/assets/{CheckCircle-3hn9ZLNf.js → CheckCircle-Cu9gxMoh.js} +1 -1
- package/dist/client/assets/{ChevronDown-DdYtF_pN.js → ChevronDown-CGYRNnVK.js} +1 -1
- package/dist/client/assets/{ChevronRight-e4qgFMIt.js → ChevronRight-Cs_mq2Gb.js} +1 -1
- package/dist/client/assets/{ChevronUp-CGzEbpO7.js → ChevronUp-CNHg8Tvy.js} +1 -1
- package/dist/client/assets/{Container-gkiuXluH.js → Container-CTt4BzRP.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BunxZmQL.js → LinkExternal01-B8RP9b4T.js} +1 -1
- package/dist/client/assets/{Lock01-DvsN0mFQ.js → Lock01-DGN1sRwj.js} +1 -1
- package/dist/client/assets/{Palette-ahL5lOBN.js → Palette-BLl9a_yE.js} +1 -1
- package/dist/client/assets/{Play-Dz2HPAmd.js → Play-YaIPTi2N.js} +1 -1
- package/dist/client/assets/{Plus-Dn-1QbCZ.js → Plus-CI2hG7eT.js} +1 -1
- package/dist/client/assets/{SearchMd-b9tCf66d.js → SearchMd-CJUx5L0X.js} +1 -1
- package/dist/client/assets/{Settings02-Dk076iZH.js → Settings02-CzftfR-P.js} +1 -1
- package/dist/client/assets/{Star01-LL8IcJik.js → Star01-CvBfAtRc.js} +1 -1
- package/dist/client/assets/{Sun-CEKlSeb7.js → Sun-DDl1TbCr.js} +1 -1
- package/dist/client/assets/{Tool01-C58Xtung.js → Tool01-C4G0_dmI.js} +1 -1
- package/dist/client/assets/{Trash01-BvF1rPkz.js → Trash01-DoGU3WEE.js} +1 -1
- package/dist/client/assets/{User01-Cjs4dHzU.js → User01-Cs--OmtK.js} +1 -1
- package/dist/client/assets/{Users03-S9PW2exM.js → Users03-CEDkUueK.js} +1 -1
- package/dist/client/assets/{X-woFr0RM9.js → X-DU4RFoiA.js} +1 -1
- package/dist/client/assets/{XCircle-DcrVc7Ai.js → XCircle-DIbQNdIy.js} +1 -1
- package/dist/client/assets/{Zap-C_TCIuRq.js → Zap-D6T_WrPQ.js} +1 -1
- package/dist/client/assets/{ZapSquare-Cwy3VSGD.js → ZapSquare-Btv7LDve.js} +1 -1
- package/dist/client/assets/{accordion-D_jejMYM.js → accordion-BSHhIZXM.js} +1 -1
- package/dist/client/assets/{agent-icon-YPHh6Pzl.js → agent-icon-Dmd713yi.js} +1 -1
- package/dist/client/assets/{agents-list-DAbe9iK7.js → agents-list-CJAIn9Nw.js} +1 -1
- package/dist/client/assets/ai-providers-D9dwDsov.js +1 -0
- package/dist/client/assets/{alert-dialog-DYUDJvNb.js → alert-dialog-BHsh1K_4.js} +1 -1
- package/dist/client/assets/{auth-catchall-Ch73rCgm.js → auth-catchall-BrZqr7p6.js} +1 -1
- package/dist/client/assets/{automation-list-row-D9xPB2e4.js → automation-list-row-BYsd5_5F.js} +1 -1
- package/dist/client/assets/{automations-DHroobs4.js → automations-CwTGObR_.js} +1 -1
- package/dist/client/assets/{avatar-CHIsPVvw.js → avatar-CiIOC0jm.js} +1 -1
- package/dist/client/assets/{badge-CdwEUsBG.js → badge-4dptbCEq.js} +1 -1
- package/dist/client/assets/{brand-context-9Duu_Raa.js → brand-context-CDJdQAKY.js} +1 -1
- package/dist/client/assets/{card-DtNfmWHu.js → card-EK1eVPf2.js} +1 -1
- package/dist/client/assets/{chat-context-CHNOhZ3c.js → chat-context-BNH6TZ71.js} +1 -1
- package/dist/client/assets/{checkbox-1xh00yHd.js → checkbox-CnUU9-I8.js} +1 -1
- package/dist/client/assets/{collection-detail-W5PzkADS.js → collection-detail-OPcrdjzj.js} +1 -1
- package/dist/client/assets/{collection-display-button-B2KAB3RO.js → collection-display-button-CVMEpIRp.js} +1 -1
- package/dist/client/assets/{collection-search-C8tjeasf.js → collection-search-CAiOUXIV.js} +1 -1
- package/dist/client/assets/{collection-search-DL5AAqlC.js → collection-search-DzQxK0TT.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DZyJw2Qp.js → collection-table-wrapper-Bod3BRUJ.js} +1 -1
- package/dist/client/assets/{collection-tabs-CsNJTDO3.js → collection-tabs-zQGRYBUF.js} +1 -1
- package/dist/client/assets/{collections-BG8r46pt.js → collections-58NR9gW4.js} +1 -1
- package/dist/client/assets/{command-J9TO9TTk.js → command-Cogobv1L.js} +1 -1
- package/dist/client/assets/{connection-card-DrG7D-XR.js → connection-card-DUG1h-_6.js} +1 -1
- package/dist/client/assets/{connection-detail-BkpJ4eRx.js → connection-detail-COc1z0eq.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-Drl7lItU.js → connection-form-helpers-C3tUUR3v.js} +1 -1
- package/dist/client/assets/{connections-BGLK-FC9.js → connections-BInA1c12.js} +1 -1
- package/dist/client/assets/{constants-D7Xua0Kh.js → constants-B9qhU0c2.js} +1 -1
- package/dist/client/assets/{constants-BpATiyrZ.js → constants-BRrjE7JA.js} +1 -1
- package/dist/client/assets/{dialog-CMTU9wUU.js → dialog-DTc6xcOj.js} +1 -1
- package/dist/client/assets/{drawer-BbnvWPmy.js → drawer-D7fRUj36.js} +1 -1
- package/dist/client/assets/{dropdown-menu-CYaNafcW.js → dropdown-menu-DjMLFgss.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-Bf2K7Aya.js → dynamic-plugin-layout-D5Vx8IAg.js} +1 -1
- package/dist/client/assets/{empty-state-CFQu8hzr.js → empty-state-6q5IDcBd.js} +1 -1
- package/dist/client/assets/{empty-state-Bs5qBWrd.js → empty-state-CyDjcoCn.js} +1 -1
- package/dist/client/assets/{extract-connection-data-D6ONGrG_.js → extract-connection-data-BkBgr0-3.js} +1 -1
- package/dist/client/assets/{features-zixnb23X.js → features-BvFC5Pr0.js} +1 -1
- package/dist/client/assets/{form-QHifiEEX.js → form-KFRk7eRQ.js} +1 -1
- package/dist/client/assets/{general-BC7R0pdu.js → general-BjGaj1GT.js} +1 -1
- package/dist/client/assets/{github-repo-picker-DdJW6OKr.js → github-repo-picker-BSkFdyNg.js} +1 -1
- package/dist/client/assets/{index-Drh4iFTY.js → index-3FTFAFVn.js} +1 -1
- package/dist/client/assets/{index-CF3ZRVOE.js → index-4MgAykWa.js} +28 -28
- package/dist/client/assets/{index-BEGJNYDp.js → index-Baef8J5R.js} +1 -1
- package/dist/client/assets/{index-D2y6LxHu.js → index-BdDTS4hF.js} +1 -1
- package/dist/client/assets/{index-HgyXjm68.js → index-C08HiGeB.js} +1 -1
- package/dist/client/assets/{index-D-OXQ0xl.js → index-C4DjgJGL.js} +1 -1
- package/dist/client/assets/{index-QueWlMPI.js → index-CAASFRGs.js} +1 -1
- package/dist/client/assets/{index-HowXhEKl.js → index-CqJy3Jvl.js} +1 -1
- package/dist/client/assets/{index-BAVpG5PI.js → index-D_cV0HX5.js} +2 -2
- package/dist/client/assets/{index-iAPWq91d.js → index-FOE7YpHv.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-BvUWiP9V.js → infiniteQueryObserver-IJcComZ8.js} +1 -1
- package/dist/client/assets/{input-DnP63xwW.js → input-Cv-Gy5WN.js} +1 -1
- package/dist/client/assets/{integration-icon-DkvnCAKV.js → integration-icon-3xGkh2yb.js} +1 -1
- package/dist/client/assets/{label-DKwfAK9s.js → label-CNlIda5F.js} +1 -1
- package/dist/client/assets/{layout-BbutmLxJ.js → layout-DIXmeN4N.js} +1 -1
- package/dist/client/assets/{login-IRTXwxbm.js → login-BS3FoMPH.js} +1 -1
- package/dist/client/assets/{members-DdHTduhn.js → members-CKfYtWTZ.js} +1 -1
- package/dist/client/assets/{monaco-editor-BHTnNyUV.js → monaco-editor-AFl_PrCF.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-D9y7J0sc.js → monitoring-stats-row-D_JrgB_o.js} +1 -1
- package/dist/client/assets/{oauth-callback-BdKre2-T.js → oauth-callback-BVoerf7r.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-ZqXrzLEl.js → oauth-callback-ai-provider-CwTSAG2N.js} +1 -1
- package/dist/client/assets/{onboarding-D0wk0PoN.js → onboarding-LSX1P2kl.js} +1 -1
- package/dist/client/assets/{org-layout-BBeeqTuI.js → org-layout-LjdMsRi5.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-kfthF_vf.js → org-plugin-layout-BjYMF2Hw.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-CpmLl5g8.js → plugin-empty-state-CNV6Fdky.js} +1 -1
- package/dist/client/assets/{plugin-header---ixO8Yh.js → plugin-header-Qlrhguve.js} +1 -1
- package/dist/client/assets/{plugin-layout-CBPBa-Fw.js → plugin-layout-UrD7dGGv.js} +1 -1
- package/dist/client/assets/{popover-CKtIWvNd.js → popover-BYKaDh8r.js} +1 -1
- package/dist/client/assets/{profile-BKvxvV-E.js → profile-BfMcwqnt.js} +1 -1
- package/dist/client/assets/{project-app-view-ChXGXZSO.js → project-app-view-CFEp8V0n.js} +1 -1
- package/dist/client/assets/registry-CDKXBXcC.js +2 -0
- package/dist/client/assets/{registry-layout-DdZKKnQK.js → registry-layout-C8vYG8EY.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CjwkLMq3.js → required-auth-layout-D8VR7Qn-.js} +1 -1
- package/dist/client/assets/{reset-password-B6HQzDoJ.js → reset-password-_PZQBRj3.js} +1 -1
- package/dist/client/assets/{scroll-area-BSbrzuDv.js → scroll-area-BR90DEv6.js} +1 -1
- package/dist/client/assets/{search-input-DP4LjSem.js → search-input-C1FJdqjU.js} +1 -1
- package/dist/client/assets/{select-BNI7svYN.js → select-_midNVXe.js} +1 -1
- package/dist/client/assets/{select-model-B_-FDNHD.js → select-model-GoqBCq85.js} +1 -1
- package/dist/client/assets/{settings-layout-CMvH3biN.js → settings-layout-BCmCJj0X.js} +1 -1
- package/dist/client/assets/{shell-layout-CvVAcjla.js → shell-layout-FgHTT5It.js} +1 -1
- package/dist/client/assets/{skeleton-bPBtKDik.js → skeleton-Chpxgw5z.js} +1 -1
- package/dist/client/assets/{sso-Cu3uVex6.js → sso-CDhG5sm9.js} +1 -1
- package/dist/client/assets/{store-BlqXx4eb.js → store-B5BBgWDK.js} +1 -1
- package/dist/client/assets/store-registry-CbUNnR6f.js +2 -0
- package/dist/client/assets/{switch-CdXdPsLJ.js → switch-Bb611OnM.js} +1 -1
- package/dist/client/assets/{table-BfrU01FR.js → table-DZCl3DV_.js} +1 -1
- package/dist/client/assets/{tabs-BHhac7yq.js → tabs-CPuI5WWZ.js} +1 -1
- package/dist/client/assets/{task-status-DYiADURg.js → task-status-DaR1MpWK.js} +1 -1
- package/dist/client/assets/{textarea-CCJXdksA.js → textarea-GNMR8OqL.js} +1 -1
- package/dist/client/assets/{toggle-group-DLpy9z7t.js → toggle-group-BR1IpJFy.js} +1 -1
- package/dist/client/assets/{tools-list-DQ9cMQXy.js → tools-list-C2ObxyAj.js} +1 -1
- package/dist/client/assets/{types-BZ0c8uzs.js → types-DTGLm43F.js} +1 -1
- package/dist/client/assets/{use-ai-providers-g7t13ieS.js → use-ai-providers-DZ6DqAM3.js} +1 -1
- package/dist/client/assets/{use-collections-DFXTxuSg.js → use-collections-VlX8lbt0.js} +1 -1
- package/dist/client/assets/{use-connection-WpLI1Z7R.js → use-connection-DnhQK4fq.js} +1 -1
- package/dist/client/assets/{use-copy-BCScHFqH.js → use-copy-Dwf-_7tD.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-D2CVz9Z0.js → use-create-virtual-mcp-Q8Pi_HJm.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-FqeyN-Ts.js → use-decopilot-events-CvkLosTt.js} +1 -1
- package/dist/client/assets/{use-delete-connection-B7VNbah4.js → use-delete-connection-DnO01-yU.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CLbN6ppD.js → use-infinite-scroll-BbJ5h1l2.js} +1 -1
- package/dist/client/assets/{use-list-state-CetwMWKu.js → use-list-state-RSIRKfu-.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DXEYm3L2.js → use-mcp-tools-dsvqyXUs.js} +1 -1
- package/dist/client/assets/{use-members-DsQu-Ks-.js → use-members-yA1tHxKc.js} +1 -1
- package/dist/client/assets/{use-mobile-DjZnjqlA.js → use-mobile-BukhR5xc.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-B1eLGU7z.js → use-navigate-to-agent-cye4_ovr.js} +1 -1
- package/dist/client/assets/{use-org-sso-C2qxLZNA.js → use-org-sso-BX-CgWuz.js} +1 -1
- package/dist/client/assets/{use-organization-settings-_mA2wnSC.js → use-organization-settings-AIx1cKKY.js} +1 -1
- package/dist/client/assets/{use-registry-connections-C7mRgRdR.js → use-registry-connections-Ck-c3bU5.js} +1 -1
- package/dist/client/assets/{use-status-sounds-D0-Dwv_-.js → use-status-sounds-DXJvfF2c.js} +1 -1
- package/dist/client/assets/{use-tasks-BMxssOXF.js → use-tasks-B9RSBuk3.js} +1 -1
- package/dist/client/assets/{use-view-mode-WliGdadQ.js → use-view-mode-0huvW_sB.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-OtMHbTvm.js → use-virtual-mcp-CCFi2lST.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-Bs0N88A0.js +1 -0
- package/dist/client/assets/{user-Q3_cYTk2.js → user-R3PETSQv.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-D5xyWdqo.js → view-mode-toggle-T-xER1ZI.js} +1 -1
- package/dist/client/assets/{workflow-BUOyTgce.js → workflow-BblBxdPP.js} +1 -1
- package/dist/client/assets/workflow-detail-CzVmb0o7.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/node_modules/ansi-regex/index.d.ts +33 -0
- package/dist/server/node_modules/ansi-regex/index.js +14 -0
- package/dist/server/node_modules/ansi-regex/package.json +61 -0
- package/dist/server/node_modules/ansi-regex/readme.md +66 -0
- package/dist/server/node_modules/ansi-styles/index.d.ts +236 -0
- package/dist/server/node_modules/ansi-styles/index.js +223 -0
- package/dist/server/node_modules/ansi-styles/license +9 -0
- package/dist/server/node_modules/ansi-styles/package.json +54 -0
- package/dist/server/node_modules/ansi-styles/readme.md +173 -0
- package/dist/server/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/dist/server/node_modules/emoji-regex/README.md +107 -0
- package/dist/server/node_modules/emoji-regex/index.d.ts +3 -0
- package/dist/server/node_modules/emoji-regex/index.js +4 -0
- package/dist/server/node_modules/emoji-regex/index.mjs +4 -0
- package/dist/server/node_modules/emoji-regex/package.json +45 -0
- package/dist/server/node_modules/environment/index.d.ts +74 -0
- package/dist/server/node_modules/environment/index.js +47 -0
- package/dist/server/node_modules/environment/license +9 -0
- package/dist/server/node_modules/environment/package.json +74 -0
- package/dist/server/node_modules/environment/readme.md +94 -0
- package/dist/server/node_modules/escape-string-regexp/index.d.ts +18 -0
- package/dist/server/node_modules/escape-string-regexp/index.js +11 -0
- package/dist/server/node_modules/escape-string-regexp/license +9 -0
- package/dist/server/node_modules/escape-string-regexp/package.json +43 -0
- package/dist/server/node_modules/escape-string-regexp/readme.md +29 -0
- package/dist/server/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
- package/dist/server/node_modules/is-fullwidth-code-point/index.js +12 -0
- package/dist/server/node_modules/is-fullwidth-code-point/license +9 -0
- package/dist/server/node_modules/is-fullwidth-code-point/package.json +53 -0
- package/dist/server/node_modules/is-fullwidth-code-point/readme.md +31 -0
- package/dist/server/node_modules/onetime/index.d.ts +64 -0
- package/dist/server/node_modules/onetime/index.js +44 -0
- package/dist/server/node_modules/onetime/license +9 -0
- package/dist/server/node_modules/onetime/package.json +43 -0
- package/dist/server/node_modules/onetime/readme.md +94 -0
- package/dist/server/node_modules/pg-int8/LICENSE +13 -0
- package/dist/server/node_modules/pg-int8/README.md +16 -0
- package/dist/server/node_modules/pg-int8/index.js +100 -0
- package/dist/server/node_modules/pg-int8/package.json +24 -0
- package/dist/server/node_modules/split2/LICENSE +13 -0
- package/dist/server/node_modules/split2/README.md +85 -0
- package/dist/server/node_modules/split2/bench.js +27 -0
- package/dist/server/node_modules/split2/index.js +141 -0
- package/dist/server/node_modules/split2/package.json +39 -0
- package/dist/server/node_modules/split2/test.js +409 -0
- package/dist/server/node_modules/xtend/.jshintrc +30 -0
- package/dist/server/node_modules/xtend/LICENSE +20 -0
- package/dist/server/node_modules/xtend/README.md +32 -0
- package/dist/server/node_modules/xtend/immutable.js +19 -0
- package/dist/server/node_modules/xtend/mutable.js +17 -0
- package/dist/server/node_modules/xtend/package.json +55 -0
- package/dist/server/node_modules/xtend/test.js +103 -0
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-BfLDbMLW.js +0 -1
- package/dist/client/assets/registry-DzQaV05R.js +0 -2
- package/dist/client/assets/store-registry-Bmruarg3.js +0 -2
- package/dist/client/assets/useInfiniteQuery-C96YfMla.js +0 -1
- package/dist/client/assets/workflow-detail-Cn5C7Hq2.js +0 -1
- package/dist/server/node_modules/get-east-asian-width/index.d.ts +0 -60
- package/dist/server/node_modules/get-east-asian-width/index.js +0 -30
- package/dist/server/node_modules/get-east-asian-width/lookup-data.js +0 -18
- package/dist/server/node_modules/get-east-asian-width/lookup.js +0 -135
- package/dist/server/node_modules/get-east-asian-width/package.json +0 -71
- package/dist/server/node_modules/get-east-asian-width/readme.md +0 -65
- package/dist/server/node_modules/get-east-asian-width/utilities.js +0 -24
- /package/dist/server/node_modules/{get-east-asian-width → ansi-regex}/license +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# environment
|
|
2
|
+
|
|
3
|
+
> Check which JavaScript environment your code is running in at runtime
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install environment
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import {isBrowser, isNode} from 'environment';
|
|
15
|
+
|
|
16
|
+
if (isBrowser) {
|
|
17
|
+
console.log('Running in a browser!');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (isNode) {
|
|
21
|
+
console.log('Running in Node.js!');
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
> [!NOTE]
|
|
26
|
+
> Runtime checks should be used sparingly. Prefer [conditional package exports](https://nodejs.org/api/packages.html#conditional-exports) and [imports](https://nodejs.org/api/packages.html#subpath-imports) whenever possible.
|
|
27
|
+
|
|
28
|
+
## API
|
|
29
|
+
|
|
30
|
+
### `isBrowser`
|
|
31
|
+
|
|
32
|
+
Check if the code is running in a web browser environment.
|
|
33
|
+
|
|
34
|
+
### `isNode`
|
|
35
|
+
|
|
36
|
+
Check if the code is running in a [Node.js](https://nodejs.org) environment.
|
|
37
|
+
|
|
38
|
+
### `isBun`
|
|
39
|
+
|
|
40
|
+
Check if the code is running in a [Bun](https://bun.sh) environment.
|
|
41
|
+
|
|
42
|
+
### `isDeno`
|
|
43
|
+
|
|
44
|
+
Check if the code is running in a [Deno](https://deno.com) environment.
|
|
45
|
+
|
|
46
|
+
### `isElectron`
|
|
47
|
+
|
|
48
|
+
Check if the code is running in an [Electron](https://www.electronjs.org) environment.
|
|
49
|
+
|
|
50
|
+
### `isJsDom`
|
|
51
|
+
|
|
52
|
+
Check if the code is running in a [jsdom](https://github.com/jsdom/jsdom) environment.
|
|
53
|
+
|
|
54
|
+
### `isWebWorker`
|
|
55
|
+
|
|
56
|
+
Check if the code is running in a [Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API#worker_global_contexts_and_functions) environment, which could be either a dedicated worker, shared worker, or service worker.
|
|
57
|
+
|
|
58
|
+
### `isDedicatedWorker`
|
|
59
|
+
|
|
60
|
+
Check if the code is running in a [Dedicated Worker](https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope) environment.
|
|
61
|
+
|
|
62
|
+
### `isSharedWorker`
|
|
63
|
+
|
|
64
|
+
Check if the code is running in a [Shared Worker](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorkerGlobalScope) environment.
|
|
65
|
+
|
|
66
|
+
### `isServiceWorker`
|
|
67
|
+
|
|
68
|
+
Check if the code is running in a [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope) environment.
|
|
69
|
+
|
|
70
|
+
### `isMacOs`
|
|
71
|
+
|
|
72
|
+
Check if the code is running on macOS.
|
|
73
|
+
|
|
74
|
+
### `isWindows`
|
|
75
|
+
|
|
76
|
+
Check if the code is running on Windows.
|
|
77
|
+
|
|
78
|
+
### `isLinux`
|
|
79
|
+
|
|
80
|
+
Check if the code is running on Linux.
|
|
81
|
+
|
|
82
|
+
### `isIos`
|
|
83
|
+
|
|
84
|
+
Check if the code is running on iOS.
|
|
85
|
+
|
|
86
|
+
### `isAndroid`
|
|
87
|
+
|
|
88
|
+
Check if the code is running on Android.
|
|
89
|
+
|
|
90
|
+
## Related
|
|
91
|
+
|
|
92
|
+
- [is-in-ci](https://github.com/sindresorhus/is-in-ci) - Check if the process is running in a CI environment
|
|
93
|
+
- [is64bit](https://github.com/sindresorhus/is64bit) - Check if the operating system CPU architecture is 64-bit or 32-bit
|
|
94
|
+
- [is](https://github.com/sindresorhus/is) - Type check values
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Escape RegExp special characters.
|
|
3
|
+
|
|
4
|
+
You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.
|
|
5
|
+
|
|
6
|
+
@example
|
|
7
|
+
```
|
|
8
|
+
import escapeStringRegexp = require('escape-string-regexp');
|
|
9
|
+
|
|
10
|
+
const escapedString = escapeStringRegexp('How much $ for a 🦄?');
|
|
11
|
+
//=> 'How much \\$ for a 🦄\\?'
|
|
12
|
+
|
|
13
|
+
new RegExp(escapedString);
|
|
14
|
+
```
|
|
15
|
+
*/
|
|
16
|
+
declare const escapeStringRegexp: (string: string) => string;
|
|
17
|
+
|
|
18
|
+
export = escapeStringRegexp;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "escape-string-regexp",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Escape RegExp special characters",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/escape-string-regexp",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Sindre Sorhus",
|
|
9
|
+
"email": "sindresorhus@gmail.com",
|
|
10
|
+
"url": "sindresorhus.com"
|
|
11
|
+
},
|
|
12
|
+
"maintainers": [
|
|
13
|
+
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
|
|
14
|
+
"Joshua Boy Nicolai Appelman <joshua@jbna.nl> (jbna.nl)"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=8"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "xo && ava && tsd"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"index.js",
|
|
24
|
+
"index.d.ts"
|
|
25
|
+
],
|
|
26
|
+
"keywords": [
|
|
27
|
+
"escape",
|
|
28
|
+
"regex",
|
|
29
|
+
"regexp",
|
|
30
|
+
"re",
|
|
31
|
+
"regular",
|
|
32
|
+
"expression",
|
|
33
|
+
"string",
|
|
34
|
+
"str",
|
|
35
|
+
"special",
|
|
36
|
+
"characters"
|
|
37
|
+
],
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"ava": "^1.4.1",
|
|
40
|
+
"tsd": "^0.7.2",
|
|
41
|
+
"xo": "^0.24.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# escape-string-regexp [](https://travis-ci.org/sindresorhus/escape-string-regexp)
|
|
2
|
+
|
|
3
|
+
> Escape RegExp special characters
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
$ npm install escape-string-regexp
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
const escapeStringRegexp = require('escape-string-regexp');
|
|
17
|
+
|
|
18
|
+
const escapedString = escapeStringRegexp('How much $ for a 🦄?');
|
|
19
|
+
//=> 'How much \\$ for a 🦄\\?'
|
|
20
|
+
|
|
21
|
+
new RegExp(escapedString);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms).
|
|
3
|
+
|
|
4
|
+
@param codePoint - The [code point](https://en.wikipedia.org/wiki/Code_point) of a character.
|
|
5
|
+
|
|
6
|
+
@example
|
|
7
|
+
```
|
|
8
|
+
import isFullwidthCodePoint from 'is-fullwidth-code-point';
|
|
9
|
+
|
|
10
|
+
isFullwidthCodePoint('谢'.codePointAt(0));
|
|
11
|
+
//=> true
|
|
12
|
+
|
|
13
|
+
isFullwidthCodePoint('a'.codePointAt(0));
|
|
14
|
+
//=> false
|
|
15
|
+
```
|
|
16
|
+
*/
|
|
17
|
+
export default function isFullwidthCodePoint(codePoint: number): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_isFullWidth as isFullWidth,
|
|
3
|
+
_isWide as isWide,
|
|
4
|
+
} from 'get-east-asian-width';
|
|
5
|
+
|
|
6
|
+
export default function isFullwidthCodePoint(codePoint) {
|
|
7
|
+
if (!Number.isInteger(codePoint)) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return isFullWidth(codePoint) || isWide(codePoint);
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "is-fullwidth-code-point",
|
|
3
|
+
"version": "5.1.0",
|
|
4
|
+
"description": "Check if the character represented by a given Unicode code point is fullwidth",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/is-fullwidth-code-point",
|
|
7
|
+
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Sindre Sorhus",
|
|
10
|
+
"email": "sindresorhus@gmail.com",
|
|
11
|
+
"url": "https://sindresorhus.com"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": {
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"default": "./index.js"
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=18"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "xo && ava && tsd"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"index.js",
|
|
27
|
+
"index.d.ts"
|
|
28
|
+
],
|
|
29
|
+
"keywords": [
|
|
30
|
+
"fullwidth",
|
|
31
|
+
"full-width",
|
|
32
|
+
"full",
|
|
33
|
+
"width",
|
|
34
|
+
"unicode",
|
|
35
|
+
"character",
|
|
36
|
+
"string",
|
|
37
|
+
"codepoint",
|
|
38
|
+
"code",
|
|
39
|
+
"point",
|
|
40
|
+
"is",
|
|
41
|
+
"detect",
|
|
42
|
+
"check",
|
|
43
|
+
"east-asian-width"
|
|
44
|
+
],
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"ava": "^5.3.1",
|
|
47
|
+
"tsd": "^0.29.0",
|
|
48
|
+
"xo": "^0.56.0"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"get-east-asian-width": "^1.3.1"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# is-fullwidth-code-point
|
|
2
|
+
|
|
3
|
+
> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms)
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install is-fullwidth-code-point
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import isFullwidthCodePoint from 'is-fullwidth-code-point';
|
|
15
|
+
|
|
16
|
+
isFullwidthCodePoint('谢'.codePointAt(0));
|
|
17
|
+
//=> true
|
|
18
|
+
|
|
19
|
+
isFullwidthCodePoint('a'.codePointAt(0));
|
|
20
|
+
//=> false
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## API
|
|
24
|
+
|
|
25
|
+
### isFullwidthCodePoint(codePoint)
|
|
26
|
+
|
|
27
|
+
#### codePoint
|
|
28
|
+
|
|
29
|
+
Type: `number`
|
|
30
|
+
|
|
31
|
+
The [code point](https://en.wikipedia.org/wiki/Code_point) of a character.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
declare namespace onetime {
|
|
2
|
+
interface Options {
|
|
3
|
+
/**
|
|
4
|
+
Throw an error when called more than once.
|
|
5
|
+
|
|
6
|
+
@default false
|
|
7
|
+
*/
|
|
8
|
+
throw?: boolean;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare const onetime: {
|
|
13
|
+
/**
|
|
14
|
+
Ensure a function is only called once. When called multiple times it will return the return value from the first call.
|
|
15
|
+
|
|
16
|
+
@param fn - Function that should only be called once.
|
|
17
|
+
@returns A function that only calls `fn` once.
|
|
18
|
+
|
|
19
|
+
@example
|
|
20
|
+
```
|
|
21
|
+
import onetime = require('onetime');
|
|
22
|
+
|
|
23
|
+
let i = 0;
|
|
24
|
+
|
|
25
|
+
const foo = onetime(() => ++i);
|
|
26
|
+
|
|
27
|
+
foo(); //=> 1
|
|
28
|
+
foo(); //=> 1
|
|
29
|
+
foo(); //=> 1
|
|
30
|
+
|
|
31
|
+
onetime.callCount(foo); //=> 3
|
|
32
|
+
```
|
|
33
|
+
*/
|
|
34
|
+
<ArgumentsType extends unknown[], ReturnType>(
|
|
35
|
+
fn: (...arguments: ArgumentsType) => ReturnType,
|
|
36
|
+
options?: onetime.Options
|
|
37
|
+
): (...arguments: ArgumentsType) => ReturnType;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
Get the number of times `fn` has been called.
|
|
41
|
+
|
|
42
|
+
@param fn - Function to get call count from.
|
|
43
|
+
@returns A number representing how many times `fn` has been called.
|
|
44
|
+
|
|
45
|
+
@example
|
|
46
|
+
```
|
|
47
|
+
import onetime = require('onetime');
|
|
48
|
+
|
|
49
|
+
const foo = onetime(() => {});
|
|
50
|
+
foo();
|
|
51
|
+
foo();
|
|
52
|
+
foo();
|
|
53
|
+
|
|
54
|
+
console.log(onetime.callCount(foo));
|
|
55
|
+
//=> 3
|
|
56
|
+
```
|
|
57
|
+
*/
|
|
58
|
+
callCount(fn: (...arguments: any[]) => unknown): number;
|
|
59
|
+
|
|
60
|
+
// TODO: Remove this for the next major release
|
|
61
|
+
default: typeof onetime;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export = onetime;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const mimicFn = require('mimic-fn');
|
|
3
|
+
|
|
4
|
+
const calledFunctions = new WeakMap();
|
|
5
|
+
|
|
6
|
+
const onetime = (function_, options = {}) => {
|
|
7
|
+
if (typeof function_ !== 'function') {
|
|
8
|
+
throw new TypeError('Expected a function');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let returnValue;
|
|
12
|
+
let callCount = 0;
|
|
13
|
+
const functionName = function_.displayName || function_.name || '<anonymous>';
|
|
14
|
+
|
|
15
|
+
const onetime = function (...arguments_) {
|
|
16
|
+
calledFunctions.set(onetime, ++callCount);
|
|
17
|
+
|
|
18
|
+
if (callCount === 1) {
|
|
19
|
+
returnValue = function_.apply(this, arguments_);
|
|
20
|
+
function_ = null;
|
|
21
|
+
} else if (options.throw === true) {
|
|
22
|
+
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return returnValue;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
mimicFn(onetime, function_);
|
|
29
|
+
calledFunctions.set(onetime, callCount);
|
|
30
|
+
|
|
31
|
+
return onetime;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports = onetime;
|
|
35
|
+
// TODO: Remove this for the next major release
|
|
36
|
+
module.exports.default = onetime;
|
|
37
|
+
|
|
38
|
+
module.exports.callCount = function_ => {
|
|
39
|
+
if (!calledFunctions.has(function_)) {
|
|
40
|
+
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return calledFunctions.get(function_);
|
|
44
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "onetime",
|
|
3
|
+
"version": "5.1.2",
|
|
4
|
+
"description": "Ensure a function is only called once",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/onetime",
|
|
7
|
+
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Sindre Sorhus",
|
|
10
|
+
"email": "sindresorhus@gmail.com",
|
|
11
|
+
"url": "https://sindresorhus.com"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=6"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "xo && ava && tsd"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"index.js",
|
|
21
|
+
"index.d.ts"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
"once",
|
|
25
|
+
"function",
|
|
26
|
+
"one",
|
|
27
|
+
"onetime",
|
|
28
|
+
"func",
|
|
29
|
+
"fn",
|
|
30
|
+
"single",
|
|
31
|
+
"call",
|
|
32
|
+
"called",
|
|
33
|
+
"prevent"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"mimic-fn": "^2.1.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"ava": "^1.4.1",
|
|
40
|
+
"tsd": "^0.7.1",
|
|
41
|
+
"xo": "^0.24.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# onetime [](https://travis-ci.com/github/sindresorhus/onetime)
|
|
2
|
+
|
|
3
|
+
> Ensure a function is only called once
|
|
4
|
+
|
|
5
|
+
When called multiple times it will return the return value from the first call.
|
|
6
|
+
|
|
7
|
+
*Unlike the module [once](https://github.com/isaacs/once), this one isn't naughty and extending `Function.prototype`.*
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
$ npm install onetime
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
const onetime = require('onetime');
|
|
19
|
+
|
|
20
|
+
let i = 0;
|
|
21
|
+
|
|
22
|
+
const foo = onetime(() => ++i);
|
|
23
|
+
|
|
24
|
+
foo(); //=> 1
|
|
25
|
+
foo(); //=> 1
|
|
26
|
+
foo(); //=> 1
|
|
27
|
+
|
|
28
|
+
onetime.callCount(foo); //=> 3
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
const onetime = require('onetime');
|
|
33
|
+
|
|
34
|
+
const foo = onetime(() => {}, {throw: true});
|
|
35
|
+
|
|
36
|
+
foo();
|
|
37
|
+
|
|
38
|
+
foo();
|
|
39
|
+
//=> Error: Function `foo` can only be called once
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## API
|
|
43
|
+
|
|
44
|
+
### onetime(fn, options?)
|
|
45
|
+
|
|
46
|
+
Returns a function that only calls `fn` once.
|
|
47
|
+
|
|
48
|
+
#### fn
|
|
49
|
+
|
|
50
|
+
Type: `Function`
|
|
51
|
+
|
|
52
|
+
Function that should only be called once.
|
|
53
|
+
|
|
54
|
+
#### options
|
|
55
|
+
|
|
56
|
+
Type: `object`
|
|
57
|
+
|
|
58
|
+
##### throw
|
|
59
|
+
|
|
60
|
+
Type: `boolean`\
|
|
61
|
+
Default: `false`
|
|
62
|
+
|
|
63
|
+
Throw an error when called more than once.
|
|
64
|
+
|
|
65
|
+
### onetime.callCount(fn)
|
|
66
|
+
|
|
67
|
+
Returns a number representing how many times `fn` has been called.
|
|
68
|
+
|
|
69
|
+
Note: It throws an error if you pass in a function that is not wrapped by `onetime`.
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
const onetime = require('onetime');
|
|
73
|
+
|
|
74
|
+
const foo = onetime(() => {});
|
|
75
|
+
|
|
76
|
+
foo();
|
|
77
|
+
foo();
|
|
78
|
+
foo();
|
|
79
|
+
|
|
80
|
+
console.log(onetime.callCount(foo));
|
|
81
|
+
//=> 3
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### fn
|
|
85
|
+
|
|
86
|
+
Type: `Function`
|
|
87
|
+
|
|
88
|
+
Function to get call count from.
|
|
89
|
+
|
|
90
|
+
## onetime for enterprise
|
|
91
|
+
|
|
92
|
+
Available as part of the Tidelift Subscription.
|
|
93
|
+
|
|
94
|
+
The maintainers of onetime and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-onetime?utm_source=npm-onetime&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright © 2017, Charmander <~@charmander.me>
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
5
|
+
copyright notice and this permission notice appear in all copies.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
9
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[![Build status][ci image]][ci]
|
|
2
|
+
|
|
3
|
+
64-bit big-endian signed integer-to-string conversion designed for [pg][].
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
const readInt8 = require('pg-int8');
|
|
7
|
+
|
|
8
|
+
readInt8(Buffer.from([0, 1, 2, 3, 4, 5, 6, 7]))
|
|
9
|
+
// '283686952306183'
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
[pg]: https://github.com/brianc/node-postgres
|
|
14
|
+
|
|
15
|
+
[ci]: https://travis-ci.org/charmander/pg-int8
|
|
16
|
+
[ci image]: https://api.travis-ci.org/charmander/pg-int8.svg
|