仅将选定属性复制到新对象

时间:2018-04-18 05:59:59

标签: javascript typescript

我有一系列我感兴趣的键,如

fillable = ['name', 'lastname', 'address' ]

并且request对象可以发送任意数量的参数

我想创建一个新的数据对象,它只包含fillable array

表示的变量

有没有更好的方法来做到这一点,没有循环?在ES6左右

1 个答案:

答案 0 :(得分:0)

一种选择是使用let paymentConfig = STPPaymentConfiguration.init(); paymentConfig.requiredBillingAddressFields = STPBillingAddressFields.none; paymentConfig.publishableKey = "pk_test_whRD827lMXvFb1MtY9T7bRzW" let theme = STPTheme.default(); let addCardViewController = STPAddCardViewController.init(configuration: paymentConfig, theme: theme); addCardViewController.delegate = self; let navigationController = UINavigationController(rootViewController: addCardViewController); self.present(navigationController, animated: true, completion: nil); func addCardViewController(_ addCardViewController: STPAddCardViewController, didCreateToken token: STPToken, completion: @escaping STPErrorBlock) { print(token) dismiss(animated: true) }

echo 'a,b,c,"hello, hi",d' | csvtool col 4 -