Skip to content

afeiship/next-try-execute

Repository files navigation

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.