
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@ngha/nested-value
Advanced tools
This library get object value by path
Import NestedValueModule
to your module
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app';
import { NestedValueModule } from '@ngha/nested-value';
@NgModule({
imports: [NestedValueModule],
})
export class AppModule {}
Returns value of an object value
Usage: object | nestedValue: 'path' : 'defaultValue'
<p>{{{ 'a': 'aa' } | nestedValue:'a'}}</p>
<!-- Output: "aa" -->
<p>{{{ c: [{ d: '123', e: 'abc' }, { d: '456', e: 'def' }] } | nestedValue:'c[0].d'}}</p>
<!-- Output: "123" -->
<p>{{{ c: [{ d: '123', e: 'abc' }, { d: '456', e: 'def' }] } | nestedValue:['c', [1], 'e']}}</p>
<!-- Output: "def" -->
<p>{{{ c: [{ d: '123', e: 'abc' }, { d: '456', e: 'def' }] } | nestedValue:['c', [3], 'f']: 'default'}}</p>
<!-- Output: "default" -->
<p>{{{ c: [{ d: '123', e: 'abc' }, { d: '456', e: 'def' }] } | nestedValue:['c', [3], 'f']}}</p>
<!-- Output: undefine -->
import {NestedValueService} from '@ngha/nested-value'
@Component({
providers: [TransformObjectService],
})
export class AppComponent
{
constructor(private service: TransformObjectService)
{
const obj = {
aa: [{ b: { c: 0 }, 1: 0 }],
dd: { ee: { ff: 2 } },
gg: { h: 2 },
'gg.h': 1,
'kk.ll': { 'mm.n': [3, 4, { 'oo.p': 5 }, { 'oo': { p: 6 } }] },
tt: null
};
const result1 = this.service.nestedValue(obj , 'aa[0].b.c' ) === obj['aa'][0]['b']['c']
// Output: result1 = true
const result2 = this.service.nestedValue(obj , 'aa[0][1]') === obj['aa'][0][1]
// Output: result2 = true
const result3 = this.service.nestedValue(obj , ['kk.ll', 'mm.n', 2, 'oo.p']) === obj['kk.ll']['mm.n'][2]['oo.p']
// Output: result3 = true
const result4 = this.service.nestedValue(obj , ['kk.ll', 'mm.n', 3, 'oo', 'p']) === 6
// Output: result4 = true
const result5 = this.service.nestedValue(undefine , ['kk'] , 1) === 1
// Output: result5 = true
const result6 = this.service.nestedValue(undefine , 'kk') === undefine
// Output: result6 = true
}
}
FAQs
nestedValue the value at `path` of `object`
The npm package @ngha/nested-value receives a total of 6 weekly downloads. As such, @ngha/nested-value popularity was classified as not popular.
We found that @ngha/nested-value demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.