forked from brave/browser-laptop
-
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.
Resolves brave#11851 Auditors: Test Plan:
- Loading branch information
Showing
22 changed files
with
969 additions
and
243 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
const Immutable = require('immutable') | ||
const assert = require('assert') | ||
|
||
const { makeImmutable, isMap } = require('../state/immutableUtil') | ||
|
||
const validateState = function (state) { | ||
state = makeImmutable(state) | ||
assert.ok(isMap(state), 'state must be an Immutable.Map') | ||
assert.ok(isMap(state.getIn(['cache', 'ledgerVideos'])), 'state must contain ledgerVideos as Immutable.Map') | ||
return state | ||
} | ||
|
||
const getDataByVideoId = (state, key) => { | ||
state = validateState(state) | ||
if (key == null) { | ||
return Immutable.Map() | ||
} | ||
|
||
return state.getIn(['cache', 'ledgerVideos', key]) || Immutable.Map() | ||
} | ||
|
||
const setCacheByVideoId = (state, key, data) => { | ||
state = validateState(state) | ||
if (key == null) { | ||
return state | ||
} | ||
|
||
data = makeImmutable(data) | ||
|
||
return state.setIn(['cache', 'ledgerVideos', key], data) | ||
} | ||
|
||
module.exports = { | ||
getDataByVideoId, | ||
setCacheByVideoId | ||
} |
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,9 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
const providers = { | ||
YOUTUBE: 'youtube' | ||
} | ||
|
||
module.exports = providers |
Oops, something went wrong.