react-native/local-cli/rnpm/link/src/android/patches/applyParams.js

15 lines
351 B
JavaScript
Raw Normal View History

const toCamelCase = require('lodash').camelCase;
module.exports = function applyParams(str, params, prefix) {
return str.replace(
/\$\{(\w+)\}/g,
(pattern, param) => {
const name = toCamelCase(prefix) + '_' + param;
return params[param]
? `this.getResources().getString(R.string.${name})`
: null;
}
);
};