1.0.1 • Published 3 years ago

@jswork/next-try-execute v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

next-try-execute

Try execute a method on context.

version license size download

installation

npm install -S @jswork/next-try-execute

usage

import '@jswork/next-try-execute';

const someApi = {
  deleted: false,
  del: function (value) {
    this.deleted = value;
  },
  delete: function (value) {
    console.warn("delete is deprecated, use del instead");
    this.del(value);
  },
};

console.log(someApi.deleted); // false
nx.tryExecute(someApi, [], ["del", "delete"]);
console.log(someApi.deleted); // undefined

license

Code released under the MIT license.