decocms 2.300.4 → 2.300.5
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-DBqGSPcP.js → AlertCircle-DkMu8gq-.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-BXaqij1B.js → ArrowNarrowLeft-CubWmonS.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-Dy3pY1KB.js → ArrowUpRight-9NVoXrfx.js} +1 -1
- package/dist/client/assets/{CheckCircle-CdvisKeL.js → CheckCircle-Bel0s5y_.js} +1 -1
- package/dist/client/assets/{ChevronDown-Bgm8xpiB.js → ChevronDown-Bkgm1HYo.js} +1 -1
- package/dist/client/assets/{ChevronRight-BNDzbrXM.js → ChevronRight-DfwJRari.js} +1 -1
- package/dist/client/assets/{ChevronUp-Dcy3nbXG.js → ChevronUp-B2fEvmSa.js} +1 -1
- package/dist/client/assets/{Container-DuIexZxb.js → Container--DgM5X-R.js} +1 -1
- package/dist/client/assets/{DotsVertical-DXx0Ujg3.js → DotsVertical-C8shhzyc.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DYjZZIDx.js → LinkExternal01-CcwfRKez.js} +1 -1
- package/dist/client/assets/{Lock01-BOe1gff0.js → Lock01-Bp9Pue_s.js} +1 -1
- package/dist/client/assets/{Palette-DhQuB2ML.js → Palette-CrkwzhEn.js} +1 -1
- package/dist/client/assets/{Play-BZcGmVwL.js → Play-DnDrS4FU.js} +1 -1
- package/dist/client/assets/{Plus-4Uez8HVE.js → Plus-kol8QQC6.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-BhAeHS-g.js → RefreshCcw01-BuPMNg1o.js} +1 -1
- package/dist/client/assets/{SearchMd-CUzM0zrX.js → SearchMd-CwDQTv7t.js} +1 -1
- package/dist/client/assets/{Settings02-Cnur6vcd.js → Settings02-CHcEkK8P.js} +1 -1
- package/dist/client/assets/{Shield01-BWRE1Xs3.js → Shield01-odg-3hat.js} +1 -1
- package/dist/client/assets/{Star01-BybMVymG.js → Star01-BpQlh6lv.js} +1 -1
- package/dist/client/assets/{Sun-C-v59Gap.js → Sun-D_lLP5L9.js} +1 -1
- package/dist/client/assets/{Tool01-mZQYeKOx.js → Tool01-CEe0UAte.js} +1 -1
- package/dist/client/assets/{Trash01-CNoOS3JN.js → Trash01-CUymhPzm.js} +1 -1
- package/dist/client/assets/{User01-DbuCBEQw.js → User01-DIw7EvUc.js} +1 -1
- package/dist/client/assets/{Users03-V3ylDCzz.js → Users03-R3lmvJ78.js} +1 -1
- package/dist/client/assets/{X-CcLhRHZD.js → X-DcM1qdBK.js} +1 -1
- package/dist/client/assets/{XCircle-ChctSyHl.js → XCircle-CeBHJaqL.js} +1 -1
- package/dist/client/assets/{XClose-DpUcIhAm.js → XClose-BHjvdgY4.js} +1 -1
- package/dist/client/assets/{Zap-B1-dMO3y.js → Zap-CyWzSozB.js} +1 -1
- package/dist/client/assets/{ZapSquare-DfvB-5sB.js → ZapSquare-BtvMrp4e.js} +1 -1
- package/dist/client/assets/{accordion-DfaTzzgo.js → accordion-CDw4R_G8.js} +1 -1
- package/dist/client/assets/{agent-icon-BoQW_2EY.js → agent-icon-DLxm9qbl.js} +1 -1
- package/dist/client/assets/{agents-list-DR0jRYSF.js → agents-list-CjvTcm5i.js} +1 -1
- package/dist/client/assets/ai-providers-DAKQ-bP1.js +1 -0
- package/dist/client/assets/{alert-dialog-DXJjXwxi.js → alert-dialog-B4hsEfJe.js} +1 -1
- package/dist/client/assets/{auth-catchall-DHcrcBIP.js → auth-catchall-DslBGItj.js} +1 -1
- package/dist/client/assets/{automation-list-row-DI5R0l8o.js → automation-list-row-CgYM96JG.js} +1 -1
- package/dist/client/assets/{automations-no2zbvix.js → automations-DpmVxKM2.js} +1 -1
- package/dist/client/assets/{avatar-Do-s9ITZ.js → avatar-CTvLM9yq.js} +1 -1
- package/dist/client/assets/{badge-YFtohznh.js → badge-B1zEfhH7.js} +1 -1
- package/dist/client/assets/{brand-context-rvHcmR_G.js → brand-context-D0BsHRBR.js} +1 -1
- package/dist/client/assets/{card-Dk0Zo6QN.js → card-DHL-J9u4.js} +1 -1
- package/dist/client/assets/{chat-context-C0Zo32t0.js → chat-context-B5UR9HLd.js} +1 -1
- package/dist/client/assets/{checkbox-CiBhzyNY.js → checkbox-BOftTDdw.js} +1 -1
- package/dist/client/assets/{collection-detail-y0WNKlJX.js → collection-detail-DgXbTdY8.js} +1 -1
- package/dist/client/assets/{collection-display-button-CjaJe_GY.js → collection-display-button-CcEkczO7.js} +1 -1
- package/dist/client/assets/{collection-search-ryHtnd8M.js → collection-search-CME3JpPr.js} +1 -1
- package/dist/client/assets/{collection-search-CAuA76RP.js → collection-search-T1fjuYzz.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-Dcdw6aoC.js → collection-table-wrapper-BaPy1k5k.js} +1 -1
- package/dist/client/assets/{collection-tabs-C3LT_tc_.js → collection-tabs-CSqJajy_.js} +1 -1
- package/dist/client/assets/{collections-DDb7LpQB.js → collections-Bji9q_km.js} +1 -1
- package/dist/client/assets/{command-CTfgW0Iz.js → command-DtyQdyVD.js} +1 -1
- package/dist/client/assets/{connection-card-D5H4X3Cp.js → connection-card-BTMtyEJ8.js} +1 -1
- package/dist/client/assets/{connection-detail-Bd-yhWrp.js → connection-detail-BefqrOx5.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-BwTkhXCX.js → connection-form-helpers-CCMusIOu.js} +1 -1
- package/dist/client/assets/{connections-ohFEgzZ5.js → connections-DbDKUx4y.js} +1 -1
- package/dist/client/assets/{constants-CQXiy2CE.js → constants-BRWzgNkQ.js} +1 -1
- package/dist/client/assets/{constants-BfRRhGan.js → constants-Bl2zdZKg.js} +1 -1
- package/dist/client/assets/{dialog-DzUewo1N.js → dialog-TJfN_BuF.js} +1 -1
- package/dist/client/assets/{domain-settings-kuwV32Fv.js → domain-settings-BFdwOOGl.js} +1 -1
- package/dist/client/assets/{drawer-DW2mtNYY.js → drawer-C2i2-ja1.js} +1 -1
- package/dist/client/assets/{dropdown-menu-DCTIJaux.js → dropdown-menu-D9XdG3Xq.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-Dquo1zHH.js → dynamic-plugin-layout-BfJpkcg4.js} +1 -1
- package/dist/client/assets/{empty-state-BVem588l.js → empty-state-B1-aUhdl.js} +1 -1
- package/dist/client/assets/{empty-state-CItDDPJC.js → empty-state-CLPJFsFO.js} +1 -1
- package/dist/client/assets/{extract-connection-data-B9ZIPvMk.js → extract-connection-data-Cg_nAhlq.js} +1 -1
- package/dist/client/assets/{features-BBiOusUu.js → features-Dt4JD8s-.js} +1 -1
- package/dist/client/assets/{form-DBCGiMXe.js → form-sbdLhoLD.js} +1 -1
- package/dist/client/assets/{general-Dgp_dGYw.js → general-D6BEXRIY.js} +1 -1
- package/dist/client/assets/{index-DC6Xxjvd.js → index-BJybli6s.js} +1 -1
- package/dist/client/assets/{index-B_Lcr50o.js → index-BT8iP1gH.js} +1 -1
- package/dist/client/assets/{index-OcEo2bsu.js → index-BXqFEz8g.js} +1 -1
- package/dist/client/assets/{index-D-bSqE5m.js → index-BXzlMZdf.js} +1 -1
- package/dist/client/assets/{index-CQIQcTOE.js → index-BcH41hau.js} +3 -3
- package/dist/client/assets/{index-DxqG7SO-.js → index-CA7joeGf.js} +2 -2
- package/dist/client/assets/{index-ClSDqtDK.js → index-CAwsKc2v.js} +1 -1
- package/dist/client/assets/index-CQtoC2zV.js +1 -0
- package/dist/client/assets/{index-BAJeqA_t.js → index-D3orj13j.js} +1 -1
- package/dist/client/assets/{index-WmCG_KTe.js → index-DiyP0mWl.js} +1 -1
- package/dist/client/assets/{index-CQt4AtFf.js → index-Dryqe2qH.js} +1 -1
- package/dist/client/assets/{index-Dr6IDlb4.js → index-Dut1OOHD.js} +1 -1
- package/dist/client/assets/{index-DaJv4rHK.js → index-e_WCxTHQ.js} +1 -1
- package/dist/client/assets/{index-DrSdTiwb.js → index-oAITNDIl.js} +1 -1
- package/dist/client/assets/{index-CFLlOXkv.js → index-rkDSwq1t.js} +1 -1
- package/dist/client/assets/{index-CuVGQGX3.js → index-udLCY52f.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-Cp4HH66i.js → infiniteQueryObserver-BPb1dFhQ.js} +1 -1
- package/dist/client/assets/{input-AQP4T9xe.js → input-_x-qoZqG.js} +1 -1
- package/dist/client/assets/{integration-icon-CdA3xzg3.js → integration-icon-CBWiTcFM.js} +1 -1
- package/dist/client/assets/{label-C8LpQh8Q.js → label-FeiT4-LA.js} +1 -1
- package/dist/client/assets/{layout-BHftN2cN.js → layout-j3UyPUZl.js} +1 -1
- package/dist/client/assets/{lean-canvas-recruit-modal-CW_p90EQ.js → lean-canvas-recruit-modal-AdHH96Pz.js} +1 -1
- package/dist/client/assets/{login-cQRRHPKJ.js → login-CQ1sw4Og.js} +1 -1
- package/dist/client/assets/{members-oD32fKCk.js → members-DgCBAzk4.js} +1 -1
- package/dist/client/assets/{monaco-editor-0eY4s_n8.js → monaco-editor-RpC6COeN.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-yU9BWynr.js → monitoring-stats-row-BpUJoO_T.js} +1 -1
- package/dist/client/assets/{oauth-callback-qNrnCHn7.js → oauth-callback-CrzoeptP.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-JWUJcuot.js → oauth-callback-ai-provider-CCIE7j_l.js} +1 -1
- package/dist/client/assets/{onboarding-Csd238y5.js → onboarding-BAQp9DvG.js} +1 -1
- package/dist/client/assets/{org-layout-COUnT52o.js → org-layout-44rYb1sc.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-HVrYmP0h.js → org-plugin-layout-DSXF2qdf.js} +1 -1
- package/dist/client/assets/{pair-H3vGRUJ8.js → pair-DEl8UPeD.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-D0IVOQOh.js → plugin-empty-state-22doZ0Xz.js} +1 -1
- package/dist/client/assets/{plugin-header-BHkekk5v.js → plugin-header-ByTelm9S.js} +1 -1
- package/dist/client/assets/{plugin-layout-1tZ95Fop.js → plugin-layout-BO64c4_C.js} +1 -1
- package/dist/client/assets/{popover-S0LP8OED.js → popover-BhlghMMz.js} +1 -1
- package/dist/client/assets/{profile-BeEbm_se.js → profile-CSGEFgSz.js} +1 -1
- package/dist/client/assets/{project-app-view-DzAnv0Fk.js → project-app-view-B_RELaVP.js} +1 -1
- package/dist/client/assets/registry-CYqJhZV_.js +2 -0
- package/dist/client/assets/{registry-layout-DXYTYBKQ.js → registry-layout-JuLTsFQQ.js} +1 -1
- package/dist/client/assets/{required-auth-layout-BGBHukmi.js → required-auth-layout-oACSrwiy.js} +1 -1
- package/dist/client/assets/{reset-password-C-9QuQII.js → reset-password-CW7woRPX.js} +1 -1
- package/dist/client/assets/{roles-Dte8-9_k.js → roles-5CKHHGAZ.js} +1 -1
- package/dist/client/assets/{scroll-area-BtbNdEg9.js → scroll-area-BV26X1QC.js} +1 -1
- package/dist/client/assets/{search-input-K74_hIzk.js → search-input-ms-0SUW_.js} +1 -1
- package/dist/client/assets/{select-CKY9FB0z.js → select-CswVooY0.js} +1 -1
- package/dist/client/assets/{select-model-CuDUx7az.js → select-model-CStSTDOz.js} +1 -1
- package/dist/client/assets/{settings-layout-D2D4BwFh.js → settings-layout-B420oRcP.js} +1 -1
- package/dist/client/assets/{settings-section-DVNeioQ5.js → settings-section-D7ZcS52Q.js} +1 -1
- package/dist/client/assets/{shell-layout-CvVEyxri.js → shell-layout-COliHXDZ.js} +1 -1
- package/dist/client/assets/{skeleton-C6ls5pwO.js → skeleton-DI0MCO1l.js} +1 -1
- package/dist/client/assets/{sso-Cf_l8jfK.js → sso-CrvD6OU3.js} +1 -1
- package/dist/client/assets/{store-ycJgiobO.js → store-DfNnoMeC.js} +1 -1
- package/dist/client/assets/store-registry-BYofPeIK.js +2 -0
- package/dist/client/assets/{switch-W3XCBtER.js → switch-BrC-TZom.js} +1 -1
- package/dist/client/assets/{table-AOuQ6q7A.js → table-G8ogXBrQ.js} +1 -1
- package/dist/client/assets/{tabs-UNZgkDVa.js → tabs-Bf_8xBry.js} +1 -1
- package/dist/client/assets/{task-status-DEy7r9PX.js → task-status-DWZ1hcva.js} +1 -1
- package/dist/client/assets/{textarea-DmqjpSXj.js → textarea-C2oNfWH0.js} +1 -1
- package/dist/client/assets/{toggle-group-BST-Moxg.js → toggle-group-TNheR1D8.js} +1 -1
- package/dist/client/assets/{tools-list-DRBrcsE2.js → tools-list-B5eTdBpN.js} +1 -1
- package/dist/client/assets/{tooltip-CgLjXWRO.js → tooltip-CXr14ebZ.js} +1 -1
- package/dist/client/assets/{types-Di7lU1Th.js → types-EFCIzOpO.js} +1 -1
- package/dist/client/assets/{use-ai-providers-DWoG_MfI.js → use-ai-providers-BsokjkVR.js} +1 -1
- package/dist/client/assets/{use-collections-Bd7RNZWG.js → use-collections-Dn-RqPYg.js} +1 -1
- package/dist/client/assets/{use-connection-B1IAOygg.js → use-connection-5ik_QQbi.js} +1 -1
- package/dist/client/assets/{use-copy-Qz-6rwiI.js → use-copy-BfAEU9NO.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-CsXnKbT4.js → use-create-virtual-mcp-fVwDTjUO.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-C9UMGLNG.js → use-decopilot-events-C5dCU4fI.js} +1 -1
- package/dist/client/assets/{use-delete-connection-DIB-wCzR.js → use-delete-connection-r8ffcG8U.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-DDdJV0pS.js → use-infinite-scroll-tkYaCIKm.js} +1 -1
- package/dist/client/assets/{use-list-state-DUZFsckk.js → use-list-state-Di2rvhMn.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-Hk3B3FPL.js → use-mcp-tools-DyFsytRR.js} +1 -1
- package/dist/client/assets/{use-members-Kof7B7_B.js → use-members-DIX6nSMY.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-BAjrVRkm.js → use-navigate-to-agent-Z7fkkD5K.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-PM4Bq5B4.js → use-org-auth-client-DZX0Z5cG.js} +1 -1
- package/dist/client/assets/{use-org-sso-CsdEJaGH.js → use-org-sso-DpWan0ZR.js} +1 -1
- package/dist/client/assets/{use-organization-roles-CK4jCoPY.js → use-organization-roles-Dw_EZ-oj.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BjQPxEXx.js → use-organization-settings-0hZMyBeX.js} +1 -1
- package/dist/client/assets/{use-registry-connections-Bc9Jz_l9.js → use-registry-connections-Bn-4-RDt.js} +1 -1
- package/dist/client/assets/{use-status-sounds-B-dcjykj.js → use-status-sounds-CwuuISMS.js} +1 -1
- package/dist/client/assets/{use-tasks-DNXvD3d-.js → use-tasks-oBeHrmLh.js} +1 -1
- package/dist/client/assets/{use-view-mode-B-PzbH7u.js → use-view-mode-BjlcvVOS.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BKDZ5Y53.js → use-virtual-mcp-S7caS2Os.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CIF5ZhDW.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-BIQTAzoK.js +1 -0
- package/dist/client/assets/{user-Dx0-Sx0Q.js → user-Bf4WlHoU.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-Cdvf7aEz.js → view-mode-toggle-CgBfTDfx.js} +1 -1
- package/dist/client/assets/{workflow-By0QNvDh.js → workflow-DGmBrUmA.js} +1 -1
- package/dist/client/assets/workflow-detail-Dwa4aK51.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +2 -2
- package/dist/server/node_modules/postgres-array/index.d.ts +4 -0
- package/dist/server/node_modules/postgres-array/index.js +97 -0
- package/dist/server/node_modules/postgres-array/license +21 -0
- package/dist/server/node_modules/postgres-array/package.json +35 -0
- package/dist/server/node_modules/postgres-array/readme.md +43 -0
- package/dist/server/node_modules/postgres-bytea/index.js +33 -0
- package/dist/server/node_modules/postgres-bytea/license +21 -0
- package/dist/server/node_modules/postgres-bytea/package.json +34 -0
- package/dist/server/node_modules/postgres-bytea/readme.md +34 -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/dist/server/server.js +108 -108
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-tmdoxB8w.js +0 -1
- package/dist/client/assets/index-CckfzoQo.js +0 -1
- package/dist/client/assets/registry-B3IZW-Zn.js +0 -2
- package/dist/client/assets/store-registry-Cvg5AsGu.js +0 -2
- package/dist/client/assets/useInfiniteQuery-CbEWL_0E.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-_KsFhI9-.js +0 -1
- package/dist/client/assets/workflow-detail-Bv06QqfF.js +0 -1
- package/dist/server/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
- package/dist/server/node_modules/is-fullwidth-code-point/index.js +0 -12
- package/dist/server/node_modules/is-fullwidth-code-point/license +0 -9
- package/dist/server/node_modules/is-fullwidth-code-point/package.json +0 -53
- package/dist/server/node_modules/is-fullwidth-code-point/readme.md +0 -31
- package/dist/server/node_modules/slice-ansi/index.d.ts +0 -19
- package/dist/server/node_modules/slice-ansi/index.js +0 -260
- package/dist/server/node_modules/slice-ansi/license +0 -10
- package/dist/server/node_modules/slice-ansi/package.json +0 -59
- package/dist/server/node_modules/slice-ansi/readme.md +0 -54
- package/dist/server/node_modules/slice-ansi/tokenize-ansi.js +0 -752
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('tape')
|
|
4
|
+
const split = require('./')
|
|
5
|
+
const callback = require('callback-stream')
|
|
6
|
+
const strcb = callback.bind(null, { decodeStrings: false })
|
|
7
|
+
const objcb = callback.bind(null, { objectMode: true })
|
|
8
|
+
|
|
9
|
+
test('split two lines on end', function (t) {
|
|
10
|
+
t.plan(2)
|
|
11
|
+
|
|
12
|
+
const input = split()
|
|
13
|
+
|
|
14
|
+
input.pipe(strcb(function (err, list) {
|
|
15
|
+
t.error(err)
|
|
16
|
+
t.deepEqual(list, ['hello', 'world'])
|
|
17
|
+
}))
|
|
18
|
+
|
|
19
|
+
input.end('hello\nworld')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test('split two lines on two writes', function (t) {
|
|
23
|
+
t.plan(2)
|
|
24
|
+
|
|
25
|
+
const input = split()
|
|
26
|
+
|
|
27
|
+
input.pipe(strcb(function (err, list) {
|
|
28
|
+
t.error(err)
|
|
29
|
+
t.deepEqual(list, ['hello', 'world'])
|
|
30
|
+
}))
|
|
31
|
+
|
|
32
|
+
input.write('hello')
|
|
33
|
+
input.write('\nworld')
|
|
34
|
+
input.end()
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
test('split four lines on three writes', function (t) {
|
|
38
|
+
t.plan(2)
|
|
39
|
+
|
|
40
|
+
const input = split()
|
|
41
|
+
|
|
42
|
+
input.pipe(strcb(function (err, list) {
|
|
43
|
+
t.error(err)
|
|
44
|
+
t.deepEqual(list, ['hello', 'world', 'bye', 'world'])
|
|
45
|
+
}))
|
|
46
|
+
|
|
47
|
+
input.write('hello\nwor')
|
|
48
|
+
input.write('ld\nbye\nwo')
|
|
49
|
+
input.write('rld')
|
|
50
|
+
input.end()
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
test('accumulate multiple writes', function (t) {
|
|
54
|
+
t.plan(2)
|
|
55
|
+
|
|
56
|
+
const input = split()
|
|
57
|
+
|
|
58
|
+
input.pipe(strcb(function (err, list) {
|
|
59
|
+
t.error(err)
|
|
60
|
+
t.deepEqual(list, ['helloworld'])
|
|
61
|
+
}))
|
|
62
|
+
|
|
63
|
+
input.write('hello')
|
|
64
|
+
input.write('world')
|
|
65
|
+
input.end()
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
test('split using a custom string matcher', function (t) {
|
|
69
|
+
t.plan(2)
|
|
70
|
+
|
|
71
|
+
const input = split('~')
|
|
72
|
+
|
|
73
|
+
input.pipe(strcb(function (err, list) {
|
|
74
|
+
t.error(err)
|
|
75
|
+
t.deepEqual(list, ['hello', 'world'])
|
|
76
|
+
}))
|
|
77
|
+
|
|
78
|
+
input.end('hello~world')
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
test('split using a custom regexp matcher', function (t) {
|
|
82
|
+
t.plan(2)
|
|
83
|
+
|
|
84
|
+
const input = split(/~/)
|
|
85
|
+
|
|
86
|
+
input.pipe(strcb(function (err, list) {
|
|
87
|
+
t.error(err)
|
|
88
|
+
t.deepEqual(list, ['hello', 'world'])
|
|
89
|
+
}))
|
|
90
|
+
|
|
91
|
+
input.end('hello~world')
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
test('support an option argument', function (t) {
|
|
95
|
+
t.plan(2)
|
|
96
|
+
|
|
97
|
+
const input = split({ highWaterMark: 2 })
|
|
98
|
+
|
|
99
|
+
input.pipe(strcb(function (err, list) {
|
|
100
|
+
t.error(err)
|
|
101
|
+
t.deepEqual(list, ['hello', 'world'])
|
|
102
|
+
}))
|
|
103
|
+
|
|
104
|
+
input.end('hello\nworld')
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
test('support a mapper function', function (t) {
|
|
108
|
+
t.plan(2)
|
|
109
|
+
|
|
110
|
+
const a = { a: '42' }
|
|
111
|
+
const b = { b: '24' }
|
|
112
|
+
|
|
113
|
+
const input = split(JSON.parse)
|
|
114
|
+
|
|
115
|
+
input.pipe(objcb(function (err, list) {
|
|
116
|
+
t.error(err)
|
|
117
|
+
t.deepEqual(list, [a, b])
|
|
118
|
+
}))
|
|
119
|
+
|
|
120
|
+
input.write(JSON.stringify(a))
|
|
121
|
+
input.write('\n')
|
|
122
|
+
input.end(JSON.stringify(b))
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
test('split lines windows-style', function (t) {
|
|
126
|
+
t.plan(2)
|
|
127
|
+
|
|
128
|
+
const input = split()
|
|
129
|
+
|
|
130
|
+
input.pipe(strcb(function (err, list) {
|
|
131
|
+
t.error(err)
|
|
132
|
+
t.deepEqual(list, ['hello', 'world'])
|
|
133
|
+
}))
|
|
134
|
+
|
|
135
|
+
input.end('hello\r\nworld')
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
test('splits a buffer', function (t) {
|
|
139
|
+
t.plan(2)
|
|
140
|
+
|
|
141
|
+
const input = split()
|
|
142
|
+
|
|
143
|
+
input.pipe(strcb(function (err, list) {
|
|
144
|
+
t.error(err)
|
|
145
|
+
t.deepEqual(list, ['hello', 'world'])
|
|
146
|
+
}))
|
|
147
|
+
|
|
148
|
+
input.end(Buffer.from('hello\nworld'))
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
test('do not end on undefined', function (t) {
|
|
152
|
+
t.plan(2)
|
|
153
|
+
|
|
154
|
+
const input = split(function (line) { })
|
|
155
|
+
|
|
156
|
+
input.pipe(strcb(function (err, list) {
|
|
157
|
+
t.error(err)
|
|
158
|
+
t.deepEqual(list, [])
|
|
159
|
+
}))
|
|
160
|
+
|
|
161
|
+
input.end(Buffer.from('hello\nworld'))
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
test('has destroy method', function (t) {
|
|
165
|
+
t.plan(1)
|
|
166
|
+
|
|
167
|
+
const input = split(function (line) { })
|
|
168
|
+
|
|
169
|
+
input.on('close', function () {
|
|
170
|
+
t.ok(true, 'close emitted')
|
|
171
|
+
t.end()
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
input.destroy()
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
test('support custom matcher and mapper', function (t) {
|
|
178
|
+
t.plan(4)
|
|
179
|
+
|
|
180
|
+
const a = { a: '42' }
|
|
181
|
+
const b = { b: '24' }
|
|
182
|
+
const input = split('~', JSON.parse)
|
|
183
|
+
|
|
184
|
+
t.equal(input.matcher, '~')
|
|
185
|
+
t.equal(typeof input.mapper, 'function')
|
|
186
|
+
|
|
187
|
+
input.pipe(objcb(function (err, list) {
|
|
188
|
+
t.notOk(err, 'no errors')
|
|
189
|
+
t.deepEqual(list, [a, b])
|
|
190
|
+
}))
|
|
191
|
+
|
|
192
|
+
input.write(JSON.stringify(a))
|
|
193
|
+
input.write('~')
|
|
194
|
+
input.end(JSON.stringify(b))
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
test('support custom matcher and options', function (t) {
|
|
198
|
+
t.plan(6)
|
|
199
|
+
|
|
200
|
+
const input = split('~', { highWaterMark: 1024 })
|
|
201
|
+
|
|
202
|
+
t.equal(input.matcher, '~')
|
|
203
|
+
t.equal(typeof input.mapper, 'function')
|
|
204
|
+
t.equal(input._readableState.highWaterMark, 1024)
|
|
205
|
+
t.equal(input._writableState.highWaterMark, 1024)
|
|
206
|
+
|
|
207
|
+
input.pipe(strcb(function (err, list) {
|
|
208
|
+
t.error(err)
|
|
209
|
+
t.deepEqual(list, ['hello', 'world'])
|
|
210
|
+
}))
|
|
211
|
+
|
|
212
|
+
input.end('hello~world')
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
test('support mapper and options', function (t) {
|
|
216
|
+
t.plan(6)
|
|
217
|
+
|
|
218
|
+
const a = { a: '42' }
|
|
219
|
+
const b = { b: '24' }
|
|
220
|
+
const input = split(JSON.parse, { highWaterMark: 1024 })
|
|
221
|
+
|
|
222
|
+
t.ok(input.matcher instanceof RegExp, 'matcher is RegExp')
|
|
223
|
+
t.equal(typeof input.mapper, 'function')
|
|
224
|
+
t.equal(input._readableState.highWaterMark, 1024)
|
|
225
|
+
t.equal(input._writableState.highWaterMark, 1024)
|
|
226
|
+
|
|
227
|
+
input.pipe(objcb(function (err, list) {
|
|
228
|
+
t.error(err)
|
|
229
|
+
t.deepEqual(list, [a, b])
|
|
230
|
+
}))
|
|
231
|
+
|
|
232
|
+
input.write(JSON.stringify(a))
|
|
233
|
+
input.write('\n')
|
|
234
|
+
input.end(JSON.stringify(b))
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
test('split utf8 chars', function (t) {
|
|
238
|
+
t.plan(2)
|
|
239
|
+
|
|
240
|
+
const input = split()
|
|
241
|
+
|
|
242
|
+
input.pipe(strcb(function (err, list) {
|
|
243
|
+
t.error(err)
|
|
244
|
+
t.deepEqual(list, ['烫烫烫', '锟斤拷'])
|
|
245
|
+
}))
|
|
246
|
+
|
|
247
|
+
const buf = Buffer.from('烫烫烫\r\n锟斤拷', 'utf8')
|
|
248
|
+
for (let i = 0; i < buf.length; ++i) {
|
|
249
|
+
input.write(buf.slice(i, i + 1))
|
|
250
|
+
}
|
|
251
|
+
input.end()
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
test('split utf8 chars 2by2', function (t) {
|
|
255
|
+
t.plan(2)
|
|
256
|
+
|
|
257
|
+
const input = split()
|
|
258
|
+
|
|
259
|
+
input.pipe(strcb(function (err, list) {
|
|
260
|
+
t.error(err)
|
|
261
|
+
t.deepEqual(list, ['烫烫烫', '烫烫烫'])
|
|
262
|
+
}))
|
|
263
|
+
|
|
264
|
+
const str = '烫烫烫\r\n烫烫烫'
|
|
265
|
+
const buf = Buffer.from(str, 'utf8')
|
|
266
|
+
for (let i = 0; i < buf.length; i += 2) {
|
|
267
|
+
input.write(buf.slice(i, i + 2))
|
|
268
|
+
}
|
|
269
|
+
input.end()
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
test('split lines when the \n comes at the end of a chunk', function (t) {
|
|
273
|
+
t.plan(2)
|
|
274
|
+
|
|
275
|
+
const input = split()
|
|
276
|
+
|
|
277
|
+
input.pipe(strcb(function (err, list) {
|
|
278
|
+
t.error(err)
|
|
279
|
+
t.deepEqual(list, ['hello', 'world'])
|
|
280
|
+
}))
|
|
281
|
+
|
|
282
|
+
input.write('hello\n')
|
|
283
|
+
input.end('world')
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
test('truncated utf-8 char', function (t) {
|
|
287
|
+
t.plan(2)
|
|
288
|
+
|
|
289
|
+
const input = split()
|
|
290
|
+
|
|
291
|
+
input.pipe(strcb(function (err, list) {
|
|
292
|
+
t.error(err)
|
|
293
|
+
t.deepEqual(list, ['烫' + Buffer.from('e7', 'hex').toString()])
|
|
294
|
+
}))
|
|
295
|
+
|
|
296
|
+
const str = '烫烫'
|
|
297
|
+
const buf = Buffer.from(str, 'utf8')
|
|
298
|
+
|
|
299
|
+
input.write(buf.slice(0, 3))
|
|
300
|
+
input.end(buf.slice(3, 4))
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
test('maximum buffer limit', function (t) {
|
|
304
|
+
t.plan(1)
|
|
305
|
+
|
|
306
|
+
const input = split({ maxLength: 2 })
|
|
307
|
+
input.on('error', function (err) {
|
|
308
|
+
t.ok(err)
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
input.resume()
|
|
312
|
+
|
|
313
|
+
input.write('hey')
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
test('readable highWaterMark', function (t) {
|
|
317
|
+
const input = split()
|
|
318
|
+
t.equal(input._readableState.highWaterMark, 16)
|
|
319
|
+
t.end()
|
|
320
|
+
})
|
|
321
|
+
|
|
322
|
+
test('maxLength < chunk size', function (t) {
|
|
323
|
+
t.plan(2)
|
|
324
|
+
|
|
325
|
+
const input = split({ maxLength: 2 })
|
|
326
|
+
|
|
327
|
+
input.pipe(strcb(function (err, list) {
|
|
328
|
+
t.error(err)
|
|
329
|
+
t.deepEqual(list, ['a', 'b'])
|
|
330
|
+
}))
|
|
331
|
+
|
|
332
|
+
input.end('a\nb')
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
test('maximum buffer limit w/skip', function (t) {
|
|
336
|
+
t.plan(2)
|
|
337
|
+
|
|
338
|
+
const input = split({ maxLength: 2, skipOverflow: true })
|
|
339
|
+
|
|
340
|
+
input.pipe(strcb(function (err, list) {
|
|
341
|
+
t.error(err)
|
|
342
|
+
t.deepEqual(list, ['a', 'b', 'c'])
|
|
343
|
+
}))
|
|
344
|
+
|
|
345
|
+
input.write('a\n123')
|
|
346
|
+
input.write('456')
|
|
347
|
+
input.write('789\nb\nc')
|
|
348
|
+
input.end()
|
|
349
|
+
})
|
|
350
|
+
|
|
351
|
+
test("don't modify the options object", function (t) {
|
|
352
|
+
t.plan(2)
|
|
353
|
+
|
|
354
|
+
const options = {}
|
|
355
|
+
const input = split(options)
|
|
356
|
+
|
|
357
|
+
input.pipe(strcb(function (err, list) {
|
|
358
|
+
t.error(err)
|
|
359
|
+
t.same(options, {})
|
|
360
|
+
}))
|
|
361
|
+
|
|
362
|
+
input.end()
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
test('mapper throws flush', function (t) {
|
|
366
|
+
t.plan(1)
|
|
367
|
+
const error = new Error()
|
|
368
|
+
const input = split(function () {
|
|
369
|
+
throw error
|
|
370
|
+
})
|
|
371
|
+
|
|
372
|
+
input.on('error', (err, list) => {
|
|
373
|
+
t.same(err, error)
|
|
374
|
+
})
|
|
375
|
+
input.end('hello')
|
|
376
|
+
})
|
|
377
|
+
|
|
378
|
+
test('mapper throws on transform', function (t) {
|
|
379
|
+
t.plan(1)
|
|
380
|
+
|
|
381
|
+
const error = new Error()
|
|
382
|
+
const input = split(function (l) {
|
|
383
|
+
throw error
|
|
384
|
+
})
|
|
385
|
+
|
|
386
|
+
input.on('error', (err) => {
|
|
387
|
+
t.same(err, error)
|
|
388
|
+
})
|
|
389
|
+
input.write('a')
|
|
390
|
+
input.write('\n')
|
|
391
|
+
input.end('b')
|
|
392
|
+
})
|
|
393
|
+
|
|
394
|
+
test('supports Symbol.split', function (t) {
|
|
395
|
+
t.plan(2)
|
|
396
|
+
|
|
397
|
+
const input = split({
|
|
398
|
+
[Symbol.split] (str) {
|
|
399
|
+
return str.split('~')
|
|
400
|
+
}
|
|
401
|
+
})
|
|
402
|
+
|
|
403
|
+
input.pipe(strcb(function (err, list) {
|
|
404
|
+
t.error(err)
|
|
405
|
+
t.deepEqual(list, ['hello', 'world'])
|
|
406
|
+
}))
|
|
407
|
+
|
|
408
|
+
input.end('hello~world')
|
|
409
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"maxdepth": 4,
|
|
3
|
+
"maxstatements": 200,
|
|
4
|
+
"maxcomplexity": 12,
|
|
5
|
+
"maxlen": 80,
|
|
6
|
+
"maxparams": 5,
|
|
7
|
+
|
|
8
|
+
"curly": true,
|
|
9
|
+
"eqeqeq": true,
|
|
10
|
+
"immed": true,
|
|
11
|
+
"latedef": false,
|
|
12
|
+
"noarg": true,
|
|
13
|
+
"noempty": true,
|
|
14
|
+
"nonew": true,
|
|
15
|
+
"undef": true,
|
|
16
|
+
"unused": "vars",
|
|
17
|
+
"trailing": true,
|
|
18
|
+
|
|
19
|
+
"quotmark": true,
|
|
20
|
+
"expr": true,
|
|
21
|
+
"asi": true,
|
|
22
|
+
|
|
23
|
+
"browser": false,
|
|
24
|
+
"esnext": true,
|
|
25
|
+
"devel": false,
|
|
26
|
+
"node": false,
|
|
27
|
+
"nonstandard": false,
|
|
28
|
+
|
|
29
|
+
"predef": ["require", "module", "__dirname", "__filename"]
|
|
30
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
Copyright (c) 2012-2014 Raynos.
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# xtend
|
|
2
|
+
|
|
3
|
+
[![browser support][3]][4]
|
|
4
|
+
|
|
5
|
+
[](http://github.com/badges/stability-badges)
|
|
6
|
+
|
|
7
|
+
Extend like a boss
|
|
8
|
+
|
|
9
|
+
xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence.
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
var extend = require("xtend")
|
|
15
|
+
|
|
16
|
+
// extend returns a new object. Does not mutate arguments
|
|
17
|
+
var combination = extend({
|
|
18
|
+
a: "a",
|
|
19
|
+
b: "c"
|
|
20
|
+
}, {
|
|
21
|
+
b: "b"
|
|
22
|
+
})
|
|
23
|
+
// { a: "a", b: "b" }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Stability status: Locked
|
|
27
|
+
|
|
28
|
+
## MIT Licensed
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
[3]: http://ci.testling.com/Raynos/xtend.png
|
|
32
|
+
[4]: http://ci.testling.com/Raynos/xtend
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module.exports = extend
|
|
2
|
+
|
|
3
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
4
|
+
|
|
5
|
+
function extend() {
|
|
6
|
+
var target = {}
|
|
7
|
+
|
|
8
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
9
|
+
var source = arguments[i]
|
|
10
|
+
|
|
11
|
+
for (var key in source) {
|
|
12
|
+
if (hasOwnProperty.call(source, key)) {
|
|
13
|
+
target[key] = source[key]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return target
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module.exports = extend
|
|
2
|
+
|
|
3
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
4
|
+
|
|
5
|
+
function extend(target) {
|
|
6
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7
|
+
var source = arguments[i]
|
|
8
|
+
|
|
9
|
+
for (var key in source) {
|
|
10
|
+
if (hasOwnProperty.call(source, key)) {
|
|
11
|
+
target[key] = source[key]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return target
|
|
17
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "xtend",
|
|
3
|
+
"version": "4.0.2",
|
|
4
|
+
"description": "extend like a boss",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"extend",
|
|
7
|
+
"merge",
|
|
8
|
+
"options",
|
|
9
|
+
"opts",
|
|
10
|
+
"object",
|
|
11
|
+
"array"
|
|
12
|
+
],
|
|
13
|
+
"author": "Raynos <raynos2@gmail.com>",
|
|
14
|
+
"repository": "git://github.com/Raynos/xtend.git",
|
|
15
|
+
"main": "immutable",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "node test"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"tape": "~1.1.0"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/Raynos/xtend",
|
|
24
|
+
"contributors": [
|
|
25
|
+
{
|
|
26
|
+
"name": "Jake Verbaten"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "Matt Esch"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/Raynos/xtend/issues",
|
|
34
|
+
"email": "raynos2@gmail.com"
|
|
35
|
+
},
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"testling": {
|
|
38
|
+
"files": "test.js",
|
|
39
|
+
"browsers": [
|
|
40
|
+
"ie/7..latest",
|
|
41
|
+
"firefox/16..latest",
|
|
42
|
+
"firefox/nightly",
|
|
43
|
+
"chrome/22..latest",
|
|
44
|
+
"chrome/canary",
|
|
45
|
+
"opera/12..latest",
|
|
46
|
+
"opera/next",
|
|
47
|
+
"safari/5.1..latest",
|
|
48
|
+
"ipad/6.0..latest",
|
|
49
|
+
"iphone/6.0..latest"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=0.4"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var test = require("tape")
|
|
2
|
+
var extend = require("./")
|
|
3
|
+
var mutableExtend = require("./mutable")
|
|
4
|
+
|
|
5
|
+
test("merge", function(assert) {
|
|
6
|
+
var a = { a: "foo" }
|
|
7
|
+
var b = { b: "bar" }
|
|
8
|
+
|
|
9
|
+
assert.deepEqual(extend(a, b), { a: "foo", b: "bar" })
|
|
10
|
+
assert.end()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
test("replace", function(assert) {
|
|
14
|
+
var a = { a: "foo" }
|
|
15
|
+
var b = { a: "bar" }
|
|
16
|
+
|
|
17
|
+
assert.deepEqual(extend(a, b), { a: "bar" })
|
|
18
|
+
assert.end()
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test("undefined", function(assert) {
|
|
22
|
+
var a = { a: undefined }
|
|
23
|
+
var b = { b: "foo" }
|
|
24
|
+
|
|
25
|
+
assert.deepEqual(extend(a, b), { a: undefined, b: "foo" })
|
|
26
|
+
assert.deepEqual(extend(b, a), { a: undefined, b: "foo" })
|
|
27
|
+
assert.end()
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test("handle 0", function(assert) {
|
|
31
|
+
var a = { a: "default" }
|
|
32
|
+
var b = { a: 0 }
|
|
33
|
+
|
|
34
|
+
assert.deepEqual(extend(a, b), { a: 0 })
|
|
35
|
+
assert.deepEqual(extend(b, a), { a: "default" })
|
|
36
|
+
assert.end()
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test("is immutable", function (assert) {
|
|
40
|
+
var record = {}
|
|
41
|
+
|
|
42
|
+
extend(record, { foo: "bar" })
|
|
43
|
+
assert.equal(record.foo, undefined)
|
|
44
|
+
assert.end()
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
test("null as argument", function (assert) {
|
|
48
|
+
var a = { foo: "bar" }
|
|
49
|
+
var b = null
|
|
50
|
+
var c = void 0
|
|
51
|
+
|
|
52
|
+
assert.deepEqual(extend(b, a, c), { foo: "bar" })
|
|
53
|
+
assert.end()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test("mutable", function (assert) {
|
|
57
|
+
var a = { foo: "bar" }
|
|
58
|
+
|
|
59
|
+
mutableExtend(a, { bar: "baz" })
|
|
60
|
+
|
|
61
|
+
assert.equal(a.bar, "baz")
|
|
62
|
+
assert.end()
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
test("null prototype", function(assert) {
|
|
66
|
+
var a = { a: "foo" }
|
|
67
|
+
var b = Object.create(null)
|
|
68
|
+
b.b = "bar";
|
|
69
|
+
|
|
70
|
+
assert.deepEqual(extend(a, b), { a: "foo", b: "bar" })
|
|
71
|
+
assert.end()
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
test("null prototype mutable", function (assert) {
|
|
75
|
+
var a = { foo: "bar" }
|
|
76
|
+
var b = Object.create(null)
|
|
77
|
+
b.bar = "baz";
|
|
78
|
+
|
|
79
|
+
mutableExtend(a, b)
|
|
80
|
+
|
|
81
|
+
assert.equal(a.bar, "baz")
|
|
82
|
+
assert.end()
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
test("prototype pollution", function (assert) {
|
|
86
|
+
var a = {}
|
|
87
|
+
var maliciousPayload = '{"__proto__":{"oops":"It works!"}}'
|
|
88
|
+
|
|
89
|
+
assert.strictEqual(a.oops, undefined)
|
|
90
|
+
extend({}, maliciousPayload)
|
|
91
|
+
assert.strictEqual(a.oops, undefined)
|
|
92
|
+
assert.end()
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
test("prototype pollution mutable", function (assert) {
|
|
96
|
+
var a = {}
|
|
97
|
+
var maliciousPayload = '{"__proto__":{"oops":"It works!"}}'
|
|
98
|
+
|
|
99
|
+
assert.strictEqual(a.oops, undefined)
|
|
100
|
+
mutableExtend({}, maliciousPayload)
|
|
101
|
+
assert.strictEqual(a.oops, undefined)
|
|
102
|
+
assert.end()
|
|
103
|
+
})
|