How to use the keys function from ramda
Find comprehensive JavaScript ramda.keys code examples handpicked from public code repositorys.
GitHub: alexa/ask-cli
114 115 116 117 118 119 120 121 122 123
if (getVersionErr) { return callback(getVersionErr); } // if bucket versioning is not set, cli will set it with fixed config { MFADelete: Disabled, Status: Enabled } // if bucket verisoning is already set, skip this step if (typeof response === "object" && R.keys(response).length === 0) { this.putBucketVersioning(bucketName, "Disabled", "Enabled", (putVersionErr) => { if (putVersionErr) { return callback(putVersionErr); }
GitHub: alexa/ask-cli
113 114 115 116 117 118 119 120 121 122
const domainInfo = Manifest.getInstance().getApis(); if (!domainInfo || R.isEmpty(domainInfo)) { throw new CLiError('Skill information is not valid. Please make sure "apis" field in the skill.json is not empty.'); } const domainList = R.keys(domainInfo); if (domainList.length !== 1) { throw new CLiWarn("Skill with multiple api domains cannot be enabled. Skipping the enable process.\n"); } if (CONSTANTS.SKILL.DOMAIN.CAN_ENABLE_DOMAIN_LIST.indexOf(domainList[0]) === -1) {
+ 3 other calls in file
GitHub: alexa/ask-cli
240 241 242 243 244 245 246 247 248 249
const userConfig = {runtime, handler, awsRegion: awsDefaultRegion}; ResourcesConfig.getInstance().setSkillInfraUserConfig(profile, userConfig); } // 3.copy Lambda code from legacy folder and set deployState for each region const legacyFolderPath = path.join(rootPath, CONSTANTS.FILE_PATH.LEGACY_PATH); R.keys(lambdaResourcesMap).forEach((region) => { const {arn, codeUri, v2CodeUri, runtime, handler, revisionId} = lambdaResourcesMap[region]; // 3.1 copy code from v1 project to v2 const v1CodePath = path.join(legacyFolderPath, codeUri); const v2CodePath = path.join(rootPath, v2CodeUri);
+ 4 other calls in file
GitHub: 18xx-maker/18xx-maker
134 135 136 137 138 139 140 141 142 143
R.map(R.prop("color")), sortTiles, R.uniq, R.map(getTile) )(R.keys(game.tiles)); let colors = R.keys(counts); // Tile Trays for (let j = 0; j < colors.length; j++) { let color = colors[j];
GitHub: alexa/ask-cli
172 173 174 175 176 177 178 179 180 181
// for backward compatibility, defaulting to api from skill manifest if targetEndpoints is not defined const domains = targetEndpoints.length ? targetEndpoints : Object.keys(Manifest.getInstance().getApis()); // 1.update local skill.json file: // update the "uri" in all target api endpoints for each region domains.forEach((domain) => { R.keys(rawDeployResult).forEach((region) => { Manifest.getInstance().setApisEndpointByDomainRegion(domain, region, rawDeployResult[region].endpoint); }); }); // add skill events if defined in resources config
+ 2 other calls in file
GitHub: pagarme/escriba
67 68 69 70 71 72 73 74 75 76 77 78 79
return url.length > urlLengthLimit ? truncateUrl(url) : url } const parsePropsType = (reqProps, propsType) => { const propsTypeKeys = R.keys(propsType) if (propsTypeKeys.length === 0) { return reqProps }
+ 283 other calls in file
GitHub: DFEAGILEDEVOPS/MTC
![DFEAGILEDEVOPS profile picture](/DFEAGILEDEVOPS.png?size=40)
62 63 64 65 66 67 68 69 70 71
* Returns a function that extracts the keys from an object joins them together in a sql fragment * @type {Function} */ const extractColumns = R.compose( R.join(' , '), R.keys ) /** * Prefix a string with '@'
+ 7 other calls in file
GitHub: mvp-rockets/lib-core
3 4 5 6 7 8 9 10 11 12 13 14
const HTTP_CONSTANT = require('../utilities/http-constant'); const notNil = R.compose(R.not, R.isNil); const mapValueAndRules = R.curry((data, allRules) => { const keys = R.keys(allRules); return R.map((key) => { const value = data ? data[key] : undefined; const rules = allRules[key]; return R.cond([
+ 137 other calls in file
29 30 31 32 33 34 35 36 37 38
return load(files); }; const loadAllSql = R.pipe(R.map(loadSql), R.mergeAll); const prefixExplain = (queries) => R.keys(queries).reduce((acc, name) => R.assoc(name, `EXPLAIN (ANALYZE, FORMAT JSON) ${queries[name]}`, acc), {}); const sqlFormatter = (sql, values) => [R.apply(formatFn, [sql].concat(values)), []]; const _prepare = (format, queries, queryName, values = []) => {
+ 7 other calls in file
GitHub: pounce-lang/js-core
4149 4150 4151 4152 4153 4154 4155 4156 4157 4158
// if (item !== undefined) { // return JSON.parse(JSON.stringify(item)); // } // return item; // } var introspectWords = function () { return r.keys(r.omit(['popInternalCallStack'], coreWords)); }; var introspectWord = function (wn) { return JSON.parse(JSON.stringify(r.path([wn], coreWords))); }; var clone = function (source) { if (source === null) return source;
+ 4 other calls in file
153 154 155 156 157 158 159 160 161 162 163
}; exports.selectOperators = selectOperators; var getSearchProgressByPercent = (0, _reselect.createSelector)(selectOperators(), function (operators) { return R.call(R.pipe(R.values, R.filter(Boolean), R.length, function (doneOperatorsCount) { return doneOperatorsCount * 100 / R.keys(operators).length; }, R.when(function (count) { return !count; }, R.always(0))), operators); });
+ 41 other calls in file
GitHub: corporatepiyush/es6
149 150 151 152 153 154 155 156 157 158
name: 'Penelope Cruz', profession: 'Actor', nationality: 'Spanish', married: true } console.log("object keys =", _.keys(obj)) console.log("object values =", _.values(obj)) console.log("object add attribute =", _.assoc('height', 1.68, obj)) console.log("object remove attribute =", _.dissoc('nationality', obj)) console.log("object check attribute =", _.has('married', obj))
202 203 204 205 206 207 208 209 210 211
const conn = await db() const currentProfile = await getProfile(profileType, id) let tags = prop('tags', currentProfile) // Pick tags that are still in the database const tagsInDB = await conn('profile_keys').select('id').whereIn('id', keys(tags)) tags = pick(map(prop('id'), tagsInDB), tags) // Add the attribute values
36 37 38 39 40 41 42 43 44 45
'features': [], 'properties': obj.metadata }; ways.forEach(function (way) { var tags = R.keys(way.tags); // Process buildings if (R.contains('building', tags)) { pipeline.zincrby('ogp:buildings', 1, user); pipeline.zincrby('ogp:buildings', 1, 'total');
289 290 291 292 293 294 295 296 297
value: function merge(prevCatalogs, nextCatalog, options) { var _this = this; var nextKeys = R.keys(nextCatalog).map(String); return R.mapObjIndexed(function (prevCatalog, locale) { var prevKeys = R.keys(prevCatalog).map(String); var newKeys = R.difference(nextKeys, prevKeys); var mergeKeys = R.intersection(nextKeys, prevKeys); var obsoleteKeys = R.difference(prevKeys, nextKeys); // Initialize new catalog with new keys
+ 3 other calls in file
GitHub: brrf/practice-projects
6384 6385 6386 6387 6388 6389 6390 6391 6392 6393
* @param {Object} obj The object to extract properties from * @return {Array} An array of the object's own properties. * @see R.keysIn, R.values * @example * * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c'] */ var keys = typeof Object.keys === 'function' && !hasArgsEnumBug ? /*#__PURE__*/_curry1(function keys(obj) { return Object(obj) !== obj ? [] : Object.keys(obj); }) : /*#__PURE__*/_curry1(function keys(obj) {
GitHub: cberube/AoC-2022
110 111 112 113 114 115 116 117 118 119
//if (isCovered && !hasBeacon) coveredCount++ coveredMap[pointToKey({ x, y: row })] = isCovered } console.log(coveredMap) return R.keys(coveredMap).length } //console.log(sensorList) console.log(mapExtent)
103 104 105 106 107 108 109 110 111 112
const mergeLayoutAndData = (structure, depth) => { return { ...structure, form: structure?.form ? formsWithState[structure.form] : {}, //currentSelectedForm: formsWithState[depth] ? R.keys(formsWithState[depth])[0] : "", subfolders: structure.subfolders.reduce((acc, subfolder) => { return { ...acc, [subfolder.moduleName]: mergeLayoutAndData(subfolder, depth + 1)
+ 7 other calls in file
38 39 40 41 42 43 44 45 46 47 48
<FolderSummaryPanel sumaryItems={folderItem.items} /> </div> } const getDeficienciesFromAnswers = (answers, folderName, fields) => { return R.keys(answers).reduce((acc, label) => { if (!fields[label]) { return acc } const field = answers[label]
GitHub: desenmeng/ramda
205 206 207 208 209 210 211 212 213 214 215
return recur(R.tail(ins), R.append(R.head(ins), outs)); } else { return recur(R.append(R.head(ins), R.tail(ins)), outs); } }; return recur(R.sortBy(R.identity, R.keys(graph)), []); }; // getModifiedSource :: String -> String var getModifiedSource = function getModifiedSource(identifier) {
ramda.clone is the most popular function in ramda (30311 examples)