TypeScript μ½λ(https://lodash.com/docs#chainμμ):
var users = [
{ 'user': 'barney', 'age': 36 },
{ 'user': 'fred', 'age': 40 },
{ 'user': 'pebbles', 'age': 1 }
];
var youngest = _.chain(users)
.sortBy('age')
.map(function(chr) {
return chr.user + ' is ' + chr.age;
})
.first()
.value();
tsc μ»΄νμΌλ¬ λΆλ§ μ¬ν:
error TS2339: Property 'sortBy' does not exist on type 'LoDashExplicitArrayWrapper<{ 'user': string; 'age': number; }>'.
pluck
λ§μ°¬κ°μ§μ
λλ€.
μ, μμ μ€μ΄λ©° μ΄λ€ λ°©λ²μ΄ ν₯λ―Έλ‘μ΄μ§ μ μ΄μ£Όμλ©΄ λ¨Όμ μΆκ°νκ² μ΅λλ€.
by #6600 :+1:
error TS2339: Property 'first' does not exist on type 'LoDashExplicitArrayWrapper<string>'.
@joe-chung λ€, λͺ¨λ μ μμ λͺ κ°μ§ λ¬Έμ κ° μμΌλ©° μ§κΈ λΉμ₯ first
(λ° μΌλΆ λ€λ₯Έ λ°©λ²)μ μλͺ
μ μΆκ°νκΈ° μ΄λ ΅κ² λ§λλλ€.
Property 'some' does not exist on type 'LodashArrayWrapper<any[]>'
@thakursagar μΈν°νμ΄μ€ LodashArrayWrapper
μ μ μμ μ‘΄μ¬νμ§ μλ lodash
μ€λ μκ° λμ. μ΅μ λ²μ μ μ μλ₯Ό μ¬μ©νκ³ μλμ§ νμΈνμμμ€. some
λ©μλλ μ΄λ―Έ μ μλν©λλ€.
LoDashExplicitArrayWrapperμμ _.reduceμ λν PRμ μ μΆνμκ² μ΅λκΉ? μ΄κ²μ μ°λ¦¬μκ² λμμ΄ λ κ²μ λλ€
@gamebox μ,
_.uniqBy
λ νμν©λλ€
λν _.flattenDepth()
λ° _.sort
κ·Έλ¦¬κ³ _.λΆν
_.flatMap
μ£ΌμΈμ
@chrootsu _.update
λ° _.updateWith
λΆνλ립λλ€ :)
μμ± 'mean'μ 'LoDashStatic' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
_(x).splitμ μΆκ°νμΈμ.
λμΌν λ¬Έμ : Property 'split' does not exist on type 'LoDashExplicitWrapper<string>'
λ‘λμ λ²μ : 3.10.1
νμ΄ν.json μ’
μμ±:
"lodash": "registry:dt/lodash#3.10.0+20160802150749"
_.keyBy
λ λλ½λ κ² κ°μ΅λλ€.
_.findWhereλ λλ½λμμ΅λλ€. μ΄κ²λ μΆκ°ν΄μ£Όμλ©΄ μλ κΉμ...
κ·Έλλ‘ _.assign
_.flatMapDeep μ£ΌμΈμ? :)
LoDashExplicitArrayWrapperμ _.max
μΈν°νμ΄μ€ LoDashExplicitArrayWrapper
/**
* @see _.max
*/
μ΅λ(
λ°λ³΅μ: ListIterator
): LoDashExplicitWrapper
/**
* <strong i="17">@see</strong> _.max
*/
max(iteratee: string): LoDashExplicitWrapper<number>;
/**
* <strong i="18">@see</strong> _.max
*/
max(): LoDashExplicitWrapper<number>;
/**
* <strong i="19">@see</strong> _.max
*/
max(iteratee: Dictionary<{}>): LoDashExplicitWrapper<number>;
}
μ μ΄κ²μ΄ λ«ν μλμ§ νμ€νμ§ μμ΅λλ€ ... νμ΄νμμ λλ½ λ λ§μ λ°©λ²μ΄μλ κ² κ°μ΅λλ€ ( μ μκ²λ _.uniqWith
)
λ° _.find
λ λ€
Property 'find' does not exist on type 'LoDashExplicitObjectWrapper<{}>'.
그리κ³
Property 'find' does not exist on type 'LoDashExplicitArrayWrapper<{}[]>'
λ° _.μ
Property 'pairs' does not exist on type 'LoDashStatic'.
_.ν¬ν¨
_.λλλ€
_.chain μ΄νμ 무μμ΄λ μ§ μ΄ μ€λ₯κ° λ°μν©λλ€. μμ νλ λ° λμμ μ£ΌμΈμ @chrootsu @rbcasperson
_.μ§λλ...
μ΄ λ¬Έμ λ λ€μ μ΄μ΄μΌ ν©λλ€.
μμ λκΈμ νμΈνλλ° μ¬μ ν λλ½λ κ² κ°μ΅λλ€.
_.divide();
_.include();
_.pairs();
μ΄ λ²κ·Έλ λ§μ λ©μλ(μμ μΈκΈλ¨)κ° μ¬μ ν μ¬λ°λ₯Έ νμ΄νμ κ°μ§κ³ μμ§ μκΈ° λλ¬Έμ λ€μ μ΄μ΄μΌ ν©λλ€.
λν λ³ν λ λλ½λμμ΅λλ€.
μ¬κΈ°μμ λ€λ₯Έ μ¬λμ΄ λ³λλ‘ λ³΄κ³ νμ΅λλ€. #14748
μ΄κ²μ 곧 κ³ μ³μ§ κ²μΈκ°?
ν΄κ²° λ°©λ²μ΄ μμ΅λκΉ?
ν΄κ²° λ°©λ²μ λ€μκ³Ό κ°μ μ μμ΅λλ€.
(lodash.chain(stuff).pickBy(lodash.isArray) as any).transform(transformFunction, []).value();
_.mapValues()λ UnderscoreStaticμ μ‘΄μ¬νμ§ μμ΅λλ€. μ΄ λ°©λ²μ lodash μΉμ μ λ°μ΄νΈμμ λλ½λμμ΅λλ€.
_mapValuesλ 체μΈμ ν¬ν¨λμ§ μκ³ λ 립 μ€ννμΌλ‘ μλνλ κ² κ°μ΅λλ€.
'LoDashImplicitArrayWrapper' μ νμ 'keys' μμ±μ΄ μμ΅λλ€.
μμ± 'κΈΈμ΄'κ° 'LoDashImplicitArrayWrapper<...>' μ νμ μμ΅λλ€.
μ ν 'LoDashImplicitObjectWrapper'μ 'differenceWith' μμ±μ΄ μμ΅λλ€.
μ²΄μΈ λμμ https://lodash.com/docs/#prototype -valueλ₯Ό νΈμΆν΄μΌ ν©λλ€.
_.λ² μ£ΌμΈμ
_.νν°μ μ£ΌμΈμ
_.cond μ λ°
_.λ€μλ λΆνλ립λλ€
_.upperCase λ° _.deburr λΆνλ립λλ€.
chain(blabla).mapValues()......
tslint μ€λ₯μ λν κ²°κ³Ό
Property 'mapValues' does not exist on type 'LoDashExplicitObjectWrapper<{}>'.
Opps... lodashμ λ©μλκ° μμ΅λλ€.
μ΄κ²μ κ±°μ μλνμ§λ§ .pickByλ μ΄ λ¬Έμ μ λμμ΄ λ©λλ€!
(lodash.chain(stuff).pickBy(lodash.isArray) as any).transform(transformFunction, []).value();
_.uniqμ ν¨κ» μ£ΌμΈμ
μ°λ¦¬ μ€μ€λ‘ ν΄κ²°ν μ μλ λ°©λ²μ΄ μμκΉμ?
μ΄ μ€λ λλ λͺ λ μ μ΄κ³ μ¬μ ν μλνμ§ μλ κΈ°λ₯μ΄ μμ΅λλ€!
@charlesr1971 _.uniqWith
μλ λ¬Έμ κ° μμ΅λλ€. ν¨μκ° μ¬μ ν μλνμ§λ§ μΈν°νμ΄μ€κ° μμ§ μ μλμ§ μμ κ² κ°μ΅λλ€.
κ°μ₯ μ μ©ν λκΈ
ν΄κ²° λ°©λ²μ λ€μκ³Ό κ°μ μ μμ΅λλ€.