berish-pathof
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Berish PathOf · Apache license Coverage Status


Контроль доступа к полям определенного объекта по динамическому ключу. Полная поддержка typescript

npm install berish-pathof --save

Пример

import * as PathOf from 'berish-pathof';

const model = {
  login: 'root',
  password: 'admin123456',
  profile: {
    firstname: 'Ravil',
    lastname: 'Berishev',
  },
};

const pathResult = PathOf.of(model)('login');

console.log(pathResult.get()); // 'root'
console.log(pathResult.original); // === model
console.log(pathResult.path); // ['login'];

pathResult.set('root2');
console.log(pathResult.get()); // root2
console.log(model.login); // root2

Readme

Keywords

none

Package Sidebar

Install

npm i berish-pathof

Weekly Downloads

1

Version

1.0.0

License

Apache License 2.0

Unpacked Size

17.4 kB

Total Files

8

Last publish

Collaborators

  • quadraticstudio