consul/ui/packages/consul-ui/app/helpers/last.js

18 lines
368 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { helper } from '@ember/component/helper';
export function last([obj = ''], hash) {
// TODO: Another candidate for a reusable type checking
// util for helpers
switch (true) {
case typeof obj === 'string':
return obj.substr(-1);
}
}
export default helper(last);