How to use just-clone - 10 common examples

To help you get started, we’ve selected a few just-clone examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uber / baseweb / documentation-site / components / yard / code-generator.ts View on Github external
export const getAstImports = (
  importsConfig: TImportsConfig,
  props: {[key: string]: TProp},
) => {
  // global scoped import that are always displayed
  const importList = clone(importsConfig);

  // prop level imports (typically enums related) that are displayed
  // only when the prop is being used
  Object.values(props).forEach(prop => {
    if (
      prop.imports &&
      prop.value &&
      prop.value !== '' &&
      prop.value !== prop.defaultValue
    ) {
      for (let [importFrom, importNames] of Object.entries(prop.imports)) {
        if (!importList.hasOwnProperty(importFrom)) {
          importList[importFrom] = {
            named: [],
            default: '',
          };
github abpframework / abp / npm / ng-packs / dist / core / esm5 / lib / plugins / config / config.plugin.js View on Github external
function (state, event, next) {
        /** @type {?} */
        var matches = actionMatcher(event);
        /** @type {?} */
        var isInitAction = matches(InitState) || matches(UpdateState);
        if (isInitAction && !this.initialized) {
            /** @type {?} */
            var transformedRoutes = transformRoutes(this.router.config);
            var routes = transformedRoutes.routes;
            var wrappers = transformedRoutes.wrappers;
            routes = organizeRoutes(routes, wrappers);
            /** @type {?} */
            var flattedRoutes = flatRoutes(clone(routes));
            state = setValue(state, 'ConfigState', tslib_1.__assign({}, (state.ConfigState && tslib_1.__assign({}, state.ConfigState)), this.options, { routes: routes,
                flattedRoutes: flattedRoutes }));
            this.initialized = true;
        }
        return next(state, event);
    };
    ConfigPlugin.decorators = [
github prebid / Prebid.js / src / utils.js View on Github external
export function deepClone(obj) {
  return clone(obj);
}
github abpframework / abp / npm / ng-packs / dist / core / esm5 / lib / directives / for.directive.js View on Github external
function () {
        var _this = this;
        /** @type {?} */
        var items = (/** @type {?} */ (clone(this.items)));
        if (!Array.isArray(items))
            return;
        /** @type {?} */
        var compareFn = this.compareFn;
        if (typeof this.filterBy !== 'undefined' && this.filterVal) {
            items = items.filter((/**
             * @param {?} item
             * @return {?}
             */
            function (item) { return compareFn(item[_this.filterBy], _this.filterVal); }));
        }
        switch (this.orderDir) {
            case 'ASC':
                this.sortItems(items);
                this.projectItems(items);
                break;
github abpframework / abp / npm / ng-packs / packages / core / src / lib / plugins / config.plugin.ts View on Github external
handle(state: any, event: any, next: NgxsNextPluginFn) {
    const matches = actionMatcher(event);
    const isInitAction = matches(InitState) || matches(UpdateState);

    if (isInitAction && !this.initialized) {
      const transformedRoutes = transformRoutes(this.router.config);
      let { routes } = transformedRoutes;
      const { wrappers } = transformedRoutes;

      routes = organizeRoutes(routes, wrappers);
      const flattedRoutes = flatRoutes(clone(routes));
      state = setValue(state, 'ConfigState', {
        ...(state.ConfigState && { ...state.ConfigState }),
        ...this.options,
        routes,
        flattedRoutes,
      });

      this.initialized = true;
    }

    return next(state, event);
  }
}
github abpframework / abp / npm / ng-packs / dist / core / esm2015 / lib / directives / for.directive.js View on Github external
ngOnChanges() {
        /** @type {?} */
        let items = (/** @type {?} */ (clone(this.items)));
        if (!Array.isArray(items))
            return;
        /** @type {?} */
        const compareFn = this.compareFn;
        if (typeof this.filterBy !== 'undefined' && this.filterVal) {
            items = items.filter((/**
             * @param {?} item
             * @return {?}
             */
            item => compareFn(item[this.filterBy], this.filterVal)));
        }
        switch (this.orderDir) {
            case 'ASC':
                this.sortItems(items);
                this.projectItems(items);
                break;
github abpframework / abp / npm / ng-packs / packages / core / src / lib / directives / for.directive.ts View on Github external
ngOnChanges() {
    let items = clone(this.items) as any[];
    if (!Array.isArray(items)) return;

    const compareFn = this.compareFn;

    if (typeof this.filterBy !== 'undefined' && this.filterVal) {
      items = items.filter(item => compareFn(item[this.filterBy], this.filterVal));
    }

    switch (this.orderDir) {
      case 'ASC':
        this.sortItems(items);
        this.projectItems(items);
        break;

      case 'DESC':
        this.sortItems(items);
github abpframework / abp / npm / ng-packs / dist / core / esm2015 / lib / directives / table-sort.directive.js View on Github external
ngOnChanges({ value, abpTableSort }) {
        if (value || abpTableSort) {
            this.abpTableSort = this.abpTableSort || ((/** @type {?} */ ({})));
            this.table.value = this.sortPipe.transform(clone(this.value), this.abpTableSort.order, this.abpTableSort.key);
        }
    }
}
github abpframework / abp / npm / ng-packs / dist / core / esm5 / lib / directives / table-sort.directive.js View on Github external
function (_a) {
        var value = _a.value, abpTableSort = _a.abpTableSort;
        if (value || abpTableSort) {
            this.abpTableSort = this.abpTableSort || ((/** @type {?} */ ({})));
            this.table.value = this.sortPipe.transform(clone(this.value), this.abpTableSort.order, this.abpTableSort.key);
        }
    };
    TableSortDirective.decorators = [
github abpframework / abp / npm / ng-packs / dist / core / esm2015 / lib / plugins / config / config.plugin.js View on Github external
handle(state, event, next) {
        /** @type {?} */
        const matches = actionMatcher(event);
        /** @type {?} */
        const isInitAction = matches(InitState) || matches(UpdateState);
        if (isInitAction && !this.initialized) {
            /** @type {?} */
            const transformedRoutes = transformRoutes(this.router.config);
            let { routes } = transformedRoutes;
            const { wrappers } = transformedRoutes;
            routes = organizeRoutes(routes, wrappers);
            /** @type {?} */
            const flattedRoutes = flatRoutes(clone(routes));
            state = setValue(state, 'ConfigState', Object.assign({}, (state.ConfigState && Object.assign({}, state.ConfigState)), this.options, { routes,
                flattedRoutes }));
            this.initialized = true;
        }
        return next(state, event);
    }
}

just-clone

deep copies objects and arrays

MIT
Latest version published 2 years ago

Package Health Score

64 / 100
Full package analysis

Popular just-clone functions